/* ===================================================
   SCRIPT STUDIO — main.css  リデザイン版
   コンセプト：カラフル付箋ノート
   ライト背景 / 丸ゴシック / ポップ＆フレンドリー
=================================================== */

:root {
    /* ---- テーマ A（ソフトライト）がデフォルト ---- */
    --val: 50%; /* スライダー塗り位置（JS の updateRangeStyle で上書き） */
    --bg: #fff;
    --bg-surface: #fff;

    --primary: #5b4eff;
    --primary-lt: #7b6fff;
    --primary-dim: rgba(91, 78, 255, 0.2);
    --primary-faint: rgba(91, 78, 255, 0.08);

    --coral: #ff3d6e;
    --mint: #00d4a0;
    --yellow: #ffcc00;
    --peach: #ff7a3d;

    --text: #1a1833;
    --text-sub: #5c5880;
    --muted: #a09cc0;
    --border: #ece8ff;
    --border-md: #d0caff;

    --stage-col: #9490b4;

    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --shadow-sm: 0 2px 10px rgba(91, 78, 255, 0.10);
    --shadow-md: 0 6px 24px rgba(91, 78, 255, 0.16);

    --tap-min: 44px;
    --header-h: 52px;
    --bnav-h: 64px;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);

    /* フォント（テーマごとに上書き） */
    --font-body: 'Noto Sans JP', 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', sans-serif;

    /* キャラカラー：より鮮やかに */
    --char0: #ff3d6e;
    --char1: #5b4eff;
    --char2: #00d4a0;
    --char3: #ffaa00;
    --char4: #ff7a3d;
    --char5: #9b59ff;
    --char6: #00bfff;
    --char7: #ff4db8;
}


/* =====================
   テーマ A：ソフトライト（温かみのある生成り紙）
===================== */
[data-theme="a"] {
    --bg: #faf8f5;
    --bg-surface: #ffffff;
    --primary: #e07b54;
    --primary-lt: #f09070;
    --primary-dim: rgba(224, 123, 84, 0.18);
    --primary-faint: rgba(224, 123, 84, 0.07);
    --coral: #e07b54;
    --text: #2c2420;
    --text-sub: #7a6a60;
    --muted: #b8a898;
    --border: #ede8e2;
    --border-md: #d8cfc6;
    --stage-col: #a89888;
    --font-body: 'Noto Sans JP', 'Hiragino Sans', sans-serif;
    --char0: #e07b54;
    --char1: #5b8dee;
    --char2: #3db88a;
    --char3: #e6a817;
    --char4: #c06080;
    --char5: #8b6fcb;
    --char6: #2ab8d0;
    --char7: #d46060;
}

[data-theme="a"] .logo-text {
    color: var(--primary);
}

[data-theme="a"] .logo-text em {
    color: #c06080;
}

