/* ============================================================
   MENOU - 目と脳のコンディショニング
   ダークネイビー基調・オフライン完結（外部CDN不使用）
   ============================================================ */

:root {
    --bg: #0f172a;
    --bg-2: #1e293b;
    --bg-3: #334155;
    --border: #33415588;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-faint: #8290a8; /* 旧#64748bはコントラスト3.75:1でWCAG AA未達だったため5.5:1に引き上げ */
    --accent: #10b981;
    --accent-soft: #34d399;
    --accent-dark: #059669;
    --rose: #f43f5e;
    --blue: #3b82f6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

button {
    font-family: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

/* ---------- ヘッダー ---------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #0f172aee;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(6px);
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-eye { color: var(--accent); font-size: 18px; }
.brand h1 {
    font-size: 18px;
    letter-spacing: 0.2em;
    color: var(--accent);
    font-weight: 700;
}

/* 再生中バッジ */
.np-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--accent-soft);
    background: #10b98122;
    border: 1px solid #10b98155;
    border-radius: 999px;
    padding: 4px 12px;
}
.np-wave {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}

/* ---------- メイン / ビュー切替 ---------- */
#app-main {
    flex: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 16px 16px 24px;
}

.view { display: none; }
.view.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: fadeIn 0.35s ease-out;
}

/* 視差・動きを減らす設定(OSのアクセシビリティ設定)に追従する。
   遠近トレーニングのマーク移動は機能そのものなので対象外 */
