/* --- 全体レイアウト --- */
body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    transition: background-color 0.5s;
    background-color: #f0f2f5;
    position: relative;
    color: #333;
}

/* --- 時計（左上） --- */
#clock-container {
    position: absolute;
    top: 20px;
    left: 20px;
    border: 2px solid #555;
    padding: 10px 20px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.clock-label {
    font-size: 1.2rem;
    font-weight: bold;
    color: #666;
    margin-bottom: 4px;
}

#clock-time {
    font-size: 2.5rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

/* --- タイマーメイン表示 --- */
#timer-display {
    font-size: 22rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    margin-top: 40px;
    margin-bottom: 10px;
}

#target-status-display {
    display: flex;
    gap: 12px;
    margin-bottom: -10px;
    justify-content: center;
    min-height: 40px; /* ガタつき防止 */
}

.status-badge {
    font-size: 1.1rem;
    font-weight: bold;
    color: #888;
    padding: 4px 14px;
    border-radius: 20px;
    border: 2px solid #eee;
    background-color: white;
    transition: all 0.3s;
}

/* プレゼン：現在向かっているベル */
.status-badge.active {
    color: #2d3436;
    border-color: #0984e3;
    background-color: #e1f5fe;
    transform: scale(1.05);
}

/* 試験：終了予定時刻などは常に強調 */
#exam-target-labels .status-badge {
    color: #2d3436;
    border-color: #6c5ce7; /* 試験モードは少し違う色に */
    background-color: #f3f0ff;
}

/* --- プログレスバー --- */
.progress-container {
    width: 60%;
    height: 12px;
    background-color: #ddd;
    border-radius: 6px;
    margin-bottom: 40px;
    overflow: hidden;
}

#progress-bar {
    width: 100%;
    height: 100%;
    background-color: #00b894;
    transition: width 1s linear, background-color 0.5s;
}

/* --- 下部コントロールボタン --- */
.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

button {
    padding: 10px 20px;
    font-size: 1.2rem;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background-color: #333;
    color: white;
    transition: opacity 0.2s;
}

#start-stop-btn {
    min-width: 120px; /* 文字が変わってもボタン幅がガタつかないように */
    transition: background-color 0.3s, transform 0.1s;
}

#start-stop-btn:active {
    transform: scale(0.95); /* 押した感を追加 */
}

button:hover { opacity: 0.8; }

/* --- 設定パネル（右側） --- */
#config-panel {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 280px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
    z-index: 100;
    color: #333;
}

#config-panel h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

/* モード・方式の行（2つの要素を両端に） */
.config-row {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.config-row select, 
.config-row input {
    width: 180px;
    padding: 4px;
    font-size: 0.9rem;
}

/* --- 鈴の設定行（分・秒入力） --- */
.config-row-time {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    transition: opacity 0.3s;
}

.config-row-time label {
    display: flex;
    align-items: center;
    flex: 0 0 85px; /* ラベル幅を固定してチェックボックスを整列 */
    font-size: 0.9rem;
    cursor: pointer;
}

.config-row-time input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    margin-right: 8px;
    cursor: pointer;
}

/* 分・秒のグループ */
.input-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.input-group input[type="number"] {
    width: 45px !important; /* config-rowの150px指定を上書き */
    padding: 4px;
    text-align: right;
    font-size: 0.9rem;
}

.input-group span {
    font-size: 0.8rem;
    color: #666;
    margin-right: 6px;
}

#template-select {
    width: 150px;
    padding: 4px;
    font-size: 0.9rem;
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* 適用ボタン */
#apply-btn {
    width: 100%;
    background-color: #0984e3;
    color: white;
    margin-top: 10px;
    font-weight: bold;
    font-size: 1rem;
}

#apply-btn:hover { background-color: #74b9ff; }

/* --- 状態・無効化 --- */
.disabled {
    opacity: 0.3;
}

input:disabled {
    cursor: not-allowed;
}

body.warning { background-color: #ffeaa7; }
body.danger { background-color: #ff7675; color: white; }

/* Danger時の時計の色調整 */
body.danger #clock-container {
    border-color: white;
    background-color: rgba(0, 0, 0, 0.2);
}
body.danger .clock-label, 
body.danger #clock-time {
    color: white;
}