[data-theme="a"] .btn-start {
    background: linear-gradient(135deg, #e07b54, #f09070);
    box-shadow: 0 4px 20px rgba(224, 123, 84, 0.35);
}

[data-theme="a"] .bnav-play-ring {
    background: linear-gradient(135deg, #e07b54, #f09070);
    box-shadow: 0 4px 16px rgba(224, 123, 84, 0.42);
}

[data-theme="a"] .bnav-btn--play.playing .bnav-play-ring {
    background: linear-gradient(135deg, #c06080, #d04070);
}

[data-theme="a"] .range-input {
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--val, 50%), var(--border) var(--val, 50%), var(--border) 100%);
}

[data-theme="a"] .range-input::-webkit-slider-thumb {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(224, 123, 84, 0.4), 0 0 0 3px #fff;
}

[data-theme="a"] .range-input::-moz-range-thumb {
    background: var(--primary);
}

[data-theme="a"] .voice-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23e07b54' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}


/* =====================
   テーマ B：ポップ — 大胆なカラーで差別化
===================== */

/* 背景：白＋大きな装飾グラデ円 */
[data-theme="b"] body {
    background: radial-gradient(circle 500px at -10% -10%, rgba(255, 61, 110, 0.18) 0%, transparent 60%),
    radial-gradient(circle 400px at 110% 5%, rgba(255, 204, 0, 0.20) 0%, transparent 55%),
    radial-gradient(circle 450px at 60% 110%, rgba(0, 212, 160, 0.15) 0%, transparent 55%),
    #ffffff;
}

/* ヘッダー：ホットピンク→エレクトリックイエロー */
[data-theme="b"] .site-header {
    background: linear-gradient(100deg, #ff3d6e 0%, #ff7a3d 45%, #ffcc00 100%);
    border-bottom: none;
    box-shadow: 0 4px 24px rgba(255, 61, 110, 0.30);
}

[data-theme="b"] .logo-text {
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

[data-theme="b"] .logo-text em {
    color: #fff;
}

[data-theme="b"] .btn-back {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

[data-theme="b"] .btn-back:active {
    background: rgba(255, 255, 255, 0.4);
}

/* 入力画面タイトル */
[data-theme="b"] .input-title span {
    color: #ff3d6e;
}

[data-theme="b"] .field-label {
    color: #5b4eff;
}

/* アップロードゾーン */
[data-theme="b"] .upload-zone {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(91, 78, 255, 0.35);
    border-style: dashed;
}

/* スタートボタン：コーラル→オレンジ */
[data-theme="b"] .btn-start {
    background: linear-gradient(135deg, #ff3d6e 0%, #ff7a3d 60%, #ffcc00 100%);
    box-shadow: 0 6px 28px rgba(255, 61, 110, 0.42);
}

[data-theme="b"] .btn-start:active {
    box-shadow: 0 2px 12px rgba(255, 61, 110, 0.25);
}

/* テキストエリア */
[data-theme="b"] .script-textarea {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--border-md);
}

/* セリフカード：左ボーダーを太く、白背景に強い影 */
[data-theme="b"] .line-dialogue {
    background: #fff;
    border-left-width: 6px;
    box-shadow: 0 3px 14px rgba(91, 78, 255, 0.12);
}

[data-theme="b"] .line-dialogue.playing {
    box-shadow: 0 0 0 2.5px #5b4eff, 0 6px 24px rgba(91, 78, 255, 0.20);
}

/* アクションボタン：より鮮やかに */
[data-theme="b"] .btn-hint {
    background: #fff7cc;
    border-color: #ffcc00;
    color: #7a5800;
}

[data-theme="b"] .btn-reveal {
    background: #d0fff4;
    border-color: #00d4a0;
    color: #006b50;
}

[data-theme="b"] .btn-hide-again {
    background: #ffe0e8;
    border-color: #ff3d6e;
    color: #9b0030;
}

/* ボトムナビ */
[data-theme="b"] .bottom-nav {
    background: #fff;
    border-top-color: #ece8ff;
    box-shadow: 0 -4px 20px rgba(91, 78, 255, 0.10);
}

/* 読み上げボタン：コーラル */
[data-theme="b"] .bnav-play-ring {
    background: linear-gradient(135deg, #ff3d6e, #ff7a3d);
    box-shadow: 0 4px 18px rgba(255, 61, 110, 0.48);
}

[data-theme="b"] .bnav-btn--play {
    color: #ff3d6e;
}

[data-theme="b"] .bnav-btn--play .bnav-icon {
    color: #fff;
}

[data-theme="b"] .bnav-btn--play.playing .bnav-play-ring {
    background: linear-gradient(135deg, #5b4eff, #9b59ff);
    box-shadow: 0 4px 18px rgba(91, 78, 255, 0.48);
}

[data-theme="b"] .bnav-btn--play.playing {
    color: #5b4eff;
}

/* ボトムシート */
[data-theme="b"] .sheet-backdrop {
    background: rgba(26, 24, 51, 0.35);
}

[data-theme="b"] .bottom-sheet {
    background: #fff;
}

/* スライダー */
[data-theme="b"] .range-input {
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--val, 50%), var(--border) var(--val, 50%), var(--border) 100%);
}

[data-theme="b"] .range-input::-webkit-slider-thumb {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(91, 78, 255, 0.4), 0 0 0 3px #fff;
}

[data-theme="b"] .range-input::-moz-range-thumb {
    background: var(--primary);
    border-color: #fff;
}

/* 音声選択 */
[data-theme="b"] .voice-select {
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235b4eff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* 場面見出し、演出メモ、場面区切り線 */
[data-theme="b"] .line-heading {
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

[data-theme="b"] .line-memo {
    border-left-color: rgba(255, 255, 255, 0.4);
}

[data-theme="b"] .line-divider {
    border-top-color: rgba(255, 255, 255, 0.2);
}

/* テーマプレビュー */
.theme-preview--b {
    background: linear-gradient(135deg, #ff3d6e 0%, #ff7a3d 50%, #ffcc00 100%);
    border: none;
}

.theme-preview--b .theme-preview-bar {
    background: #fff;
}

.theme-preview--b .theme-preview-line {
    background: rgba(255, 255, 255, 0.4);
}


/* =====================
   テーマ C：ダークパステル（夜の稽古場）
===================== */
[data-theme="c"] {
    --bg: #1e1e2e;
    --bg-surface: #28283e;
    --primary: #cba6f7;
    --primary-lt: #d8bcff;
    --primary-dim: rgba(203, 166, 247, 0.2);
    --primary-faint: rgba(203, 166, 247, 0.08);
    --coral: #fab387;
    --text: #cdd6f4;
    --text-sub: #a6adc8;
    --muted: #6c7086;
    --border: #383850;
    --border-md: #494960;
    --stage-col: #7c7c9a;
    --font-body: 'Noto Serif JP', 'Hiragino Mincho ProN', serif;
    --char0: #f38ba8;
    --char1: #cba6f7;
    --char2: #a6e3a1;
    --char3: #f9e2af;
    --char4: #fab387;
    --char5: #89b4fa;
    --char6: #89dceb;
    --char7: #f5c2e7;
}

[data-theme="c"] .site-header {
    background: rgba(28, 28, 44, 0.95);
}

[data-theme="c"] .logo-text {
    color: var(--primary);
}

[data-theme="c"] .logo-text em {
    color: var(--coral);
}

[data-theme="c"] .btn-back {
    background: rgba(203, 166, 247, 0.08);
    border-color: rgba(203, 166, 247, 0.2);
    color: var(--primary);
}

[data-theme="c"] .btn-start {
    background: linear-gradient(135deg, #cba6f7, #d8bcff);
    box-shadow: 0 4px 20px rgba(203, 166, 247, 0.3);
    color: #1e1e2e;
}

[data-theme="c"] .btn-start:active {
    box-shadow: 0 2px 10px rgba(203, 166, 247, 0.2);
}

[data-theme="c"] .line-dialogue {
    background: var(--bg-surface);
}

[data-theme="c"] .bnav-play-ring {
    background: linear-gradient(135deg, #cba6f7, #89b4fa);
    box-shadow: 0 4px 16px rgba(203, 166, 247, 0.35);
}

[data-theme="c"] .bnav-play-ring .bnav-icon {
    color: #1e1e2e;
}

[data-theme="c"] .bnav-btn--play {
    color: var(--primary);
}

[data-theme="c"] .bnav-btn--play.playing .bnav-play-ring {
    background: linear-gradient(135deg, #f38ba8, #e06080);
    box-shadow: 0 4px 16px rgba(243, 139, 168, 0.35);
}

[data-theme="c"] .bnav-btn--play.playing .bnav-icon {
    color: #fff;
}

[data-theme="c"] .bottom-nav {
    background: rgba(28, 28, 44, 0.98);
}

[data-theme="c"] .bottom-sheet {
    background: #24243a;
}

[data-theme="c"] .sheet-close {
    background: var(--bg);
}

[data-theme="c"] .char-btn {
    background: var(--bg-surface);
}

[data-theme="c"] .char-btn.hidden-char {
    background: var(--bg);
}

[data-theme="c"] .script-textarea {
    background: #24243a;
    color: var(--text);
}

[data-theme="c"] .upload-zone {
    background: #24243a;
}

[data-theme="c"] .btn-hint {
    background: rgba(249, 226, 175, 0.1);
    border-color: rgba(249, 226, 175, 0.3);
    color: #f9e2af;
}

[data-theme="c"] .btn-reveal {
    background: rgba(166, 227, 161, 0.1);
    border-color: rgba(166, 227, 161, 0.3);
    color: #a6e3a1;
}

[data-theme="c"] .btn-hide-again {
    background: rgba(243, 139, 168, 0.1);
    border-color: rgba(243, 139, 168, 0.3);
    color: #f38ba8;
}

[data-theme="c"] .btn-tts {
    background: var(--bg);
    border-color: var(--border-md);
    color: var(--muted);
}

[data-theme="c"] .btn-sample {
    color: var(--muted);
}

[data-theme="c"] .voice-note {
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="c"] .range-input {
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--val, 50%), var(--border) var(--val, 50%), var(--border) 100%);
}

[data-theme="c"] .range-input::-webkit-slider-thumb {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(203, 166, 247, 0.4), 0 0 0 3px #1e1e2e;
}

[data-theme="c"] .range-input::-moz-range-thumb {
    background: var(--primary);
    border-color: #1e1e2e;
}

[data-theme="c"] .voice-select {
    background-color: #24243a;
    border-color: var(--border-md);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23cba6f7' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

[data-theme="c"] .voice-select option {
    background: #28283e;
    color: var(--text);
}

[data-theme="c"] .toast {
    background: #cdd6f4;
    color: #1e1e2e;
}

[data-theme="c"] .sheet-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="c"] .line-heading {
    border-bottom-color: rgba(203, 166, 247, 0.3);
}

[data-theme="c"] .btn-bookmark.active {
    background: rgba(250, 204, 21, 0.12);
    border-color: rgba(250, 204, 21, 0.4);
    color: #facc15;
}

/* ---- リセット ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body), serif;
    min-height: 100vh; /* 古いブラウザ向け（フォールバック） */
    min-height: 100dvh; /* モダンブラウザ向け（上書き） */
    overflow-x: hidden;
    -webkit-tap-highlight-color: var(--primary-dim);
    /* フォントレンダリング改善（全テーマ共通） */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.noise-overlay {
    display: none;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-md);
    border-radius: 4px;
}

/* =====================
   ヘッダー
===================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: calc(var(--header-h) + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--bg-surface);
    border-bottom: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 22px;
}

.logo-text {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--primary);
}

.logo-text em {
    font-style: normal;
    color: var(--coral);
}

.btn-back {
    min-height: var(--tap-min);
    padding: 0 16px;
    background: var(--primary-faint);
    border: 2px solid var(--primary-dim);
    color: var(--primary);
    border-radius: 20px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
}

.btn-back:active {
    background: var(--primary-dim);
    transform: scale(0.96);
}

/* =====================
   ビュー切り替え
===================== */
.view {
    display: none;
    position: relative;
    z-index: 1;
}

.view.active {
    display: block;
}

.view--practice {
    display: none;
}

.view--practice.active {
    display: flex;
    flex-direction: column;
}

/* =====================
   入力画面
===================== */
.view--input {
    min-height: 100dvh;
    padding-top: calc(var(--header-h) + var(--safe-top));
    padding-bottom: calc(24px + var(--safe-bottom));
}

.input-wrap {
    display: flex;
    flex-direction: column;
    padding: 28px 20px 40px;
    max-width: 600px;
    margin: 0 auto;
}

.input-hero {
    text-align: center;
    margin-bottom: 28px;
}

.input-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 10px;
}

.input-subtitle {
    color: var(--text-sub);
    font-size: 14px;
    line-height: 1.8;
    font-weight: 500;
}

/* アップロードゾーン */
.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 2.5px dashed var(--border-md);
    border-radius: var(--radius);
    padding: 24px 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: var(--bg-surface);
    transition: border-color 0.2s, background 0.2s, transform 0.12s;
    margin-bottom: 4px;
}

.upload-zone:active, .upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-faint);
    transform: scale(0.99);
}

.file-input-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.upload-icon {
    font-size: 30px;
}

.upload-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.upload-sub {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
}

/* OR 区切り */
.or-divider {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin: 18px 0;
    position: relative;
}

.or-divider::before, .or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 24px);
    height: 1.5px;
    background: var(--border);
    border-radius: 1px;
}

.or-divider::before {
    left: 0;
}

.or-divider::after {
    right: 0;
}

/* テキストエリア */
.textarea-wrap {
    margin-bottom: 14px;
}

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 8px;
}