@media (prefers-reduced-motion: reduce) {
    .view.active,
    .np-badge, .np-wave,
    .mini-player,
    .promo-card,
    .posture-banner,
    .rest-overlay { animation: none !important; }
    .c-mark-shape { animation: none !important; }
    .mini-eq i, .music-track-eq i { animation: none !important; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.view-head { text-align: center; }
.view-head h2 { font-size: 19px; font-weight: 700; }
.view-head .sub { font-size: 11px; color: var(--accent-soft); margin-top: 4px; }

/* ---------- ホーム ---------- */
.home-hero { text-align: center; padding: 24px 0 8px; }
.home-hero h2 {
    font-size: 24px;
    line-height: 1.4;
    color: var(--accent-soft);
    font-weight: 700;
}
.home-hero p {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.8;
}

.home-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
}
@media (min-width: 560px) {
    .home-grid { grid-template-columns: 1fr 1fr; }
}

.home-card {
    text-align: left;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 14px;
    padding: 18px;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.home-card:active { transform: scale(0.98); }
.home-card:hover { border-color: var(--accent); background: #24334a; }
.card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.card-head h3 {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    color: var(--accent-soft);
    font-weight: 700;
}

/* カード見出しのアイコン（フッターと同じ線画SVGで統一） */
.card-ico {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #10b98118;
    color: var(--accent);
    transition: background 0.2s, transform 0.2s;
}
.card-ico svg { width: 19px; height: 19px; }
.home-card:hover .card-ico { background: #10b98130; }
.home-card:active .card-ico { transform: scale(0.94); }
.card-head .arrow { color: var(--text-faint); transition: transform 0.2s; }
.home-card:hover .arrow { transform: translateX(3px); color: var(--accent); }
.home-card p { font-size: 11px; color: var(--text-dim); line-height: 1.7; }

.ai-note {
    font-size: 10px;
    color: var(--text-faint);
    text-align: center;
    margin-top: 8px;
}

/* 環境光カード */
.light-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 12px;
    padding: 12px 16px;
    animation: fadeIn 0.35s ease-out;
}
.light-card.warn { border-color: #92400e; background: #78350f22; }
.light-icon { font-size: 20px; }
.light-lux { font-size: 11px; color: var(--text-dim); }
.light-lux span { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.light-advice { font-size: 11px; color: var(--text); margin-top: 2px; line-height: 1.6; }
.light-card.warn .light-advice { color: #fbbf24; }

/* 自社プロモ枠（ハウスアド） */
#promo-slot { width: 100%; }
.promo-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 4px;
    animation: fadeIn 0.35s ease-out;
}
.promo-label {
    flex-shrink: 0;
    font-size: 8px;
    font-weight: 700;
    color: var(--text-faint);
    border: 1px solid var(--bg-3);
    border-radius: 4px;
    padding: 1px 4px;
    letter-spacing: 0.1em;
}
.promo-icon { font-size: 20px; flex-shrink: 0; }
.promo-body { flex: 1; min-width: 0; cursor: pointer; }
.promo-title { font-size: 12px; font-weight: 700; color: var(--text); }
.promo-text {
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1.5;
    margin-top: 2px;
}
.promo-cta {
    flex-shrink: 0;
    background: var(--accent-dark);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 7px 14px;
}
.promo-cta:hover { background: var(--accent); }
.promo-close {
    flex-shrink: 0;
    color: var(--text-faint);
    font-size: 12px;
    padding: 4px;
}
.promo-close:hover { color: var(--text); }

/* ---------- その他（情報メニュー） ---------- */
.menu-list {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 14px;
    padding: 14px 16px;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.menu-item:hover { border-color: var(--accent); background: #24334a; }
.menu-item:active { transform: scale(0.99); }
.menu-ico {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #10b98118;
    color: var(--accent);
}
.menu-ico svg { width: 19px; height: 19px; }
.menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.menu-title { font-size: 13px; font-weight: 700; color: var(--text); }
.menu-desc { font-size: 10px; color: var(--text-dim); }
.menu-arrow { flex-shrink: 0; color: var(--text-faint); font-size: 18px; }

.home-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-faint);
}
.home-links button {
    font-size: 11px;
    color: var(--text-dim);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.home-links button:hover { color: var(--accent-soft); }

/* ---------- 利用規約・プライバシーポリシー ---------- */
.legal-panel {
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 14px;
    padding: 20px;
    width: 100%;
    max-width: 560px;
    font-size: 12px;
    line-height: 1.9;
    color: var(--text);
    user-select: text;
    -webkit-user-select: text;
}
.legal-panel h4 {
    color: var(--accent-soft);
    font-size: 12px;
    margin: 16px 0 4px;
}
.legal-panel h4:first-child { margin-top: 0; }
.legal-panel p { margin: 4px 0; color: var(--text-dim); }
.legal-panel ul { margin: 4px 0 4px 18px; color: var(--text-dim); }
.legal-panel li { margin: 2px 0; }
.legal-important {
    color: #fbbf24 !important;
    font-weight: 700;
}
.legal-date {
    margin-top: 18px !important;
    text-align: right;
    font-size: 11px;
    color: var(--text-faint) !important;
}
.about-app {
    text-align: center;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text) !important;
}

/* ---------- キャンバス共通 ---------- */
canvas {
    width: 100%;
    max-width: 640px;
    border-radius: 12px;
    border: 2px solid var(--bg-3);
    display: block;
}
#gabor-canvas { cursor: pointer; background: #7f7f7f; }
#stereo-canvas { background: var(--bg); }

/* ---------- 情報パネル / 手順 ---------- */
.info-panel {
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 14px;
    padding: 16px;
    width: 100%;
    max-width: 520px;
    font-size: 11px;
}
.info-panel h4 { color: var(--accent-soft); font-size: 12px; margin-bottom: 8px; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: flex; align-items: flex-start; gap: 8px; line-height: 1.7; color: var(--text); }
/* 本文は1つのspanにまとめてインラインで流す(直書きだとテキストと
   strongが別々のflexアイテムになり、列状に崩れるため) */
.steps .step-body { flex: 1; min-width: 0; }
.step-num {
    flex-shrink: 0;
    background: var(--accent-dark);
    color: #fff;
    font-weight: 700;
    font-size: 9px;
    border-radius: 5px;
    padding: 2px 7px;
    margin-top: 2px;
}
.step-num.s-rose { background: #e11d48; }
.step-num.s-emerald { background: var(--accent-dark); }
.step-num.s-blue { background: #2563eb; }
.note { color: var(--text-dim); line-height: 1.8; margin-top: 8px; }
.note.center { text-align: center; margin-top: 0; }
.accent { color: var(--accent); }
.hidden { display: none !important; }

/* ---------- ボタン ---------- */
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn {
    padding: 12px 26px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    transition: background 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent-dark); color: #fff; box-shadow: 0 4px 14px #10b98133; }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { background: var(--bg-3); color: var(--text); }
.btn-ghost:hover { background: #475569; }

/* ---------- セグメントボタン ---------- */
.seg-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.seg {
    display: flex;
    gap: 4px;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 999px;
    padding: 4px;
}
.seg-btn {
    padding: 6px 14px;
    font-size: 10px;
    border-radius: 999px;
    color: var(--text-dim);
    transition: background 0.2s, color 0.2s;
}
.seg-btn.active {
    background: var(--accent-dark);
    color: #fff;
    font-weight: 700;
}
/* 選択肢が多いタイマーのプリセットは折り返して並べる */
.seg-wrap { flex-wrap: wrap; justify-content: center; row-gap: 4px; }

/* プリセットの説明（選択に追従して差し替わる） */
.preset-desc {
    margin: 10px 16px 0;
    padding: 8px 12px;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.7;
    color: var(--text-dim);
    text-align: center;
}
.preset-desc b { color: var(--accent-soft); font-weight: 700; }

/* 「こんなときに」の補足（パターンの選び方） */
.use-case { display: block; color: var(--text-dim); opacity: 0.85; }

/* ホームから設定への導線 */
.home-settings-link { margin-top: 12px; }
.home-card.compact { padding: 12px 14px; }
.home-card.compact p { margin-top: 4px; }

/* 設定画面のグループ見出し */
.settings-group h4 { color: var(--text-dim); font-size: 12px; }

/* ---------- 視力チェック（ランドルト環セルフチェック） ---------- */
/* intro/test/result のラッパーにも .view.active と同じ縦flex+gapを適用し、
   内側のパネル・ボタン間に余白が付くようにする */
#acuity-intro,
#acuity-test,
#acuity-result {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.acuity-level {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-soft);
}
/* 実物の視力表と同じく白地に黒のCを表示する */
.acuity-board {
    width: 100%;
    height: 220px;
    background: #fafafa;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#acuity-ring { line-height: 0; }
#acuity-ring svg { display: block; }
.acuity-ask {
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
    margin: 0;
}
.acuity-dpad {
    display: grid;
    grid-template-areas: ". u ." "l . r" ". d .";
    gap: 8px;
    width: 190px;
    margin: 0 auto;
}
.acuity-key {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    color: var(--text);
    font-size: 18px;
}
.acuity-key:active { background: var(--accent-dark); color: #fff; }
.acuity-up { grid-area: u; }
.acuity-left { grid-area: l; }
.acuity-right { grid-area: r; }
.acuity-down { grid-area: d; }
.acuity-result-panel {
    text-align: center;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 18px;
    padding: 22px 16px;
    width: 100%;
    max-width: 520px;
}
.acuity-result-label { font-size: 12px; color: var(--text-dim); }
.acuity-result-val {
    font-size: 56px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.3;
}

/* ---------- 遠近トレーニング ---------- */
#focus-area {
    width: 100%;
    min-height: 340px;
    background: #1e293b80;
    border: 1px solid var(--bg-3);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}
#focus-target-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    will-change: transform, top, left, filter, opacity;
}
.focus-target-shape { width: 30px; height: 30px; }
.circle-shape {
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--accent);
}
/* ランドルト環: 視力検査のCと同じ比率(外径:線幅:切り欠き = 5:1:1)のSVGで描画。
   旧実装(border+conic-gradientマスク)は内側にぼやけた色が残るため廃止 */
.c-mark-shape {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Ccircle cx='15' cy='15' r='12' fill='none' stroke='%2310b981' stroke-width='6' stroke-dasharray='69.4 6' transform='rotate(14.3 15 15)'/%3E%3C/svg%3E") center / contain no-repeat;
    animation: spin-c 3s linear infinite;
}
@keyframes spin-c {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ---------- タイマー ---------- */
.timer-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 20px;
    padding: 28px 24px;
    width: 100%;
    max-width: 520px;
}
.timer-phase {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-soft);
    letter-spacing: 0.15em;
}
.timer-phase.break { color: #fbbf24; }
.timer-time {
    font-size: 64px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    line-height: 1.1;
}
.timer-cycles { font-size: 11px; color: var(--text-dim); }
.timer-toggle { min-width: 160px; margin-top: 8px; }
.btn-stop { background: var(--rose) !important; box-shadow: 0 4px 14px #f43f5e33 !important; }

/* 目休めリマインダー */
.reminder-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.reminder-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1px solid var(--bg-3);
    border-radius: 10px;
    padding: 8px 12px;
}
.reminder-row.off { opacity: 0.5; }
.rem-label { font-size: 11px; color: var(--text-dim); min-width: 2em; }
.reminder-row input[type="time"] {
    flex: 1;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
    color-scheme: dark;
}
.rem-toggle {
    min-width: 44px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    padding: 6px 10px;
    background: var(--bg-3);
    color: var(--text-faint);
}
.rem-toggle.on { background: var(--accent-dark); color: #fff; }
.rem-del { color: var(--text-faint); font-size: 12px; padding: 4px 6px; }
.rem-del:hover { color: var(--rose); }

/* 休憩中の目休めメニュー */
.break-actions {
    width: 100%;
    max-width: 520px;
    background: #10b98112;
    border: 1px solid #10b98155;
    border-radius: 14px;
    padding: 14px;
    animation: fadeIn 0.35s ease-out;
}
.break-actions-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-soft);
    text-align: center;
    margin-bottom: 10px;
}
.break-actions-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
.break-actions-grid button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 10px;
    padding: 10px 4px;
    font-size: 9px;
    color: var(--text-dim);
    transition: border-color 0.2s, background 0.2s;
}
.break-actions-grid button:hover { border-color: var(--accent); }
.break-actions-grid button:active { transform: scale(0.96); }
.ba-icon { font-size: 18px; }

/* 「目を閉じる」オーバーレイ */
.rest-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #060b18;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    cursor: pointer;
    animation: fadeIn 0.5s ease-out;
}
.rest-emoji { font-size: 44px; }
.rest-title { font-size: 15px; color: var(--text-dim); }
.rest-remaining {
    font-size: 56px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #47556966;
}
.rest-hint { font-size: 11px; color: var(--text-faint); margin-top: 20px; }

/* ---------- サウンド ---------- */
.headphone-note {
    font-size: 11px;
    color: #fbbf24;
    background: #78350f33;
    border: 1px solid #92400e66;
    border-radius: 10px;
    padding: 8px 14px;
    text-align: center;
    line-height: 1.6;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 520px;
}
.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--bg-2);
    border: 2px solid var(--bg-3);
    border-radius: 14px;
    padding: 14px 6px;
    transition: border-color 0.2s, background 0.2s;
}
.mode-card.active {
    border-color: var(--accent);
    background: #10b98115;
}
.mode-emoji { font-size: 22px; }
.mode-name { font-size: 11px; font-weight: 700; color: var(--text); }
.mode-desc { font-size: 9px; color: var(--text-dim); text-align: center; line-height: 1.5; }

.player-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 520px;
}
.play-btn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--accent-dark);
    color: #fff;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px #10b98144;
    border: 4px solid var(--bg);
    transition: background 0.2s, transform 0.1s;
}
.play-btn:active { transform: scale(0.94); }
.play-btn.playing { background: var(--rose); box-shadow: 0 6px 20px #f43f5e44; }
.audio-status { font-size: 12px; color: var(--text-dim); letter-spacing: 0.1em; }

.volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 300px;
}
.vol-icon { font-size: 13px; }
input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
    height: 22px;
}

