/* 休憩タイマー Pro - シンプル＆クリーン（ライトテーマ） */

:root {
    --bg-color: #f8fafc;
    /* 背景色（薄いグレー） */
    --card-bg: #ffffff;
    /* カード背景（純白） */
    --primary-color: #10b981;
    /* 休憩中（グリーン） */
    --secondary-color: #ef4444;
    /* 停止中（レッド） */
    --accent-color: #009999;
    /* イッチ指定のアクセントカラー（ターコイズ） */
    --text-main: #1e293b;
    /* メイン文字色（濃いグレー） */
    --text-muted: #64748b;
    /* 補足文字色 */
    --border-color: #e2e8f0;
    /* 境界線の色 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* 上寄せに変更 */
    padding: 2rem 0;
    /* 上下に余白を持たせる */
    /* overflow: hidden; を削除してスクロールを有効化 */
}

.app-container {
    width: 90%;
    max-width: 440px;
}

.timer-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
}

h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-item {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.2s ease;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.stat-unit {
    font-size: 1rem;
    margin-left: 0.25rem;
    color: var(--text-muted);
}

/* リアルタイム経過時間の色 */
#current-timer.active {
    color: var(--accent-color);
}

.controls {
    display: flex;
    gap: 1rem;
}

/* ボタンの基底スタイル */
.btn {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-start {
    background: var(--accent-color);
    color: white;
}

.btn-start:hover:not(:disabled) {
    background: #007a7a;
}

.btn-end {
    background: var(--secondary-color);
    color: white;
}

.btn-end:hover:not(:disabled) {
    background: #dc2626;
}

.btn:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
}

/* プリセットボタン */
.preset-container {
    margin-top: -1rem;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.btn-preset {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0;
    color: var(--text-main);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-preset:hover:not(:disabled) {
    background: #f8fafc;
    border-color: var(--text-muted);
}

.btn-preset.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* ログセクション */
.history-section {
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.log-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
}

.log-item .log-time {
    color: var(--accent-color);
    font-weight: 700;
    margin-bottom: 0.2rem;
    display: block;
}

.log-item .log-details {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
}

.log-item .log-duration {
    color: var(--text-main);
    font-weight: 700;
}

/* 通知時のエフェクト（シンプルに色だけ変更） */
#current-timer.warning {
    color: #f59e0b;
    /* オレンジ */
}

#current-timer.overtime {
    color: var(--secondary-color);
}

footer {
    text-align: center;
    margin-top: 1rem;
}

.history-link {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: underline;
    opacity: 0.8;
}

.history-link:hover {
    color: var(--secondary-color);
}

/* 説明書ボタンのスタイル */
.guide-trigger {
    background: rgba(0, 153, 153, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.guide-trigger:hover {
    background: var(--accent-color);
    color: white;
}

/* モーダルのスタイル（グラスモーフィズム） */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 400px;
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-main);
}

.btn-close {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close:hover {
    background: #e2e8f0;
    color: var(--secondary-color);
}

.modal-body h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    margin-top: 1.2rem;
}

.modal-body ul {
    list-style: none;
}

.modal-body li {
    font-size: 0.875rem;
    color: var(--text-main);
    margin-bottom: 0.4rem;
    position: relative;
    padding-left: 1.2rem;
    line-height: 1.5;
}

.modal-body li::before {
    content: "・";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

/* レスポンシブ調整 */
@media (max-width: 480px) {
    .timer-card {
        padding: 1.5rem 1rem;
    }

    .stat-value {
        font-size: 2.5rem;
    }

    .modal-content {
        padding: 1.5rem;
    }
}