.script-textarea {
    width: 100%;
    min-height: 200px;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.85;
    padding: 14px 16px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

@supports (-webkit-touch-callout: none) {
    .script-textarea {
        font-size: 16px;
    }
}

.script-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}

.script-textarea::placeholder {
    color: var(--muted);
    font-size: 13px;
}

/* 書式ガイド */
/* 入力画面のガイドリンク */
.guide-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--primary-faint);
    border: 2px solid var(--primary-dim);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 20px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}

.guide-link:hover {
    background: var(--primary-dim);
}


/* スタートボタン */
.btn-start {
    width: 100%;
    min-height: 54px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lt) 100%);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.04em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.38);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s, box-shadow 0.12s;
    margin-bottom: 14px;
}

.btn-start:active:not(:disabled) {
    transform: scale(0.97);
    box-shadow: 0 2px 10px rgba(108, 99, 255, 0.25);
}

.btn-start:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-arrow {
    font-size: 20px;
}

.btn-sample {
    align-self: center;
    background: transparent;
    border: 2px solid var(--border-md);
    color: var(--text-sub);
    padding: 10px 24px;
    min-height: var(--tap-min);
    border-radius: 24px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s, color 0.15s;
}

.btn-sample:active {
    color: var(--primary);
    border-color: var(--primary);
}