/* 目のケア内の切替（ガボール / 3D / 遠近） */
.eye-switch {
    display: flex;
    gap: 6px;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 999px;
    padding: 4px;
}
.eye-switch button {
    padding: 7px 14px;
    font-size: 11px;
    border-radius: 999px;
    color: var(--text-dim);
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}
.eye-switch button.active {
    background: var(--accent-dark);
    color: #fff;
    font-weight: 700;
}

/* ---------- サウンド画面（シーン選択で楽曲とビートを束ねる） ---------- */
.scene-head { width: 100%; text-align: center; margin-top: 2px; }
.scene-head h3 { font-size: 17px; font-weight: 700; color: var(--text); }
.scene-head .album-desc { margin-top: 5px; }

/* 統合プレイヤー（楽曲が主役。ビートは重ねる） */
.player-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 18px;
    padding: 20px 16px 16px;
}
/* 折りたたみ版のプレイヤー（サウンド画面）。
   楽曲リストを早く見せたいので中身は詰めて配置する */
.player-fold {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 18px;
}
.player-fold > summary { padding: 11px 16px; }
.player-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 14px;
}
/* 再生ボタンと曲名を横並びにして縦幅を稼ぐ */
.player-main {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}
.player-meta { flex: 1; min-width: 0; }
.scene-play {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--accent-dark);
    color: #fff;
    box-shadow: 0 6px 20px #10b98140;
    border: 3px solid var(--bg);
    transition: background 0.2s, transform 0.15s;
}
.scene-play svg { width: 26px; height: 26px; }
.scene-play .ico-pause { display: none; }
.scene-play.is-playing .ico-play { display: none; }
.scene-play.is-playing .ico-pause { display: block; }
.scene-play.is-playing { background: var(--rose); box-shadow: 0 6px 20px #f43f5e40; }
.scene-play:active { transform: scale(0.94); }
@media (hover: hover) { .scene-play:hover { filter: brightness(1.1); } }

.scene-now {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}
.scene-sub { font-size: 10.5px; color: var(--text-faint); }
/* 横並び時は左寄せ。長い曲名は1行に省略する */
.player-meta .scene-now {
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.player-meta .scene-sub { text-align: left; margin-top: 2px; }

/* スライダー行（ラベル + つまみ + 数値） */
.slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.slider-row + .slider-row { margin-top: 10px; }
.slider-label {
    flex-shrink: 0;
    width: 6.5em;
    font-size: 11px;
    color: var(--text-dim);
}
.slider-row input[type="range"] { flex: 1; accent-color: var(--accent); height: 22px; }
.slider-val {
    flex-shrink: 0;
    width: 3em;
    text-align: right;
    font-size: 11px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}
.main-volume {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid #33415566;
}
.main-volume .slider-label { color: var(--text); font-weight: 700; }
.main-volume .slider-val { color: var(--text-dim); }

/* ビート行のラベル内に帯域を小さく添える */
.slider-label { display: flex; flex-direction: column; gap: 1px; }
.slider-note { font-size: 9px; color: var(--text-faint); font-weight: 400; }
.hint-note { margin-top: 10px; }
.player-body .main-volume { margin-top: 2px; padding-top: 10px; }
.player-body .hint-note { margin-top: 6px; }

/* 楽曲 / ビート の各行 */
.sound-row {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 16px;
    overflow: hidden;
}
.row-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
}
.row-ico {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: #10b98120;
    color: var(--accent);
}
.row-ico svg { width: 20px; height: 20px; }
.row-text { flex: 1; min-width: 0; }
.row-text h4 { font-size: 14px; font-weight: 700; color: var(--text); }
.row-status { font-size: 10.5px; color: var(--text-dim); margin-top: 2px; }

/* 各行の再生ボタン */
.row-play {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-dark);
    color: #fff;
    box-shadow: 0 4px 14px #10b98133;
    transition: background 0.2s, transform 0.15s;
}
.row-play svg { width: 18px; height: 18px; }
.row-play:active { transform: scale(0.93); }
@media (hover: hover) { .row-play:hover { background: var(--accent); } }
/* ビート側は再生中に一時停止アイコンへ切り替える */
#audio-toggle .ico-pause { display: none; }
#audio-toggle.is-playing .ico-play { display: none; }
#audio-toggle.is-playing .ico-pause { display: block; }
#audio-toggle.is-playing { background: var(--rose); box-shadow: 0 4px 14px #f43f5e33; }

