/* 休憩タイマー 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;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

body {
    font-family: 'BIZ UDGothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* 上寄せに変更 */
    padding: max(1.5rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right)) calc(max(2rem, env(safe-area-inset-bottom)) + 1.5rem) max(0.5rem, env(safe-area-inset-left));
    /* 上下左右の余白およびセーフエリア対応 */
    /* 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: 2rem 1.5rem;
    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: 1.25rem;
}

header {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.header-title-row {
    display: flex;
    justify-content: center;
    align-items: center;
}

h1 {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 0.05em;
    margin: 0;
}

.header-btn-row {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
}

.marquee-wrapper {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    margin: 0.2rem 0;
}

.sub-marquee-track {
    display: inline-block;
    padding-left: 100%;
    animation: marquee-scroll 22s linear infinite;
    will-change: transform;
}

.sub-marquee-track:hover,
.sub-marquee-track:active {
    animation-play-state: paused;
}

.sub-marquee-track span {
    font-size: 0.9rem;
    color: var(--text-muted);
    opacity: 0.85;
    font-weight: 500;
}

@keyframes marquee-scroll {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

.subtitle {
    font-size: 1.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

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

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

#last-action {
    font-size: 1.45rem;
}

.stat-value {
    font-size: 3.5rem;
    font-weight: 800;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
}

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

/* 時計の秒・時刻部分 */
.clock-time {
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

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

/* 時間設定ボックス・入力UI */
.timer-setting-item {
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.timer-setting-item.editable {
    cursor: pointer;
}

.timer-setting-item.editable:hover {
    background: #e2e8f0;
}

.timer-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
}

.input-custom-minutes {
    width: 76px;
    padding: 0.2rem 0.4rem;
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    background: white;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
}

.btn-confirm-minutes {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-confirm-minutes:hover {
    opacity: 0.9;
}

.controls {
    display: flex;
    gap: 1rem;
    margin-top: 0.65rem;
}

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

.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: 0.85rem;
}

.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.75rem 0;
    color: var(--text-main);
    font-size: 1.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.btn-preset.active {
    background: #f59e0b;
    /* オレンジ */
    color: #1e293b;
    /* 白から濃いグレー(black系)へ変更 */
    border-color: #f59e0b;
}

/* ログセクション */
.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.85rem 1.1rem;
    font-size: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-item .log-time-range {
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.35rem;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.log-item .log-preset-badge {
    font-size: 1.05rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
}

/* 日付選択コンテナ */
.date-select-container {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.history-date-input {
    width: 100%;
    max-width: 240px;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.25rem;
    font-family: inherit;
    color: var(--text-main);
    background: white;
    text-align: center;
}

.empty-log {
    text-align: center;
    color: var(--text-main);
    opacity: 0.8;
    font-size: 1.45rem;
    font-weight: 600;
    padding: 2rem 0;
}

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

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

.edit-log-badge {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
}

body.dark-mode .edit-log-badge {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

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

.btn-reset-large {
    width: 100%;
    margin-top: 1rem;
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 1.1rem;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset-large:hover {
    background: #ef4444;
    color: white;
}

/* 説明書ボタンのスタイル */
.guide-trigger {
    background: rgba(0, 153, 153, 0.1);
    border: 1.5px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.5rem 0.85rem;
    border-radius: 24px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.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;
}

.warning-modal-content {
    border: 3px solid #ef4444;
    box-shadow: 0 20px 25px -5px rgba(239, 68, 68, 0.25), 0 10px 10px -5px rgba(239, 68, 68, 0.1);
}

.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;
}

.credits {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem 0.2rem 1rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}

.credits:active {
    opacity: 1;
    transform: scale(0.98);
}

.version-label {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.5;
    margin-top: 0.1rem;
    padding-bottom: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* ダークモード設定 */
body.dark-mode {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    color-scheme: dark;
}

body.dark-mode .timer-setting-item.editable:hover {
    background: #1e293b;
}

body.dark-mode .input-custom-minutes {
    background: #0f172a;
    color: #f8fafc;
    border-color: var(--accent-color);
}

body.dark-mode .stat-item,
body.dark-mode .date-select-container {
    background: #0f172a;
}

body.dark-mode .btn-preset {
    background: #1e293b;
    color: #f8fafc;
    border-color: #334155;
}

body.dark-mode .btn-preset:hover:not(:disabled) {
    background: #334155;
}

body.dark-mode .btn-preset.active {
    background: #f59e0b;
    color: #1e293b;
    border-color: #f59e0b;
}

body.dark-mode .log-item {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .log-item .log-time-range {
    color: #f8fafc;
}

body.dark-mode .log-item .log-preset-badge {
    background: #334155;
    color: #94a3b8;
}

body.dark-mode .history-date-input {
    background: #0f172a;
    color: #f8fafc;
    border-color: #334155;
    color-scheme: dark;
}

body.dark-mode .btn-reset-large {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

/* 通知テストボタン */
.btn-test-notification {
    width: 100%;
    border: 2px solid var(--accent-color);
    padding: 0.9rem 1rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    background: rgba(0, 153, 153, 0.08);
    color: var(--accent-color);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-test-notification:hover {
    background: var(--accent-color);
    color: white;
}

body.dark-mode .btn-test-notification {
    background: #0f172a;
    border-color: var(--accent-color);
    color: #38bdf8;
}

body.dark-mode .btn-test-notification:hover {
    background: var(--accent-color);
    color: white;
}

body.dark-mode .btn-close {
    background: #334155;
    color: #94a3b8;
}

body.dark-mode .btn-close:hover {
    background: #475569;
    color: #ef4444;
}

/* 当日履歴のタップ操作可能スタイル */
.log-item.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.log-item.clickable:hover {
    background: #f1f5f9;
    border-color: var(--accent-color);
}

body.dark-mode .log-item.clickable:hover {
    background: #1e293b;
    border-color: var(--accent-color);
}

/* 履歴削除ボタン群 */
.history-action-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.btn-delete-action {
    flex: 1;
    background: white;
    border: 1px solid #fecaca;
    color: #ef4444;
    border-radius: 8px;
    padding: 0.65rem 0.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-delete-action:hover {
    background: #fee2e2;
}

.btn-delete-all {
    background: #fee2e2;
    border-color: #f87171;
}

.btn-delete-all:hover {
    background: #ef4444;
    color: white;
}

body.dark-mode .btn-delete-action {
    background: #1e293b;
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

body.dark-mode .btn-delete-action:hover {
    background: rgba(239, 68, 68, 0.2);
}

body.dark-mode .btn-delete-all {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

/* 削除操作ログ（監査ログ） */
.audit-section {
    margin-top: 1.25rem;
    border-top: 1px dashed var(--border-color);
    padding-top: 1rem;
}

.audit-log-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 140px;
    overflow-y: auto;
}

.audit-log-item {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    line-height: 1.4;
}

body.dark-mode .audit-log-item {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}

/* 反省書回避成功！祝賀オーバーレイ */
.avoid-overlay {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(10px);
}

.avoid-modal-content {
    border: 4px solid #10b981;
    box-shadow: 0 25px 50px -12px rgba(16, 185, 129, 0.4);
    animation: avoid-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.avoid-banner {
    font-size: clamp(1.35rem, 5.5vw, 1.75rem);
    font-weight: 900;
    color: #10b981;
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

@keyframes avoid-pop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* タイトル長押し対応 */
#app-title {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

#app-title:active {
    transform: scale(0.97);
    opacity: 0.85;
}

.pro-badge {
    display: inline-block;
    font-size: 0.62em;
    font-weight: 800;
    color: #e11d48;
    border: 1.5px solid #e11d48;
    border-radius: 4px;
    padding: 0.05em 0.35em;
    margin-left: 0.35rem;
    vertical-align: 0.15em;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

body.dark-mode .pro-badge {
    color: #f43f5e;
    border-color: #f43f5e;
}

/* 開発者・チェックモード用スタイル */
.dev-password-input {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1.3rem;
    text-align: center;
    letter-spacing: 0.2em;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-main);
    box-sizing: border-box;
    outline: none;
}

.dev-password-input:focus {
    border-color: var(--primary-color);
}

.dev-menu-content {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.dev-menu-body {
    overflow-y: auto;
    padding-right: 0.3rem;
}

.dev-section {
    margin-bottom: 1.2rem;
    text-align: left;
}

.dev-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text-main);
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.3rem;
}

.dev-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

@media (max-width: 400px) {
    .dev-btn-grid {
        grid-template-columns: 1fr;
    }
}

.dev-btn {
    padding: 0.7rem 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-main);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.dev-btn:active {
    transform: scale(0.97);
}

body.dark-mode .dev-btn {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.dev-btn-green {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

body.dark-mode .dev-btn-green {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: #059669;
}

.dev-btn-yellow {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

body.dark-mode .dev-btn-yellow {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: #d97706;
}

.dev-btn-blue {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

body.dark-mode .dev-btn-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: #2563eb;
}

.dev-btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
    font-size: 1.05rem;
    padding: 0.85rem;
}

body.dark-mode .dev-btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: #dc2626;
}

/* Android手順用ボタン */
.btn-android-trigger {
    background: #ecfdf5;
    color: #065f46;
    border: 2px solid #10b981;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.75rem 1.2rem;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-android-trigger:active {
    transform: scale(0.97);
}

body.dark-mode .btn-android-trigger {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: #059669;
}

/* モーダル on モーダル（上位レイヤー） */
.modal-on-modal {
    z-index: 1100 !important;
}

/* 老眼ボタンと老眼モード */
.btn-rougan {
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
}

.btn-rougan:active {
    transform: scale(0.96);
}

.btn-rougan.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

body.dark-mode .btn-rougan {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .btn-rougan.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #3b82f6;
}

/* 老眼モード有効時：説明書・Android手順の文字を特大化 */
.rougan-mode .modal-body,
.rougan-mode .modal-body p,
.rougan-mode .modal-body li,
.rougan-mode .modal-body ol,
.rougan-mode .modal-body ul {
    font-size: 1.25rem !important;
    line-height: 1.8 !important;
}

.rougan-mode .modal-body h3 {
    font-size: 1.5rem !important;
    margin-bottom: 0.8rem !important;
}

.rougan-mode .modal-body strong {
    font-size: 1.25rem !important;
}

.rougan-mode .modal-body small {
    font-size: 1.05rem !important;
    line-height: 1.6 !important;
}

.rougan-mode .btn-android-trigger,
.rougan-mode .btn-test-notification {
    font-size: 1.15rem !important;
    padding: 0.85rem 1.4rem !important;
}

/* 開発秘話アコーディオン */
.dev-story-container {
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.dev-story-summary {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    letter-spacing: 0.05em;
    list-style: none; /* デフォルトの三角マーカーを非表示 */
}

.dev-story-summary::-webkit-details-marker {
    display: none;
}

.dev-story-summary:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.dev-story-details[open] .dev-story-summary {
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 0.8rem;
}

.dev-story-content {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.2rem;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-main);
    animation: story-fade 0.3s ease;
}

body.dark-mode .dev-story-content {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.dev-story-content p {
    margin-bottom: 1rem;
}

.dev-story-content p:last-of-type {
    margin-bottom: 0;
}

.dev-story-author {
    text-align: right;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 1rem;
    font-size: 1.05rem;
}

@keyframes story-fade {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 老眼モード時も拡大 */
.rougan-mode .dev-story-summary {
    font-size: 1.1rem !important;
}

.rougan-mode .dev-story-content {
    font-size: 1.25rem !important;
    line-height: 1.9 !important;
}

.rougan-mode .dev-story-author {
    font-size: 1.35rem !important;
}

/* レスポンシブ調整（スマートフォン・細長いアスペクト比対応） */
@media (max-width: 480px) {
    .app-container {
        width: 94%;
    }

    .timer-card {
        padding: 1.25rem 0.9rem;
        gap: 1rem;
        border-radius: 16px;
    }

    h1 {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 1.35rem;
    }

    .stats-grid {
        gap: 0.6rem;
    }

    .stat-item {
        padding: 1rem 0.4rem;
    }

    .stat-label {
        font-size: 1rem;
    }

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

    .stat-unit {
        font-size: 1.15rem;
    }

    .btn {
        font-size: 1.35rem;
        padding: 0.75rem 0.4rem;
        border-radius: 10px;
    }

    .btn-preset {
        font-size: 1.25rem;
        padding: 0.6rem 0;
    }

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

/* 画面幅400px以下（スリム・縦長スマホ向け最適化） */
@media (max-width: 400px) {
    .app-container {
        width: 96%;
    }

    .timer-card {
        padding: 1.1rem 0.75rem;
        gap: 0.85rem;
    }

    h1 {
        font-size: 1.45rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .header-btn-row {
        gap: 0.4rem;
    }

    .guide-trigger {
        font-size: 0.9rem;
        padding: 0.4rem 0.65rem;
    }

    .stat-item {
        padding: 0.85rem 0.3rem;
    }

    .stat-label {
        font-size: 0.9rem;
    }

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

    .stat-unit {
        font-size: 1rem;
    }

    .controls {
        gap: 0.75rem;
        margin-top: 0.55rem;
    }

    .btn {
        font-size: 1.15rem;
        padding: 0.7rem 0.3rem;
        gap: 0.35rem;
    }

    .preset-container {
        margin-top: 0.65rem;
    }

    .preset-grid {
        gap: 0.35rem;
    }

    .btn-preset {
        font-size: 1.1rem;
        padding: 0.55rem 0;
    }

    .log-item {
        padding: 0.65rem 0.8rem;
        font-size: 1rem;
    }

    .log-item .log-time-range {
        font-size: 1.1rem;
    }

    .input-custom-minutes {
        width: 68px;
        font-size: 1.3rem;
        padding: 0.15rem 0.3rem;
    }
}

/* 画面幅360px以下（超極細・超小型端末向け） */
@media (max-width: 360px) {
    .app-container {
        width: calc(100% - 0.5rem);
    }

    .timer-card {
        padding: 1rem 0.5rem;
    }

    h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

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

    .stat-unit {
        font-size: 0.95rem;
    }

    .controls {
        gap: 0.65rem;
        margin-top: 0.5rem;
    }

    .btn {
        font-size: 1.05rem;
        padding: 0.65rem 0.2rem;
    }

    .btn-preset {
        font-size: 0.98rem;
        padding: 0.5rem 0;
    }
}

/* 横画面・低背ビューポート対応 */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 0.5rem 0;
    }

    .timer-card {
        padding: 1rem 1rem;
        gap: 0.75rem;
    }
}

/* ============================================================
   ライジングPWAインストール誘導バナー（下からヌルっと出現）
   ============================================================ */
.pwa-rising-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 22px 22px 0 0;
    border-top: 1.5px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.15);
    padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px)) 1.25rem;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-sizing: border-box;

    /* 下からヌルっと上がってくるアニメーション */
    transform: translateY(110%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.pwa-rising-banner.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ダークモード対応 */
body.dark-mode .pwa-rising-banner {
    background: rgba(30, 41, 59, 0.98);
    border-color: #334155;
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.4);
}

.pwa-banner-close {
    position: absolute;
    top: 0.75rem;
    right: 0.85rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
}

.pwa-banner-close:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .pwa-banner-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding-right: 1.5rem;
}

.pwa-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}

.pwa-banner-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.pwa-banner-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.pwa-banner-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.pwa-banner-action {
    display: flex;
    gap: 0.6rem;
    width: 100%;
}

.pwa-btn-primary {
    flex: 1;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 153, 153, 0.25);
    white-space: nowrap;
}

.pwa-btn-primary:active {
    transform: scale(0.97);
}

.pwa-btn-secondary {
    background: #f1f5f9;
    color: var(--text-muted);
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

body.dark-mode .pwa-btn-secondary {
    background: #334155;
    color: #cbd5e1;
}

.pwa-btn-secondary:active {
    transform: scale(0.97);
}

/* iOS用手順スタイル（バージョン別ステップ表示対応） */
.pwa-ios-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.pwa-ios-instructions {
    background: rgba(0, 153, 153, 0.08);
    border: 1.5px solid rgba(0, 153, 153, 0.35);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    color: var(--text-main);
    width: 100%;
    box-sizing: border-box;
}

body.dark-mode .pwa-ios-instructions {
    background: rgba(0, 153, 153, 0.15);
    border-color: rgba(0, 153, 153, 0.5);
}

.pwa-ios-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.pwa-ios-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.pwa-ios-steps li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.35;
    font-size: 0.85rem;
}

.pwa-ios-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--border-color);
    line-height: 1.35;
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.ios-share-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    background: #007aff;
    color: white;
    padding: 3px 6px;
    border-radius: 6px;
    margin: 0 2px;
}

/* 下向き誘導アイコン */
.ios-pointer-hint {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: #007aff;
    animation: bounce-down 1.2s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

@keyframes bounce-down {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}