/* =====================
   稽古画面
===================== */
.view--practice {
    height: 100dvh;
    padding-top: calc(var(--header-h) + var(--safe-top));
    padding-bottom: calc(var(--bnav-h) + var(--safe-bottom));
    overflow: hidden;
}

.script-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    height: 100%;
}

.script-inner {
    padding: 14px 14px 32px;
    display: flex;
    flex-direction: column;
}

/* ---- 場面見出し ---- */
.line-heading {
    margin: 2rem 0 0.5rem;
    padding: 0 4px 6px;
    font-weight: 700;
    scroll-margin-top: calc(var(--header-h) + var(--safe-top) + 8px);
    line-height: 1.4;
    color: var(--primary);
    border-bottom: 2px solid var(--primary-dim);
}

.line-heading--lv1 {
    font-size: 1.2rem;
}

.line-heading--lv2 {
    font-size: 1.05rem;
}

.line-heading--lv3 {
    font-size: 0.95rem;
}

/* ---- 演出メモ（折りたたみ） ---- */
.line-memo {
    margin: 6px 0;
    padding: 6px 10px;
    background: var(--primary-faint);
    border-left: 3px solid var(--primary-dim);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    font-size: 0.9rem;
}

.line-memo__summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    list-style: none;
    user-select: none;
    min-height: var(--tap-min);
    display: flex;
    align-items: center;
    gap: 4px;
}

.line-memo__summary::-webkit-details-marker {
    display: none;
}

.line-memo__summary::before {
    content: '▶';
    font-size: 0.65em;
    display: inline-block;
    transition: transform 0.2s;
}

.line-memo[open] .line-memo__summary::before {
    transform: rotate(90deg);
}

.line-memo__body {
    margin: 4px 0 2px;
    color: var(--text-sub);
    white-space: pre-wrap;
    line-height: 1.7;
}

/* ---- 場面区切り線 ---- */
.line-divider {
    border: none;
    border-top: 2px dashed var(--primary-dim);
    margin: 1.5rem 0;
}

/* 空行 */
.line-empty {
    height: 8px;
}

/* ---- ト書き ---- */
.line-stage {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 10px;
    margin: 2px 0;
    border-radius: var(--radius-xs);
    transition: background 0.2s;
}

.line-stage.playing {
    background: var(--primary-faint);
}

.stage-text {
    flex: 1;
    color: var(--stage-col);
    font-style: italic;
    font-size: 13px;
    line-height: 1.9;
    font-weight: 500;
}

.stage-tts {
    flex-shrink: 0;
    background: transparent;
    border: 2px solid var(--border);
    color: var(--muted);
    border-radius: var(--radius-xs);
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
    min-width: var(--tap-min);
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s;
}

.stage-tts:active {
    border-color: var(--primary);
    color: var(--primary);
}

/* ---- セリフ行（カード風） ---- */
.line-dialogue {
    background: var(--bg-surface);
    border-left: 5px solid transparent;
    padding: 12px 14px;
    margin: 7px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    box-shadow: var(--shadow-sm);
    animation: slideIn 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) both;
    transition: box-shadow 0.2s;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.line-dialogue.playing {
    box-shadow: 0 0 0 2.5px var(--primary), var(--shadow-md);
}

/* 役名バッジ */
/* 役名バッジ＋アクションを横並びにするラッパー */
.char-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.char-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px 4px 7px;
    border-radius: 20px;
}