.row-body {
    padding: 0 14px 16px;
    border-top: 1px solid #33415555;
    padding-top: 14px;
}
.row-body .volume-row { max-width: 320px; margin: 0 auto; }
.row-body .volume-row + .volume-row { margin-top: 8px; }
.row-body .note { margin-top: 10px; }
.list-actions { display: flex; justify-content: flex-end; margin-bottom: 8px; }

/* ---------- （旧）サウンドのセクション ---------- */
.sound-block {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background: #1621359e;
    border: 1px solid var(--bg-3);
    border-radius: 18px;
    padding: 18px 14px;
}
.block-head {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}
.block-ico {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #10b98120;
    color: var(--accent);
}
.block-ico svg { width: 21px; height: 21px; }
.block-text { flex: 1; min-width: 0; }
.block-text h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-soft);
}
.block-text p {
    font-size: 10.5px;
    color: var(--text-dim);
    line-height: 1.6;
    margin-top: 3px;
}
.sound-block .info-panel,
.sound-block .player-fold { margin-top: 0; }

/* ---------- ミュージック画面 ---------- */
.music-page { width: 100%; }

/* カテゴリ（横スクロール） */
.music-cat-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.music-cat-scroll::-webkit-scrollbar { display: none; }
.music-cat {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 60px;
    padding: 11px 6px;
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 14px;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.music-cat:active { transform: scale(0.96); }
.music-cat.active {
    border-color: var(--accent);
    background: #10b98118;
}
.mc-emoji { font-size: 20px; }
.mc-label { font-size: 10px; color: var(--text-dim); }
.music-cat.active .mc-label { color: var(--accent-soft); font-weight: 700; }

/* アルバム見出し */
.album-head { margin-top: 14px; }
.album-head h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.album-desc {
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.7;
    margin-top: 4px;
}
.album-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}
.btn-sm { padding: 9px 18px; font-size: 12px; }

