/* ========================================
   Interval Timer — timer.css
   ======================================== */

/* タブ切り替え */
.it-tab-toggle {
    display: flex;
    gap: 0;
    margin: 16px 16px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #333;
}
.it-tab-btn {
    flex: 1;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 700;
    color: #999;
    background: #1a1a1a;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.it-tab-btn.active {
    background: var(--primary, #dc143c);
    color: #fff;
}

/* セクションラベル */
.it-section-label {
    font-size: 13px;
    font-weight: 700;
    color: #888;
    margin: 16px 16px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 種目選択ボタン (SQ/BP/DL) */
.it-exercise-row {
    display: flex;
    gap: 8px;
    margin: 16px 16px 0;
}
.it-exercise-btn {
    flex: 1;
    padding: 12px 0;
    font-size: 16px;
    font-weight: 700;
    color: #ccc;
    background: #2a2a2a;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.it-exercise-btn.active {
    background: var(--primary, #dc143c);
    color: #fff;
    border-color: var(--primary, #dc143c);
}

/* RPEラベル */
.it-rpe-label {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin: 16px 16px 10px;
}

/* RPE選択ボタン（5列×2行グリッド） */
.it-rpe-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin: 0 16px;
}
.it-rpe-btn {
    padding: 10px 4px;
    font-size: 15px;
    font-weight: 600;
    color: #ccc;
    background: #2a2a2a;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.it-rpe-btn.active {
    background: var(--primary, #dc143c);
    color: #fff;
    border-color: var(--primary, #dc143c);
}

/* プリセット選択ボタン（5列×2行グリッド） */
.it-preset-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin: 0 16px;
}
.it-preset-btn {
    padding: 10px 4px;
    font-size: 15px;
    font-weight: 600;
    color: #ccc;
    background: #2a2a2a;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.it-preset-btn.active {
    background: var(--primary, #dc143c);
    color: #fff;
    border-color: var(--primary, #dc143c);
}

/* カウントダウン表示エリア */
.it-display-area {
    text-align: center;
    margin: 24px 16px 16px;
}
.it-countdown {
    font-size: 64px;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    letter-spacing: 2px;
    transition: color 0.3s;
}
.it-countdown.warning {
    color: #ffa500;
}
.it-countdown.urgent {
    color: #ff4444;
    animation: it-pulse 0.8s ease-in-out infinite;
}
.it-countdown.completed {
    color: #4ade80;
    animation: it-pulse 1s ease-in-out infinite;
}

@keyframes it-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* プログレスバー */
.it-progress-bar {
    height: 4px;
    background: #333;
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}
.it-progress-fill {
    height: 100%;
    background: var(--primary, #dc143c);
    border-radius: 2px;
    width: 100%;
}
.it-progress-fill.warning {
    background: #ffa500;
}
.it-progress-fill.urgent {
    background: #ff4444;
}

/* 調整ボタン (±10秒 / ±5秒) */
.it-adjust-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 12px 16px;
}
.it-adjust-btn {
    min-width: 80px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 600;
    color: #ccc;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.it-adjust-btn:active {
    background: #3a3a3a;
}

/* 延長ボタン (+30秒) */
.it-extend-row {
    display: flex;
    justify-content: center;
    margin: 12px 16px;
}
.it-extend-btn {
    min-width: 120px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: #2a5a2a;
    border: 2px solid #4ade80;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.it-extend-btn:active {
    background: #3a6a3a;
}

/* コントロールボタン */
.it-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 16px 24px;
    flex-wrap: wrap;
}
.it-btn-start,
.it-btn-resume {
    flex: 1;
    max-width: 240px;
    padding: 14px 24px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    background: var(--primary, #dc143c);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.it-btn-start:active,
.it-btn-resume:active {
    opacity: 0.8;
}
.it-btn-pause {
    flex: 1;
    max-width: 240px;
    padding: 14px 24px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    background: #555;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.it-btn-pause:active {
    opacity: 0.8;
}
.it-btn-reset {
    flex: 1;
    max-width: 240px;
    padding: 14px 24px;
    font-size: 18px;
    font-weight: 700;
    color: #ccc;
    background: #333;
    border: 1px solid #555;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.it-btn-reset:active {
    opacity: 0.8;
}

/* タブコンテンツ */
.it-tab-content {
    padding-bottom: 8px;
}

/* フリータイマー ピッカー */
.it-free-label {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin: 16px 16px 12px;
}
.it-free-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 16px;
}
.it-free-picker-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.it-free-arrow {
    width: 60px;
    height: 40px;
    font-size: 20px;
    color: #ccc;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}
.it-free-arrow:active {
    background: #3a3a3a;
}
.it-free-value {
    font-size: 48px;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    min-width: 70px;
    text-align: center;
}
.it-free-separator {
    font-size: 48px;
    font-weight: 700;
    color: #666;
    padding-bottom: 24px;
}
.it-free-unit {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

/* フローティングミニタイマーバー */
.it-mini-bar {
    position: fixed;
    bottom: calc(var(--bottom-nav-height, 64px));
    left: 0;
    right: 0;
    height: 70px;
    background: #1a1a1a;
    border-top: 2px solid var(--primary, #dc143c);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    z-index: 999;
    cursor: pointer;
    touch-action: manipulation;
}
.it-mini-time {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}
.it-mini-time.warning {
    color: #ffa500;
}
.it-mini-time.urgent {
    color: #ff4444;
    animation: it-pulse 0.8s ease-in-out infinite;
}
.it-mini-hint {
    font-size: 10px;
    color: #888;
}
/* PC版（サイドバー表示時）: ミニバー非表示（JS側でもスキップ） */
@media (min-width: 1024px) {
    .it-mini-bar {
        display: none !important;
    }
}

/* 注釈（トグル折りたたみ） */
.it-note-details {
    margin: 8px 16px 16px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
}
.it-note-summary {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #aaa;
    cursor: pointer;
    list-style: none;
    touch-action: manipulation;
}
.it-note-summary::-webkit-details-marker {
    display: none;
}
.it-note-summary::after {
    content: ' ▸';
    font-size: 11px;
}
.it-note-details[open] .it-note-summary::after {
    content: ' ▾';
}
.it-note-body {
    padding: 0 12px 12px;
}
.it-note-body p {
    font-size: 12px;
    color: #999;
    margin: 0 0 4px;
    line-height: 1.7;
}
.it-note-body strong {
    color: #ccc;
}

/* アラーム停止オーバーレイ */
#it-alarm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(220, 20, 60, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    animation: it-alarm-flash 0.6s ease-in-out infinite;
    border-radius: 0 0 12px 12px;
}
.it-alarm-icon {
    font-size: 64px;
    margin-bottom: 12px;
}
.it-alarm-text {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}
.it-alarm-hint {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    margin-top: 8px;
}
@keyframes it-alarm-flash {
    0%, 100% { background: rgba(220, 20, 60, 0.9); }
    50% { background: rgba(220, 20, 60, 0.6); }
}

/* interval-timer-panel に position:relative を設定（オーバーレイ基準） */
#interval-timer-panel {
    position: relative;
}

/* ダブルタップズーム防止 */
.it-tab-btn,
.it-exercise-btn,
.it-rpe-btn,
.it-preset-btn,
.it-adjust-btn,
.it-extend-btn,
.it-btn-start,
.it-btn-pause,
.it-btn-resume,
.it-btn-reset {
    touch-action: manipulation;
}