.char-label-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.char-label-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    flex-shrink: 0;
}

.char-label-name {
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

/* セリフ表示 */
.line-body {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.line-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.9;
    color: var(--text);
    word-break: break-all;
    font-weight: 500;
}

.line-text.revealed-text {
    color: var(--muted);
}

/* 非表示状態 */
.line-masked {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mask-display {
    min-height: 30px;
    display: flex;
    align-items: center;
}

.mask-chars {
    color: var(--border-md);
    font-size: 20px;
    letter-spacing: 0.08em;
    user-select: none;
    line-height: 1.6;
}

.hint-preview {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.9;
    word-break: break-all;
}

.hint-ellipsis {
    opacity: 0.5;
    font-size: 12px;
    font-weight: 400;
}

/* アクションボタン */
.line-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.btn-action {
    min-height: 26px;
    padding: 0 8px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid;
    opacity: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s;
    white-space: nowrap;
}

.btn-action:hover {
    opacity: 0.85;
}

/* 役名行用 */
.btn-action--sm {
    min-height: 24px;
    padding: 0 8px;
    font-size: 10px;
}

.btn-action:active {
    transform: scale(0.93);
}

.btn-hint {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92620a;
}

.btn-reveal {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.btn-hide-again {
    background: #fff1f2;
    border-color: #fda4af;
    color: #9f1239;
}

.btn-tts {
    background: var(--bg);
    border-color: var(--border-md);
    color: var(--text-sub);
    padding: 0 12px;
}

.btn-bookmark {
    background: var(--bg);
    border-color: var(--border-md);
    color: var(--muted);
    padding: 0 10px;
    font-size: 16px;
    line-height: 1;
    transition: transform 0.1s, color 0.15s;
}

.btn-bookmark.active {
    background: #fffbeb;
    border-color: #fbbf24;
    color: #f59e0b;
    opacity: 1;
}

/* =====================
   ボトムナビゲーション
===================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: calc(var(--bnav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
    background: var(--bg-surface);
    border-top: 2px solid var(--border);
    box-shadow: 0 -4px 20px rgba(108, 99, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.bnav-btn {
    flex: 1;
    min-height: var(--bnav-h);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--muted);
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s, transform 0.12s;
}

.bnav-btn:active {
    color: var(--primary);
    transform: scale(0.9);
}

.bnav-icon {
    font-size: 26px;
    line-height: 1;
    display: block;
    /* Material Symbols の表示設定 */
    font-family: 'Material Symbols Rounded', sans-serif;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-feature-settings: 'liga';
    -webkit-font-feature-settings: 'liga';
    user-select: none;
}

.bnav-label {
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
}

.bnav-btn--play {
    color: var(--primary);
}

.bnav-play-ring {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-lt));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.42);
    transition: transform 0.12s, box-shadow 0.12s;
}

.bnav-btn--play .bnav-icon {
    color: #fff;
    font-size: 28px;
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.bnav-btn--play:active .bnav-play-ring {
    transform: scale(0.88);
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.3);
}

.bnav-btn--play.playing .bnav-play-ring {
    background: linear-gradient(135deg, var(--coral), #ff3d5e);
    box-shadow: 0 4px 16px rgba(255, 101, 132, 0.42);
}

.bnav-btn--play.playing {
    color: var(--coral);
}

.bnav-btn--play.playing .bnav-icon {
    color: #fff;
}

/* =====================
   ボトムシート共通
===================== */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 299;
    background: rgba(45, 43, 85, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sheet-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    max-height: 85dvh;
    background: var(--bg-surface);
    border-top: 2px solid var(--border);
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -8px 40px rgba(108, 99, 255, 0.13);
}

.bottom-sheet.open {
    transform: translateY(0);
}

.sheet-handle-bar {
    width: 40px;
    height: 4px;
    background: var(--border-md);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 20px 10px;
    border-bottom: 2px solid var(--border);
    flex-shrink: 0;
}

.sheet-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.sheet-desc {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
    font-weight: 500;
}

.sheet-close {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--bg);
    border: 2px solid var(--border);
    color: var(--text-sub);
    font-size: 15px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    transition: background 0.15s;
}

.sheet-close:active {
    background: var(--border-md);
}

.sheet-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px 24px;
    flex: 1;
}

.sheet-scroll--settings {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 登場人物グリッド */
.char-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.char-bulk-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.char-bulk-btn {
    flex: 1;
    min-height: 38px;
    padding: 6px 12px;
    border: 1.5px solid var(--border-md);
    border-radius: var(--radius-xs);
    background: var(--bg-surface);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    transition: transform 0.1s, background 0.12s;
    -webkit-tap-highlight-color: transparent;
}

.char-bulk-btn:active {
    transform: scale(0.95);
    background: var(--primary-faint);
}

.char-bulk-btn:disabled {
    opacity: 0.35;
    cursor: default;
    transform: none;
}

.char-btn {
    min-height: 52px;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.12s, box-shadow 0.12s;
    color: var(--text);
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    box-shadow: var(--shadow-sm);
}

.char-btn:active {
    transform: scale(0.95);
}

.char-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.char-name-text {
    flex: 1;
}

.char-status {
    font-size: 10px;
    color: var(--muted);
    font-weight: 500;
}

.char-btn.hidden-char {
    background: var(--bg);
    color: var(--muted);
    border-color: var(--border);
    box-shadow: none;
}

.char-btn.hidden-char .char-dot {
    background: var(--border-md) !important;
    box-shadow: none !important;
}

/* =====================
   栞（見出しジャンプ）パネル
===================== */
.heading-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.heading-list-empty {
    font-size: 13px;
    color: var(--muted);
    padding: 12px 0;
    line-height: 1.7;
}

.heading-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-align: left;
    transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
    -webkit-tap-highlight-color: transparent;
    box-shadow: var(--shadow-sm);
}