.music-page-volume { max-width: 320px; margin: 18px auto 0; }

.music-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }

/* 配信版アルバムへの導線(リスト末尾) */
.album-link-row {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #33415566;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.album-link-row .note { margin-top: 0; font-size: 11px; }
.music-placeholder {
    font-size: 11px;
    color: var(--text-faint);
    background: var(--bg);
    border: 1px dashed var(--bg-3);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

/* 曲リスト（行全体がボタン） */
.music-track {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: var(--bg-2);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 13px 14px;
    font-size: 13px;
    color: var(--text-dim);
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.music-track:hover { background: #24334a; }
.music-track:active { transform: scale(0.99); }
.music-track.current {
    border-color: var(--accent);
    background: #10b98118;
    color: var(--text);
}
.music-track-no {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}
.music-track.current .music-track-no { display: none; }
.music-track-title { flex: 1; min-width: 0; }
.music-track.current .music-track-title { font-weight: 700; color: var(--accent-soft); }
.music-track-time {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

/* 再生中を示すイコライザー風インジケーター */
.music-track-eq { display: none; gap: 2px; width: 20px; justify-content: center; align-items: flex-end; height: 14px; }
.music-track.current .music-track-eq { display: flex; }
.music-track-eq i {
    width: 3px;
    background: var(--accent);
    border-radius: 1px;
    height: 5px;
}
.music-track.playing .music-track-eq i { animation: eq 0.9s ease-in-out infinite; }
.music-track.playing .music-track-eq i:nth-child(2) { animation-delay: 0.3s; }
.music-track.playing .music-track-eq i:nth-child(3) { animation-delay: 0.6s; }
@keyframes eq {
    0%, 100% { height: 4px; }
    50% { height: 13px; }
}

/* 折りたたみ解説パネル */
.accordion { padding: 0; }
.accordion > summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.accordion > summary::-webkit-details-marker { display: none; }
.accordion > summary::after {
    content: '▾';
    color: var(--text-faint);
    font-size: 11px;
    transition: transform 0.2s;
}
.accordion[open] > summary::after { transform: rotate(180deg); }
.accordion[open] > summary { border-bottom: 1px solid var(--bg-3); }
.accordion-body { padding: 14px 16px 16px; }
.accordion-body h4 { margin-top: 14px; }
.accordion-body h4:first-child { margin-top: 0; }
.note-list {
    margin: 6px 0 0 16px;
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.9;
}
.note-list li { margin: 4px 0; }
.note-list strong { color: var(--text); }

/* 再生中プレイヤー */
.music-now {
    background: var(--bg);
    border: 1px solid var(--accent-dark);
    border-radius: 14px;
    padding: 14px;
    margin-top: 12px;
    animation: fadeIn 0.3s ease-out;
}
.music-now-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.music-now-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.music-mini-btn {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--text-dim);
    background: var(--bg-2);
    border: 1px solid var(--bg-3);
    border-radius: 999px;
    padding: 4px 10px;
}
.music-mini-btn:hover { color: var(--accent-soft); border-color: var(--accent-dark); }

.music-seek {
    width: 100%;
    accent-color: var(--accent);
    height: 20px;
}
.music-time {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
    margin-top: -2px;
}
.music-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 10px 0 4px;
}
.music-ctrl {
    font-size: 18px;
    color: var(--text-dim);
    padding: 6px 10px;
    border-radius: 999px;
    transition: color 0.2s, background 0.2s;
}
.music-ctrl:hover { color: var(--text); }
.music-ctrl:active { transform: scale(0.94); }
.music-ctrl-main {
    background: var(--accent-dark);
    color: #fff;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}
.music-ctrl-main:hover { background: var(--accent); color: #fff; }

/* ---------- 姿勢アシスト ---------- */
.posture-row {
    align-items: center;
    padding-left: 12px;
}
.posture-label { font-size: 10px; color: var(--text-dim); }
.posture-toggle {
    min-width: 44px;
    color: var(--text-faint);
    font-weight: 700;
}
.posture-toggle.on {
    background: var(--accent-dark);
    color: #fff;
}

.posture-banner {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 32px);
    max-width: 480px;
    background: #78350fee;
    border: 1px solid #f59e0b;
    border-radius: 14px;
    padding: 12px 16px;
    box-shadow: 0 8px 24px #00000066;
    animation: fadeIn 0.3s ease-out;
}
.posture-banner-icon { font-size: 22px; }
.posture-banner-title {
    font-size: 13px;
    font-weight: 700;
    color: #fbbf24;
}
.posture-banner-text {
    font-size: 11px;
    color: #fde68a;
    margin-top: 2px;
    line-height: 1.5;
}

/* ---------- 画面下部ドック（ミニプレイヤー + タブバー） ---------- */
.bottom-dock {
    position: sticky;
    bottom: 0;
    z-index: 60;
}

/* ---------- ミニプレイヤー（全画面共通） ---------- */
.mini-player {
    background: #182338f7;
    border-top: 1px solid var(--bg-3);
    backdrop-filter: blur(10px);
    /* transform を伴う fadeIn は使わない
       （残留してタブバーに被るため。位置は動かさず不透明度だけで出す） */
    animation: fadeInFlat 0.25s ease-out;
}
@keyframes fadeInFlat {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.mini-seek-track {
    height: 3px;
    background: var(--bg-3);
    cursor: pointer;
}
.mini-seek-fill {
    height: 100%;
    background: var(--accent);
    width: 0;
    transition: width 0.25s linear;
}
.mini-body {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 14px;
}
.mini-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}
.mini-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mini-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mini-title.is-error { color: #fbbf24; }
.mini-time {
    font-size: 10px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

/* 再生中に動くイコライザー */
.mini-eq { display: flex; gap: 2px; align-items: flex-end; height: 16px; flex-shrink: 0; }
.mini-eq i { width: 3px; height: 5px; background: var(--accent); border-radius: 1px; }
.mini-player.is-playing .mini-eq i { animation: eq 0.9s ease-in-out infinite; }
.mini-player.is-playing .mini-eq i:nth-child(2) { animation-delay: 0.3s; }
.mini-player.is-playing .mini-eq i:nth-child(3) { animation-delay: 0.6s; }

.mini-ctrls { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.mini-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: var(--text-dim);
    border-radius: 999px;
    transition: color 0.18s ease, background 0.18s ease, transform 0.15s ease;
}
.mini-btn svg { width: 19px; height: 19px; }
.mini-btn:active { transform: scale(0.9); }
@media (hover: hover) { .mini-btn:hover { color: var(--text); } }

.mini-btn-main {
    background: var(--accent-dark);
    color: #fff;
    width: 36px;
    height: 36px;
    margin-left: 2px;
}
.mini-btn-main svg { width: 16px; height: 16px; }
@media (hover: hover) { .mini-btn-main:hover { background: var(--accent); color: #fff; } }

/* 再生/一時停止アイコンの出し分け */
.mini-btn-main .ico-pause { display: none; }
.mini-player.is-playing .mini-btn-main .ico-play { display: none; }
.mini-player.is-playing .mini-btn-main .ico-pause { display: block; }

/* 画面内リンク風ボタン */
.link-btn {
    color: var(--accent-soft);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-size: inherit;
}
.xlink { margin-top: 4px; }

/* ---------- ボトムナビ ---------- */
.tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #0f172af2;
    border-top: 1px solid var(--border);
    backdrop-filter: blur(6px);
}
.tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 2px calc(9px + env(safe-area-inset-bottom, 0px));
    color: var(--text-faint);
    transition: color 0.18s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

/* アイコンは線画SVGで統一（currentColorで色が揃う） */
.tab-ico {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 28px;
    border-radius: 999px;
    transition: background 0.22s ease, transform 0.18s ease;
}
.tab-ico svg { width: 21px; height: 21px; }
.tab-label {
    font-size: 10px;
    letter-spacing: 0.02em;
    transition: color 0.18s ease;
}

/* 選択状態: アイコンの背景にピルを敷いて面で示す */
.tab.active { color: var(--accent-soft); }
.tab.active .tab-ico { background: #10b9812e; }
.tab.active .tab-label { font-weight: 700; }
.tab.active .tab-ico svg { stroke-width: 2; }

/* タップフィードバック */
.tab:active .tab-ico { transform: scale(0.9); }
@media (hover: hover) {
    .tab:hover { color: var(--text-dim); }
    .tab.active:hover { color: var(--accent-soft); }
}
.music-now-title.is-error { color: #fbbf24; }