.heading-item:active {
    transform: scale(0.97);
    background: var(--primary-faint);
}

.heading-item-icon {
    font-family: 'Material Symbols Rounded', sans-serif;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 22px;
    color: var(--primary);
    flex-shrink: 0;
}

.heading-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 見出しレベルによるインデント */
.heading-item--lv2 {
    padding-left: 28px;
    font-size: 13px;
    font-weight: 500;
    min-height: 42px;
    border-color: var(--border);
    box-shadow: none;
}

.heading-item--lv2 .heading-item-icon {
    font-size: 18px;
    color: var(--text-sub);
}

.heading-item--lv3 {
    padding-left: 42px;
    font-size: 12px;
    font-weight: 500;
    min-height: 38px;
    border-color: var(--border);
    box-shadow: none;
}

.heading-item--lv3 .heading-item-icon {
    font-size: 16px;
    color: var(--muted);
}

/* ジャンプ先のフラッシュアニメーション */
@keyframes heading-flash {
    0%   { background-color: var(--primary-dim); }
    100% { background-color: transparent; }
}

.heading-flash {
    animation: heading-flash 1.2s ease-out;
}

/* 設定スライダー */
.setting-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-sub);
    line-height: 1.5;
}

.setting-val {
    color: var(--primary);
}

.range-input {
    width: 100%;
    height: 4px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--val, 50%), var(--border) var(--val, 50%), var(--border) 100%);
    border-radius: 2px;
    outline: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.4), 0 0 0 3px #fff;
}

.range-input::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.4);
}

.range-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--muted);
    padding: 0 2px;
    font-weight: 500;
}

/* 音声選択 */
.voice-select {
    width: 100%;
    min-height: var(--tap-min);
    background: var(--bg-surface);
    border: 2px solid var(--border-md);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 40px 10px 14px;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c63ff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-color: var(--bg-surface);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.voice-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}

.voice-select option {
    background: #fff;
    color: var(--text);
}

.voice-note {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.75;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-xs);
    border-left: 3px solid var(--border-md);
    font-weight: 500;
}

.btn-tts-test {
    width: 100%;
    min-height: var(--tap-min);
    background: var(--primary-faint);
    border: 2px solid var(--primary-dim);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
}

.btn-tts-test:active {
    background: var(--primary-dim);
    transform: scale(0.97);
}

.tts-warning {
    font-size: 12px;
    color: #c05020;
    background: #fff3ed;
    border: 2px solid #ffc9a8;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    line-height: 1.6;
    font-weight: 500;
}

/* 設定シート内 法的リンク */
.legal-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.legal-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    padding: 6px 0;
    min-height: var(--tap-min);
    display: flex;
    align-items: center;
}

.legal-link:hover {
    text-decoration: underline;
}

/* 台本エクスポート */
.export-actions {
    display: flex;
    gap: 8px;
}

.btn-export {
    flex: 1;
    min-height: var(--tap-min);
    background: transparent;
    border: 2px solid var(--border-md);
    border-radius: var(--radius-sm);
    color: var(--text-sub);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn-export:active:not(:disabled) {
    background: var(--bg-surface);
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(0.97);
}

.btn-export:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* 台本削除ボタン */
.setting-group--danger {
    border-top: 2px solid var(--border);
    padding-top: 20px;
    margin-top: 4px;
}

.btn-clear-script {
    width: 100%;
    min-height: var(--tap-min);
    background: transparent;
    border: 2px solid #fca5a5;
    border-radius: var(--radius-sm);
    color: #dc2626;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
}

.btn-clear-script:active {
    background: #fee2e2;
    transform: scale(0.97);
}

.clear-note {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.7;
    font-weight: 500;
}

/* =====================
   テーマ選択UI
===================== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.theme-card {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 8px 10px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
    position: relative;
}

.theme-card:active {
    transform: scale(0.95);
}

.theme-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}

.theme-card-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-sub);
    text-align: center;
    line-height: 1.3;
}

.theme-card-check {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: #fff;
    font-weight: 800;
}

.theme-card.active .theme-card-check {
    display: flex;
}

.theme-card.active .theme-card-check::after {
    content: "✓";
}

/* テーマプレビューミニチュア */
.theme-preview {
    width: 100%;
    height: 52px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 6px 7px;
    gap: 4px;
    position: relative;
}

.theme-preview-bar {
    height: 8px;
    border-radius: 4px;
    width: 55%;
}

.theme-preview-line {
    height: 5px;
    border-radius: 3px;
    width: 90%;
}

.theme-preview-line.short {
    width: 65%;
}

/* A: ソフトライト */
.theme-preview--a {
    background: #faf8f5;
    border: 1.5px solid #ede8e2;
}

.theme-preview--a .theme-preview-bar {
    background: #e07b54;
}

.theme-preview--a .theme-preview-line {
    background: #ede8e2;
}

/* B: ポップ */
.theme-preview--b {
    background: linear-gradient(135deg, #5b4eff 0%, #ff4db8 100%);
    border: none;
}

.theme-preview--b .theme-preview-bar {
    background: #ffee55;
}

.theme-preview--b .theme-preview-line {
    background: rgba(255, 255, 255, 0.35);
}

/* C: ダークパステル */
.theme-preview--c {
    background: #1e1e2e;
    border: 1.5px solid #383850;
}

.theme-preview--c .theme-preview-bar {
    background: #cba6f7;
}

.theme-preview--c .theme-preview-line {
    background: #383850;
}

/* =====================
   サイトフッター（法的ページリンク）
===================== */
.site-footer {
    text-align: center;
    padding: 20px 16px calc(var(--bnav-h) + var(--safe-bottom) + 20px);
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.site-footer a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
}

.site-footer a:hover {
    color: var(--primary);
}

@media (min-width: 768px) {
    .site-footer {
        padding-bottom: 40px;
    }
}

/* =====================
   フィードバックフォーム
===================== */

/* 設定シート内の送るボタン */
.btn-feedback-open {
    width: 100%;
    min-height: var(--tap-min);
    background: var(--primary-faint);
    border: 2px solid var(--primary-dim);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
}

.btn-feedback-open:active {
    background: var(--primary-dim);
    transform: scale(0.97);
}

/* シートスクロール領域 */
.sheet-scroll--feedback {
    padding-bottom: 40px;
}

/* フォームグループ */
.fb-group {
    margin-bottom: 20px;
}

.fb-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-sub);
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fb-required {
    font-size: 10px;
    background: var(--primary);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

/* 星評価 */
.fb-stars {
    display: flex;
    gap: 6px;
}

.fb-star {
    font-size: 28px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--border-md);
    padding: 4px;
    line-height: 1;
    transition: color 0.1s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.fb-star.active {
    color: #ffaa00;
}

.fb-star:active {
    transform: scale(1.2);
}

/* チェックボックス */
.fb-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fb-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    padding: 8px 12px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    transition: border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.fb-check:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-faint);
    color: var(--primary);
}

.fb-check input {
    display: none;
}

/* テキストエリア */
.fb-textarea {
    width: 100%;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.7;
    padding: 12px 14px;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
}

.fb-textarea:focus {
    border-color: var(--primary);
}

.fb-textarea::placeholder {
    color: var(--muted);
}

/* 送信ボタン */
.btn-fb-submit {
    width: 100%;
    min-height: var(--tap-min);
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    margin-bottom: 10px;
    transition: filter 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.btn-fb-submit:hover {
    filter: brightness(1.05);
}

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

.btn-fb-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.fb-note {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    line-height: 1.6;
}

/* フッターのフィードバックボタン */
.site-footer__fb {
    background: none;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
}

.site-footer__fb:hover {
    color: var(--primary);
}

/* =====================
   インストール促進バナー
===================== */
.install-banner {
    position: fixed;
    bottom: calc(var(--bnav-h) + var(--safe-bottom) + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 8000;
    width: min(480px, calc(100vw - 32px));
    background: var(--bg-surface);
    border: 2px solid var(--border-md);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.install-banner.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

@media (min-width: 768px) {
    .install-banner {
        bottom: 24px;
        left: auto;
        right: 24px;
        transform: translateY(20px);
    }

    .install-banner.visible {
        transform: translateY(0);
    }
}

.install-banner__body {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.install-banner__icon {
    font-size: 28px;
    flex-shrink: 0;
}

.install-banner__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.install-banner__text strong {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
}

.install-banner__text span {
    font-size: 12px;
    color: var(--text-sub);
    line-height: 1.5;
}

.install-banner__actions {
    display: flex;
    gap: 8px;
}

.install-banner__btn {
    flex: 1;
    min-height: 40px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid;
    transition: transform 0.1s, background 0.12s;
    -webkit-tap-highlight-color: transparent;
}

.install-banner__btn:active {
    transform: scale(0.96);
}

.install-banner__btn--ok {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.install-banner__btn--ok:active {
    filter: brightness(0.9);
}

.install-banner__btn--ng {
    background: transparent;
    border-color: var(--border-md);
    color: var(--text-sub);
}

/* iOS専用: 共有ボタン案内 */
.install-ios-hint {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    font-weight: 600;
}

.install-ios-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 2px solid var(--primary);
    border-radius: 6px;
    color: var(--primary);
    font-size: 18px;
    flex-shrink: 0;
    /* Material Symbols */
    font-family: 'Material Symbols Rounded', sans-serif;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
    font-feature-settings: 'liga';
    -webkit-font-feature-settings: 'liga';
    user-select: none;
}

/* =====================
   カスタム確認ダイアログ
===================== */
.confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.18s;
}

.confirm-backdrop.visible {
    opacity: 1;
}

.confirm-dialog {
    position: fixed;
    z-index: 9001;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.94);
    width: min(320px, calc(100vw - 40px));
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transition: opacity 0.18s, transform 0.18s;
}

.confirm-dialog.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.confirm-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}

.confirm-desc {
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1.7;
    margin-bottom: 20px;
    font-weight: 500;
}

.confirm-actions {
    display: flex;
    gap: 10px;
}

.confirm-btn {
    flex: 1;
    min-height: var(--tap-min);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid;
    transition: transform 0.1s, background 0.12s;
    -webkit-tap-highlight-color: transparent;
}

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

.confirm-btn--cancel {
    background: var(--bg);
    border-color: var(--border-md);
    color: var(--text-sub);
}

.confirm-btn--cancel:active {
    background: var(--border);
}

.confirm-btn--ok {
    background: transparent;
    border-color: #fca5a5;
    color: #dc2626;
}

.confirm-btn--ok:active {
    background: #fee2e2;
}

/* =====================
   SW更新バナー
===================== */
.update-banner {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top) + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--text);
    color: #fff;
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    font-size: 13px;
    font-weight: 600;
    max-width: calc(100vw - 32px);
    animation: update-slide-in 0.3s ease-out;
}

@keyframes update-slide-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.update-banner__text {
    flex: 1;
    white-space: nowrap;
}

.update-banner__btn {
    padding: 5px 14px;
    border: none;
    border-radius: 20px;
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s;
}

.update-banner__btn:active {
    transform: scale(0.93);
}

.update-banner__close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.update-banner__close:hover {
    color: #fff;
}

/* =====================
   トースト
===================== */
.toast {
    position: fixed;
    bottom: calc(var(--bnav-h) + var(--safe-bottom) + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: var(--text);
    color: #fff;
    padding: 10px 22px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.22s, transform 0.22s;
    pointer-events: none;
    z-index: 9999;
    max-width: calc(100vw - 40px);
    text-align: center;
    box-shadow: 0 4px 16px rgba(45, 43, 85, 0.22);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =====================
   PC拡張（768px以上）
===================== */
/* ---- 768px〜：タブレット・小型ノートPC ---- */
@media (min-width: 768px) {
    :root {
        --header-h: 58px;
        --bnav-h: 60px;
        --sidebar-w: 200px;
        --drawer-w: 320px;
    }

    .input-title {
        font-size: 42px;
    }

    .input-subtitle {
        font-size: 15px;
    }

    .script-textarea {
        min-height: 280px;
    }

    .input-wrap {
        max-width: 640px;
    }

    .view--practice.active {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        padding-bottom: 0;
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    .bottom-nav {
        order: -1;
        position: sticky;
        top: calc(var(--header-h) + var(--safe-top));
        bottom: auto;
        left: auto;
        right: auto;
        z-index: 10;
        width: var(--sidebar-w);
        height: calc(100vh - var(--header-h));
        flex-direction: column;
        justify-content: flex-start;
        align-self: flex-start;
        padding: 20px 12px;
        gap: 6px;
        border-top: none;
        border-right: 2px solid var(--border);
        border-bottom: none;
        box-shadow: none;
        flex-shrink: 0;
    }

    .bnav-btn {
        width: 100%;
        min-height: 48px;
        flex-direction: row;
        justify-content: flex-start;
        padding: 0 14px;
        gap: 10px;
        border-radius: var(--radius-sm);
    }

    .bnav-btn:hover {
        background: var(--primary-faint);
        color: var(--primary);
        transform: none;
    }

    .bnav-label {
        font-size: 13px;
    }

    .bnav-btn--play {
        order: -1;
    }

    .bnav-play-ring {
        width: 38px;
        height: 38px;
        box-shadow: 0 2px 10px rgba(108, 99, 255, 0.35);
    }

    .bnav-btn--play .bnav-icon {
        font-size: 24px;
    }

    .bottom-sheet {
        left: auto;
        right: 0;
        top: calc(var(--header-h) + var(--safe-top));
        bottom: 0;
        max-height: none;
        height: calc(100dvh - var(--header-h) - var(--safe-top));
        width: var(--drawer-w);
        border-radius: 0;
        border-left: 2px solid var(--border);
        border-top: none;
        transform: translateX(100%);
        padding-bottom: 0;
        box-shadow: none;
    }

    .bottom-sheet.open {
        transform: translateX(0);
    }

    .sheet-handle-bar {
        display: none;
    }

    .char-grid {
        grid-template-columns: 1fr;
    }

    .script-container {
        height: auto;
        overflow-y: visible;
        overscroll-behavior-y: auto;
        flex: 1;
        min-width: 0;
    }

    .script-inner {
        max-width: 760px;
        margin: 0 auto;
        padding: 28px 32px 60px;
    }

    .toast {
        bottom: 24px;
    }
}

/* ---- 1280px〜：一般的なノートPC・デスクトップ（FHDの2/3以下） ---- */
@media (min-width: 1280px) {
    :root {
        --sidebar-w: 220px;
        --drawer-w: 360px;
    }

    .input-wrap {
        max-width: 800px;
    }

    .script-inner {
        max-width: 900px;
        padding: 32px 48px 60px;
    }
}

/* ---- 1440px〜：MacBook Pro・QHD・標準デスクトップ ---- */
@media (min-width: 1440px) {
    :root {
        --sidebar-w: 240px;
        --drawer-w: 400px;
    }

    .input-wrap {
        max-width: 900px;
    }

    .script-inner {
        max-width: 1020px;
    }
}

/* ---- 1920px〜：FHD・大型ディスプレイ ---- */
@media (min-width: 1920px) {
    :root {
        --sidebar-w: 260px;
        --drawer-w: 440px;
    }

    .input-wrap {
        max-width: 1000px;
    }

    .script-inner {
        max-width: 1200px;
    }

    .line-text {
        font-size: 16px;
    }
}
