/* =========================================
   ViLi-Eve: レポート(mojibake_fix_report.md)準拠版
   ========================================= */

:root {
    --primary: #ff6b9d;
    --primary-glow: rgba(255, 107, 157, 0.4);
    --bg-dark: #000000;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-text: rgba(255, 255, 255, 0.99);
    --surface-main: #000000;
    --surface-panel: #111827;
    --surface-panel-2: #1e293b;
    --line-subtle: rgba(255, 255, 255, 0.1);
    --chat-ai-bg: rgba(255, 255, 255, 0.1);
    --chat-ai-text: #f8fafc;
    --chat-user-bg: #8fd3ff;
    --chat-user-text: #071827;
    --chat-meta: #a0a0c0;
    --chat-action: #2563eb;
    --chat-action-glow: rgba(37, 99, 235, 0.26);
    /* 意味別テーマ変数（正本）。設定画面・イベント一覧の固定色はこれらへ
       置き換える。個別のbody.theme-light !important上書きを増やす代わりに、
       ダーク/ライト双方の値をここで確定させる。 */
    --text-muted: #9aa3b2;      /* ラベル・タブ文字など、本文より一段控えめな文字 */
    --text-subtle: #8b95a7;     /* 説明文・注記など、さらに控えめな文字 */
    --surface-card: rgba(255, 255, 255, 0.04);   /* カード・パネルの通常背景 */
    --surface-elevated: rgba(255, 255, 255, 0.08); /* ボタン・タブチップ等の背景 */
    --border-subtle: var(--line-subtle);          /* カード・入力欄・タブの枠線 */
    --control-bg: #1a1a1a;      /* input/selectの背景 */
    --control-text: #ffffff;    /* input/selectの文字色 */
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-dark: #f1f5f9;
        --card-bg: #ffffff;
        --text-main: #0f172a;
        --input-bg: #ffffff;
        --input-text: #000000;
    }
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    color-scheme: light dark;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body.theme-light {
    --primary: #e7548b;
    --primary-glow: rgba(231, 84, 139, 0.22);
    --bg-dark: #f6f7fb;
    --card-bg: #ffffff;
    --text-main: #111827;
    --input-bg: #ffffff;
    --input-text: #111827;
    --surface-main: #ffffff;
    --surface-panel: #ffffff;
    --surface-panel-2: #ffffff;
    --line-subtle: rgba(15, 23, 42, 0.1);
    --chat-ai-bg: #ffffff;
    --chat-ai-text: #182033;
    --chat-user-bg: #8fd3ff;
    --chat-user-text: #071827;
    --chat-meta: #7a8497;
    --chat-action: #2563eb;
    --chat-action-glow: rgba(37, 99, 235, 0.22);
    --text-muted: #4b5563;
    --text-subtle: #6b7280;
    --surface-card: #ffffff;
    --surface-elevated: #ffffff;
    --border-subtle: var(--line-subtle);
    --control-bg: #ffffff;
    --control-text: #111827;
    color-scheme: light;
}

body.theme-light .tab-content,
body.theme-light #tab-chat {
    background: #ffffff !important;
    color: #111827;
}

body.theme-light #chat-area {
    background: #d7f0e8 !important;
}

body.theme-light .sns-sticky-header,
body.theme-light .input-area {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.1) !important;
}

body.theme-light #sns-chat-header,
body.theme-light #snt-header {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.1) !important;
    color: #111827 !important;
}

body.theme-light .contact-item {
    border-color: rgba(15, 23, 42, 0.08);
}

body.theme-light .contact-item:active {
    background: rgba(15, 23, 42, 0.04);
}

body.theme-light .contact-name,
body.theme-light #sns-chat-name,
body.theme-light #sns-contact-name,
body.theme-light .x-name,
body.theme-light .x-content {
    color: #111827 !important;
}

body.theme-light .contact-last-msg,
body.theme-light #sns-last-msg,
body.theme-light .x-handle,
body.theme-light .x-footer,
body.theme-light .x-comment-item .c-name {
    color: #6b7280 !important;
}

body.theme-light .drawer-toggle,
body.theme-light .home-return-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #111827;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

body.theme-light #sns-talk-back,
body.theme-light #sns-talk button[aria-label="ホームへ戻る"],
body.theme-light #snt-panel button[aria-label="ホームへ戻る"] {
    color: #111827 !important;
    background: rgba(15, 23, 42, 0.06) !important;
}

body.theme-light #tab-debug {
    background: #000 !important;
    color: #0f0 !important;
}

body.theme-light #tab-debug input,
body.theme-light #tab-debug pre {
    background: #111 !important;
    color: #0f0 !important;
    border-color: #0f0 !important;
}

body.theme-light .x-post {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.1);
}

body.theme-light .x-comment-input-area input,
body.theme-light #tab-settings [style*="background:#1a1a1a"],
body.theme-light #tab-settings [style*="background: #1a1a1a"],
body.theme-light #set-ui-theme,
body.theme-light #set-country,
body.theme-light #set-pref,
body.theme-light #set-city,
body.theme-light #set-hometown-overseas,
body.theme-light #set-occupation,
body.theme-light #set-work-pattern,
body.theme-light #set-sns-name {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.14) !important;
    color: #111827 !important;
}

body.theme-light .message {
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

body.theme-light .ai .message {
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
}

body.theme-light .user .message {
    box-shadow: 0 5px 16px rgba(59, 130, 246, 0.2);
}

/* --- レポートに基づいた「文字化け」絶対回避設定 --- */
input {
    font-family: system-ui, -apple-system, sans-serif !important;
}
button, select, textarea {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif !important;
}

.glass-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid rgba(128, 128, 128, 0.2);
    padding: 14px;
    border-radius: 12px;
    color: var(--input-text);
    font-size: 16px;
    outline: none;
    -webkit-appearance: none;
}

.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif !important;
}

#title-screen {
    background-image: url('../images/title_bg.jpg');
    background-size: cover;
    background-position: center;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}
#title-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* top から配置してスクロール可能に */
    padding: 40px 0; /* 上下の余白 */
    overflow-y: auto; /* スクロールを有効化 */
    -webkit-overflow-scrolling: touch;
}

#onboarding-overlay {
    background: #000;
}

.onboarding-card {
    width: 90%;
    max-width: 400px;
    padding: 25px;
    margin-bottom: 40px; /* 下に余白を作る */
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid rgba(128, 128, 128, 0.1);
}

.btn-primary-glow {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 30px;
    font-weight: 700;
    width: 100%;
    box-shadow: 0 0 20px var(--primary-glow);
}

.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom); /* iPhone notch/home bar support */
}

.header { padding: 15px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1); color: var(--primary); font-weight: 600; }
.app-header {
    position: relative;
    min-height: 0;
    height: 0;
    padding: 0 !important;
    border: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.drawer-toggle {
    position: fixed;
    left: 12px;
    top: calc(env(safe-area-inset-top, 0px) + 34px);
    transform: none;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 500;
    cursor: pointer;
    z-index: 1200;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(12px);
}

.home-return-btn {
    position: fixed;
    left: 12px;
    top: calc(env(safe-area-inset-top, 0px) + 34px);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    z-index: 1200;
    display: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(12px);
}

body:not(.is-face-tab) .home-return-btn {
    display: block;
}

body:not(.is-face-tab) .drawer-toggle {
    display: none;
}

body.sns-overlay-open .drawer-toggle,
body.sns-overlay-open .home-return-btn {
    display: none !important;
}
.tabs { display: none; background: #000; border-bottom: 1px solid rgba(255,255,255,0.1); }
.tab-btn { flex: 1; padding: 14px; background: none; border: none; color: #555; }
.tab-btn.active { color: var(--primary); border-bottom: 2px solid var(--primary); }

.main-stage {
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.app-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(0, 0, 0, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.app-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(78vw, 310px);
    z-index: 4001;
    background: rgba(15, 23, 42, 0.97);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.36);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    padding: calc(env(safe-area-inset-top, 0px) + 24px) 14px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body.drawer-open .app-drawer {
    transform: translateX(0);
}

body.drawer-open .app-drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.drawer-profile {
    padding: 8px 8px 18px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-title {
    color: #ff5f9e;
    font-size: 1.15rem;
    font-weight: 650;
}

.drawer-subtitle {
    color: #8b95a7;
    font-size: 0.76rem;
    margin-top: 2px;
}

.drawer-item {
    min-height: 46px;
    width: 100%;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.86);
    text-align: left;
    padding: 0 14px;
    font-size: 0.95rem;
    font-weight: 450;
    font-family: inherit;
    cursor: pointer;
}

.drawer-item.active {
    background: rgba(255, 95, 158, 0.16);
    color: #fff;
}
.drawer-event-item { display:flex; align-items:center; justify-content:space-between; }
.story-event-badge { min-width:20px; height:20px; padding:0 6px; border-radius:10px; background:var(--primary); color:#fff; display:inline-flex; align-items:center; justify-content:center; font-size:.72rem; font-weight:700; }

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto; /* Allow scrolling for status/player tabs */
    overflow-x: hidden;
    padding: 20px 15px;
    background: linear-gradient(180deg, var(--surface-panel) 0%, var(--surface-main) 100%);
    -webkit-overflow-scrolling: touch;
}
.tab-content.active {
    display: block; /* Use block to allow normal scrolling flow */
}

/* Face and Chat tabs should remain flex for their specific layouts */
#tab-face.active, #tab-chat.active {
    display: flex;
    flex-direction: column;
    overflow: hidden; /* They manage their own scrolling areas */
    padding: 0;
}

#tab-outing.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    background: #fff;
}
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; color: var(--primary); font-weight: 600; }

/* Typing Animation */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9em;
    color: #888;
    padding: 8px 12px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-of-type(1) { animation-delay: 0s; }
.typing-dot:nth-of-type(2) { animation-delay: 0.2s; }
.typing-dot:nth-of-type(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1.0); opacity: 1; }
}

/* Icon Appear Animation */
@keyframes icon-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.status-icon {
    animation: icon-fade-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- Premium UI Components --- */
.premium-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.level-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.level-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #ff8eb3 100%);
    box-shadow: 0 0 10px var(--primary-glow);
    transition: width 0.5s ease-out;
}

.char-select-wrap {
    margin-bottom: 20px;
}

.premium-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid var(--primary);
    padding: 10px;
    border-radius: 8px;
    outline: none;
}

/* --- メッセンジャー UI (独自デザイン) --- */
.chat-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 15px;
    background: var(--surface-main);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* メッセージの行（左右配置用） */
.message-row {
    display: flex;
    width: 100%;
}
.message-row.user { display: flex; flex-direction: row; justify-content: flex-end; align-items: flex-end; gap: 4px; }
.message-row.ai { justify-content: flex-start; align-items: flex-end; gap: 8px; }
.read-receipt {
    font-size: 0.68rem;
    color: var(--chat-meta);
    animation: fadeIn 0.4s ease;
}
.msg-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}
.msg-time {
    font-size: 0.68rem;
    color: var(--chat-meta);
    white-space: nowrap;
}

/* 共通の吹き出しスタイル */
.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 15px;
    font-weight: 300;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

/* AI側（左）：ダークグレーのガラス風 */
.ai .message {
    background: var(--chat-ai-bg);
    color: var(--chat-ai-text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--line-subtle);
}

/* AIメッセージ内のリンク */
.message a.chat-link {
    color: #a0c4ff;
    text-decoration: underline;
    word-break: break-all;
}

.user .message a.chat-link {
    color: #071827;
    font-weight: 600;
}

/* ユーザー側（右）：テーマカラーのピンク */
.user .message {
    background: var(--chat-user-bg);
    color: var(--chat-user-text);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* 独り言・モノローグ（斜体・薄い色） */
.monologue-msg {
    background: transparent !important;
    border: none !important;
    color: #888 !important;
    font-style: italic;
    font-size: 0.9rem !important;
}

/* スタンプの配置調整 */
.stamp-msg {
    max-width: 150px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.user .stamp-msg { margin-left: auto; }
.ai .stamp-msg { margin-right: auto; }

/* --- SNS 連絡先リスト --- */
.sns-sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
}
.contact-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}
.contact-item:active {
    background: rgba(255, 255, 255, 0.05);
}
.contact-avatar {
    width: 50px;
    height: 50px;
    border-radius: 25px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
    color: #fff;
    margin-right: 15px;
    box-shadow: 0 4px 10px var(--primary-glow);
}
.contact-info {
    flex: 1;
}
.contact-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
    color: #f8fafc;
}
.contact-last-msg {
    font-size: 0.8rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sns-list,
#sns-contact-list,
#sns-home,
#sns-talk {
    background: var(--surface-main);
}

#contact-gf {
    color: #f8fafc !important;
}

#sns-contact-name {
    color: #f8fafc !important;
    font-weight: 600 !important;
}

#sns-last-msg {
    color: #9ca3af !important;
}

#sns-talk-back,
#sns-talk button[aria-label="ホームへ戻る"],
#snt-panel button[aria-label="ホームへ戻る"] {
    color: #f8fafc !important;
    min-width: 38px;
    width: 38px;
    height: 36px;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

#sns-talk-back {
    font-family: system-ui, -apple-system, sans-serif !important;
    line-height: 1;
}

/* 思考パネルの調整 (デフォルト非表示) */
.thought-panel {
    display: none;
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid rgba(255, 107, 157, 0.3);
    color: var(--primary);
    font-size: 0.85rem;
    padding: 10px 15px;
    backdrop-filter: blur(5px);
}
.tab-content.active#tab-debug ~ .thought-panel,
body.debug-mode .thought-panel {
    display: block;
}

/* 入力エリアの復元 (ダーク・グラスモルフィズム) */
.input-area {
    background: var(--surface-panel-2);
    border-top: 1px solid var(--line-subtle);
    padding: 12px 15px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
}

#user-input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--line-subtle);
    border-radius: 20px;
    padding: 10px 15px;
    color: var(--input-text);
    font-size: 15px;
    font-weight: 300;
    outline: none;
    transition: border-color 0.3s;
    resize: none;
    overflow-y: hidden;
    min-height: 42px;
    max-height: 160px;
    line-height: 1.5;
    box-sizing: border-box;
}

#user-input:focus {
    background: var(--input-bg);
    border-color: var(--chat-action);
}

#send-btn {
    background: var(--chat-action);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--chat-action-glow);
    transition: transform 0.2s;
}

#send-btn:active {
    transform: scale(0.95);
}

#stamp-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    padding: 0;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#stamp-btn:hover {
    opacity: 1;
}

/* スタンプ選択パネルの追加調整 */
#stamp-picker {
    background: rgba(30, 41, 59, 0.95) !important;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 15px !important;
    width: 250px !important;
}

#stamp-picker img:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.05);
}

/* ビジュアルノベル入力欄の調整 */
#vn-input-container {
    z-index: 1000;
}

.location-switcher {
    position: absolute;
    top: 10px;
    left: 62px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 20px);
}

.location-select {
    min-height: 36px;
    max-width: 170px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(10, 15, 25, 0.72);
    color: #fff;
    padding: 0 30px 0 11px;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: 'Hiragino Sans', sans-serif;
    outline: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(12px);
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.86) 50%), linear-gradient(135deg, rgba(255,255,255,0.86) 50%, transparent 50%);
    background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.location-badge {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    background: rgba(255, 95, 158, 0.9);
    color: #fff;
    padding: 0 12px;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(255, 95, 158, 0.22);
    backdrop-filter: blur(12px);
    white-space: nowrap;
}

.home-launcher {
    position: absolute;
    top: 76px;
    left: 20px;
    right: 20px;
    z-index: 20;
    display: none;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px 0;
    align-items: start;
    justify-items: center;
    pointer-events: none;
}

.home-app-icon {
    width: 68px;
    border: 0;
    background: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    pointer-events: auto;
    font-family: inherit;
}

.home-app-tile {
    width: 58px;
    height: 58px;
    border-radius: 13px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

.home-app-tile.image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.home-app-tile.gradient {
    background: linear-gradient(135deg, #ff5f9e, #3b82f6);
}

.home-app-label {
    max-width: 68px;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.2;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-dock {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    transform: none;
    z-index: 21;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-items: center;
    gap: 0;
    padding: 10px 14px;
    border-radius: 28px;
    background: rgba(18, 24, 34, 0.66);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(16px);
}

.home-dock-icon {
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    font-family: inherit;
}

.home-dock-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.home-dock-icon span {
    font-size: 1.15rem;
    font-weight: 650;
}

.story-event-home-notice { position:absolute; z-index:22; left:18px; right:18px; bottom:112px; color:#fff; }
.story-event-notice-card { width:100%; border:1px solid rgba(255,202,225,.42); border-radius:18px; padding:13px 15px; text-align:left; color:#fff; background:linear-gradient(135deg,rgba(64,24,52,.92),rgba(28,27,57,.92)); box-shadow:0 12px 30px rgba(0,0,0,.28); backdrop-filter:blur(12px); cursor:pointer; }
.story-event-notice-kicker,.story-events-eyebrow { margin:0 0 4px; color:#ffb4d0; font-size:.68rem; font-weight:700; letter-spacing:.12em; }
.story-event-notice-title { margin:0; font-size:1rem; font-weight:700; }.story-event-notice-meta { margin:4px 0 0; color:rgba(255,255,255,.72); font-size:.78rem; }
.story-events-tab { min-height:100%; padding:26px 18px 36px; background:radial-gradient(circle at 88% 0%, rgba(227,83,143,.18), transparent 34%), #10111a; }
.story-events-header h2 { margin:0; font-size:1.55rem; color:var(--text-main); }.story-events-header > div > p:last-child { margin:8px 0 24px; color:var(--text-subtle); font-size:.86rem; }
.story-event-tabs { display:flex; gap:8px; margin:0 0 18px; overflow-x:auto; }
.story-event-tab { position:relative; flex:none; padding:9px 16px; border:1px solid var(--border-subtle); border-radius:999px; background:var(--surface-elevated); color:var(--text-muted); font-weight:700; font-size:.86rem; cursor:pointer; }
.story-event-tab-active { border-color:var(--primary); background:var(--primary-glow); color:var(--primary); }
.story-event-tab-dot { display:inline-block; width:7px; height:7px; margin-left:6px; border-radius:50%; background:var(--primary); vertical-align:middle; }
.story-event-list { display:grid; gap:22px; }.story-event-card-copy { margin:0; color:var(--text-subtle); font-size:.82rem; }
.story-event-slot-list { display:grid; gap:10px; }
.story-event-slot { display:flex; align-items:center; gap:12px; padding:14px; border:1px solid var(--border-subtle); border-radius:16px; background:var(--surface-card); box-shadow:0 10px 24px rgba(0,0,0,.18); }
.story-event-slot-locked { border-style:dashed; background:var(--surface-card); opacity:.82; }
.story-event-slot-icon { flex:none; font-size:1.1rem; opacity:.6; }
.story-event-slot-title { flex:1; min-width:0; margin:0; font-size:1rem; color:var(--text-main); }
.story-event-slot-locked .story-event-slot-title { color:var(--text-muted); }
.story-event-slot-banner { flex:none; width:64px; height:64px; object-fit:cover; border-radius:12px; }
.story-event-start { flex:none; padding:9px 16px; border:0; border-radius:11px; background:linear-gradient(135deg,#ff5f9e,#e54987); color:#fff; font-weight:700; cursor:pointer; }.story-event-start:disabled { background:#353846; color:#9ca3af; cursor:default; }
.story-event-overlay { position:fixed; inset:0; z-index:9997; overflow:hidden; background:#000; }.story-event-overlay[hidden] { display:none; }.story-event-image { width:100%; height:100%; object-fit:cover; object-position:50% 50%; position:absolute; inset:0; }.story-event-image-next { z-index:1; opacity:0; pointer-events:none; }.story-event-vignette { position:absolute; z-index:2; inset:0; pointer-events:none; background:linear-gradient(to bottom,rgba(0,0,0,.08),transparent 46%,rgba(0,0,0,.76)); }.story-event-color-filter { position:absolute; z-index:2; inset:0; pointer-events:none; opacity:0; background:rgba(228,132,56,.30); mix-blend-mode:multiply; }.story-event-textbox { position:absolute; z-index:3; left:0; right:0; bottom:0; padding:18px 20px 27px; background:rgba(0,0,0,.64); backdrop-filter:blur(4px); color:#fff; }.story-event-textbox p { font-family:'Hiragino Mincho ProN','Georgia',serif; white-space:pre-wrap; }.story-event-textbox #story-event-speaker { font-family:'Hiragino Sans',sans-serif; font-size:.85rem; font-weight:700; margin:0 0 6px; min-height:1.2em; }
.speaker-name--female { color:#f9c; }
.speaker-name--male { color:#9fd8ff; }
.speaker-name--neutral { color:#fff; }.story-event-next { margin:8px 0 0; text-align:right; color:rgba(255,255,255,.38); font-family:'Hiragino Sans',sans-serif !important; font-size:.65rem; }
/* 固定チャット演出（[chat_cutscene:]）中: 下層のチャット画面（#sns-timeline-overlay）を
   見せるため、story-event-overlay自体は表示したまま背景と画像/ヴィネット/色フィルターだけを消す。
   タップ進行(onclick)はstory-event-overlay自身に残るため、別要素へ差し替えない。 */
.story-event-overlay--chat-cutscene { background:transparent; }
.story-event-overlay--chat-cutscene .story-event-image,
.story-event-overlay--chat-cutscene .story-event-image-next,
.story-event-overlay--chat-cutscene .story-event-vignette,
.story-event-overlay--chat-cutscene .story-event-color-filter { display:none; }
.story-event-choice-box { display:grid; gap:10px; margin-top:14px; }.story-event-choice-button { display:block; width:100%; text-align:left; border:1px solid rgba(255,255,255,.22); border-radius:12px; padding:13px 16px; background:linear-gradient(135deg,rgba(255,95,158,.22),rgba(229,73,135,.22)); color:#fff; font-weight:700; font-size:.94rem; font-family:'Hiragino Sans',sans-serif; cursor:pointer; }.story-event-choice-button:active { background:linear-gradient(135deg,#ff5f9e,#e54987); }.story-event-choice-button:disabled { opacity:.5; cursor:default; }
.story-event-log-toggle { position:absolute; z-index:2; top:calc(env(safe-area-inset-top, 0px) + 14px); right:16px; border:1px solid rgba(255,255,255,.36); border-radius:999px; padding:7px 13px; color:#fff; background:rgba(0,0,0,.42); backdrop-filter:blur(8px); font-weight:700; }
.story-event-skip { position:absolute; z-index:2; top:calc(env(safe-area-inset-top, 0px) + 14px); left:16px; border:1px solid rgba(255,255,255,.36); border-radius:999px; padding:7px 13px; color:#fff; background:rgba(0,0,0,.42); backdrop-filter:blur(8px); font-weight:700; }.story-event-skip[hidden] { display:none; }.story-event-log-panel { position:absolute; z-index:4; inset:0; display:flex; flex-direction:column; background:rgba(12,13,20,.97); color:#f4f3f8; }.story-event-log-panel[hidden] { display:none; }.story-event-log-header { display:flex; align-items:center; justify-content:space-between; padding:calc(env(safe-area-inset-top, 0px) + 18px) 18px 14px; border-bottom:1px solid rgba(255,255,255,.1); }.story-event-log-header h2 { margin:0; font-size:1.05rem; }.story-event-log-header button { border:0; border-radius:999px; padding:7px 12px; color:#fff; background:rgba(255,255,255,.12); }.story-event-log-list { flex:1; overflow-y:auto; padding:16px 18px 32px; }.story-event-log-entry { padding:0 0 16px; margin:0 0 16px; border-bottom:1px solid rgba(255,255,255,.08); }.story-event-log-speaker { margin:0 0 5px; font-size:.78rem; font-weight:700; }.story-event-log-text { margin:0; white-space:pre-wrap; font-family:'Hiragino Mincho ProN','Georgia',serif; font-size:.93rem; line-height:1.8; }.story-event-log-empty { color:#9ca3b6; text-align:center; padding-top:40px; }

.settings-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 20px;
}

.settings-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.settings-input {
    width: 100%;
    padding: 10px;
    background: var(--control-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--control-text);
    font-size: 1rem;
}

.settings-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--control-bg);
    border-radius: 8px;
}

.home-wallpaper-row {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 12px;
    align-items: center;
}

.home-wallpaper-preview {
    width: 88px;
    height: 132px;
    border-radius: 14px;
    object-fit: cover;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.home-wallpaper-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sub-action-btn {
    min-height: 38px;
    border: 0;
    border-radius: 10px;
    padding: 0 12px;
    background: var(--surface-elevated);
    color: var(--text-main);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.home-wallpaper-defaults {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.home-wallpaper-defaults button {
    height: 74px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    background: #111827;
    cursor: pointer;
}

.home-wallpaper-defaults img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.settings-note {
    margin-top: 9px;
    color: var(--text-subtle);
    font-size: 0.72rem;
    line-height: 1.45;
}

/* 設定タブ内カテゴリ（サブタブ）。今後の項目追加に耐える構造として、
   4カテゴリ（プロフィール/アプリ/SNS/アカウント）で導入。将来カテゴリを
   増やす場合も同じ .settings-subtab-btn / .settings-subtab-panel を
   追加するだけでよい。 */
.settings-subtab-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line-subtle);
}

.settings-subtab-bar::-webkit-scrollbar {
    display: none;
}

.settings-subtab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 16px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.settings-subtab-btn.active {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-glow);
}

.settings-subtab-panel {
    display: none;
}

.settings-subtab-panel.active {
    display: block;
}

@media (max-height: 720px) {
    .home-dock {
        bottom: 14px;
    }
}

#tab-face.home-mode .home-launcher {
    display: grid;
}

#tab-face .home-dock {
    display: grid;
}

#tab-face #vn-window {
    bottom: 104px !important;
}

#tab-face.home-mode #vn-window {
    bottom: 104px !important;
    left: 24px !important;
    right: 24px !important;
    min-height: 58px;
    padding: 17px 20px !important;
    border-radius: 14px !important;
}

#tab-face.home-mode #vn-backlog,
#tab-face.home-mode #vn-name,
#tab-face.home-mode #vn-input-container,
#tab-face.home-mode #vn-away-msg {
    display: none !important;
}

#tab-face.home-mode #vn-text {
    min-height: 0 !important;
    font-size: 0.95rem !important;
    line-height: 1.55 !important;
    color: rgba(255, 255, 255, 0.9);
}

/* --- 時間帯ビジュアル同期フィルター --- */
/* キャラクター用 */
.char-dawn { filter: brightness(0.85) saturate(1.1) hue-rotate(10deg) contrast(0.9); }
.char-evening { filter: sepia(0.35) brightness(0.9) contrast(1.1) hue-rotate(-15deg); }
.char-night { filter: brightness(0.55) contrast(1.1) saturate(0.6) hue-rotate(10deg); }
.char-midnight { filter: brightness(0.4) contrast(1.2) saturate(0.5) hue-rotate(20deg); }
.char-none { filter: none; }

/* 背景用 (Face-to-face tab 用) */
.bg-none { filter: none; }

/* --- X (Twitter) スタイル --- */
.x-post {
    padding: 12px 16px;
    border-bottom: 1px solid #2f3336;
    display: flex;
    gap: 12px;
    background: #000;
}
.x-avatar {
    width: 48px;
    height: 48px;
    border-radius: 24px;
    background: var(--primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}
.x-body {
    flex: 1;
}
.x-header {
    display: flex;
    gap: 4px;
    font-size: 0.95rem;
    margin-bottom: 2px;
}
.x-name { font-weight: 600; color: #e7e9ea; }
.x-handle { color: #71767b; }
.x-content {
    font-size: 1rem;
    color: #e7e9ea;
    line-height: 1.4;
    word-break: break-word;
}
.x-footer {
    display: flex;
    justify-content: space-between;
    max-width: 300px;
    margin-top: 10px;
    color: #71767b;
    font-size: 0.85rem;
}
.x-footer span { cursor: pointer; padding: 4px 6px; border-radius: 4px; transition: background 0.15s; }
.x-footer span:hover { background: rgba(255,255,255,0.08); }
.x-liked { color: #f91880 !important; }
.x-comments { margin-top: 8px; padding-top: 8px; border-top: 1px solid #2f3336; display: flex; flex-direction: column; gap: 4px; }
.x-comment-item { font-size: 0.85rem; color: #e7e9ea; display: flex; gap: 6px; }
.x-comment-item .c-name { font-weight: 600; color: #71767b; white-space: nowrap; }
.x-comment-input-area { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.x-comment-input-area input { flex: 1; background: #1a1a1a; border: 1px solid #2f3336; border-radius: 20px; padding: 6px 12px; color: #e7e9ea; font-size: 0.85rem; outline: none; }
.x-comment-input-area input:focus { border-color: var(--primary); }
.x-comment-input-area button { background: var(--primary); color: #fff; border: none; border-radius: 20px; padding: 6px 14px; font-size: 0.85rem; cursor: pointer; }

.debug-hidden { display: none !important; }

/* トレーニングボタン */
.train-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 14px 16px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-align: left;
}
.train-btn:hover, .train-btn:active {
    background: color-mix(in srgb, var(--train-color) 15%, transparent);
    border-color: var(--train-color);
}

/* --- おでかけモード --- */
.outing-tab {
    background: #fff;
    color: #1f2937;
}

.outing-shell {
    position: relative;
    height: 100%;
    min-height: 0;
    background: #fff;
    overflow: hidden;
}

.outing-mode-tabs {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    gap: 4px;
    padding: 3px;
    background: rgba(255,255,255,0.86);
    border: 1px solid rgba(15,23,42,0.08);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.12);
    backdrop-filter: blur(12px);
}

.outing-mode-tab {
    min-width: 68px;
    height: 30px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #6b7280;
    font-size: 0.78rem;
    font-weight: 600;
}

.outing-mode-tab.active {
    background: #111827;
    color: #fff;
}

.outing-panel {
    display: none;
    height: 100%;
    min-height: 0;
}

.outing-panel.active {
    display: block;
}

.outing-prestart {
    position: absolute;
    inset: 0;
    z-index: 26;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 74px 18px 24px;
    background: #f8fafc;
    color: #111827;
}

.outing-shell.is-active .outing-prestart {
    display: none;
}

.outing-shell.is-planning .outing-visual,
.outing-shell.is-planning .outing-status-pill,
.outing-shell.is-planning .outing-camera-btn,
.outing-shell.is-planning .outing-conversation {
    display: none;
}

.outing-prestart-card {
    width: min(100%, 420px);
    border: 1px solid #e0e5ee;
    border-radius: 8px;
    background: #fff;
    padding: 18px 19px;
    box-shadow: 0 12px 30px rgba(15,23,42,0.08);
}

.outing-prestart-kicker {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.outing-prestart-title {
    font-size: 1.04rem;
    font-weight: 650;
    color: #111827;
    line-height: 1.45;
}

.outing-prestart-meta {
    margin-top: 9px;
    color: #6b7280;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.65;
}

.outing-prestart-actions,
.outing-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.outing-primary-btn,
.outing-secondary-btn {
    min-height: 40px;
    border-radius: 999px;
    padding: 0 14px;
    font-size: 0.84rem;
    font-weight: 600;
    border: none;
}

.outing-primary-btn {
    background: var(--primary);
    color: #fff;
}

.outing-secondary-btn {
    background: #eef2f7;
    color: #111827;
}

.outing-modal[hidden] {
    display: none;
}

.outing-modal {
    position: absolute;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15,23,42,0.58);
    backdrop-filter: blur(8px);
}

.outing-modal-card {
    width: min(100%, 360px);
    border-radius: 8px;
    background: #fff;
    color: #111827;
    padding: 18px;
    box-shadow: 0 18px 46px rgba(0,0,0,0.24);
}

.outing-modal-title {
    font-size: 1rem;
    font-weight: 650;
}

.outing-modal-text {
    margin-top: 8px;
    color: #4b5563;
    font-size: 0.86rem;
    line-height: 1.65;
}

.outing-visual {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: #fff;
    overflow: hidden;
    transition: inset 0.22s ease;
}

.outing-heroine-video,
.outing-heroine-fallback {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    background: #fff;
}

.outing-heroine-fallback {
    display: none;
    padding: 42px 20px 0;
}

.outing-camera-btn {
    position: absolute;
    right: 18px;
    bottom: calc(34% + 74px);
    z-index: 30;
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 12px 30px rgba(15,23,42,0.28);
    transition: transform 0.18s ease, background 0.18s ease, bottom 0.22s ease;
}

.outing-camera-btn:active {
    transform: scale(0.94);
    background: var(--primary);
}

.outing-camera-btn svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.outing-conversation {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 38%;
    min-height: 190px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, rgba(15,23,42,0), rgba(15,23,42,0.58) 18%, rgba(15,23,42,0.78) 100%);
    color: #fff;
    border-top: none;
    box-shadow: none;
    transition: height 0.22s ease;
    z-index: 18;
}

.outing-shell.chat-expanded .outing-visual {
    inset: 0;
}

.outing-shell.chat-expanded .outing-camera-btn {
    bottom: calc(62% + 18px);
}

.outing-shell.chat-expanded .outing-conversation {
    height: 62%;
}

.outing-status-pill {
    position: absolute;
    top: 54px;
    right: 12px;
    z-index: 24;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(46vw, 190px);
    padding: 7px 8px 7px 10px;
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 999px;
    background: rgba(17,24,39,0.54);
    color: #fff;
    box-shadow: 0 8px 20px rgba(15,23,42,0.16);
    backdrop-filter: blur(12px);
}

@media (max-width: 640px) {
    .outing-status-pill {
        top: 64px;
        right: 8px;
        max-width: none;
        gap: 5px;
        padding: 5px 6px;
        border-radius: 18px;
        background: rgba(17,24,39,0.46);
    }

    .outing-status-pill > div:first-child {
        display: none;
    }

    .outing-tts-autoplay-toggle {
        padding: 6px 8px;
        font-size: 0.64rem;
    }

    .outing-tts-autoplay-toggle span:first-child {
        display: none;
    }

    .outing-status-pill .outing-mini-btn {
        padding: 6px 8px;
        font-size: 0.64rem;
    }
}

.outing-companion-name {
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.1;
}

.outing-companion-state,
.outing-album-sub {
    margin-top: 2px;
    color: rgba(255,255,255,0.72);
    font-size: 0.62rem;
    line-height: 1.1;
}

.outing-mini-btn {
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    padding: 6px 9px;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.outing-chat-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 44px 18px 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 7px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.outing-chat-log::-webkit-scrollbar {
    display: none;
}

.outing-line {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.55;
    text-shadow: 0 1px 4px rgba(0,0,0,0.68);
    word-break: break-word;
}

.outing-line.loading {
    min-height: 24px;
    display: flex;
    align-items: center;
    padding-left: 1px;
}

.outing-speaker {
    color: #ff8ab5;
    font-weight: 600;
}

.outing-line.user .outing-speaker {
    color: #ffd1e0;
}

.outing-text {
    color: #fff;
}

.outing-tts-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.7;
    padding: 0 0 0 6px;
    vertical-align: middle;
    line-height: 1;
}
.outing-tts-btn:disabled {
    cursor: default;
    opacity: 0.35;
}

.tts-autoplay-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(0,0,0,0.36);
    color: rgba(255,255,255,0.86);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    white-space: nowrap;
}

.tts-autoplay-toggle.is-on {
    border-color: rgba(255,96,160,0.72);
    background: rgba(255,96,160,0.9);
    color: #fff;
    box-shadow: 0 6px 16px rgba(255,96,160,0.22);
}

.outing-tts-autoplay-toggle {
    padding: 7px 10px;
    font-size: 0.68rem;
    margin-left: auto;
}

.outing-ellipsis {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 3px;
}

.date-ellipsis {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 3px;
    vertical-align: middle;
}

.outing-ellipsis span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f9fafb;
    opacity: 0.28;
    animation: outing-ellipsis-pulse 1.15s infinite ease-in-out;
}

.date-ellipsis span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f9fafb;
    opacity: 0.28;
    animation: outing-ellipsis-pulse 1.15s infinite ease-in-out;
}

.outing-ellipsis span:nth-child(2) {
    animation-delay: 0.16s;
}

.outing-ellipsis span:nth-child(3) {
    animation-delay: 0.32s;
}

.date-ellipsis span:nth-child(2) {
    animation-delay: 0.16s;
}

.date-ellipsis span:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes outing-ellipsis-pulse {
    0%, 80%, 100% {
        transform: translateY(0) scale(0.7);
        opacity: 0.28;
    }
    40% {
        transform: translateY(-3px) scale(1);
        opacity: 1;
    }
}

.outing-photo-thumb {
    align-self: flex-end;
    width: min(42vw, 170px);
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.16);
}

.outing-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(15,23,42,0.68);
    backdrop-filter: blur(10px);
}

.outing-input-row textarea {
    flex: 1;
    min-width: 0;
    height: 38px;
    min-height: 38px;
    max-height: 132px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    padding: 8px 13px;
    outline: none;
    font-size: 0.9rem;
    line-height: 1.45;
    resize: none;
    overflow-y: hidden;
    font-family: inherit;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.outing-input-row textarea:focus {
    border-color: var(--primary);
}

.outing-input-row button {
    min-width: 58px;
    height: 38px;
    border: none;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 650;
}

.outing-album-panel {
    padding: 58px 14px 18px;
    background: #f8fafc;
    color: #111827;
    overflow-y: auto;
}

.outing-album-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.outing-album-title {
    font-weight: 650;
    font-size: 1rem;
}

.outing-album-panel .outing-mini-btn {
    background: #111827;
    color: #fff;
}

.outing-album-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.outing-album-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    border: none;
    padding: 0;
    background: #e5e7eb;
    cursor: pointer;
}

.outing-album-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.outing-album-empty {
    grid-column: 1 / -1;
    padding: 44px 12px;
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
}

.outing-photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 7000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.88);
}

.outing-photo-viewer.is-open {
    display: flex;
}

.outing-photo-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.outing-photo-viewer-close {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: 14px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(12px);
}

.outing-plan-panel {
    padding: 58px 14px 18px;
    background: #f8fafc;
    color: #111827;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.outing-plan-panel .outing-mini-btn {
    background: #111827;
    color: #fff;
}

.outing-plan-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.outing-plan-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #374151;
}

.outing-plan-form input,
.outing-plan-form select,
.outing-plan-form textarea {
    width: 100%;
    border: 1px solid #d7dce5;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    padding: 10px 11px;
    font-size: 0.9rem;
    line-height: 1.45;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}

.outing-plan-form select {
    min-height: 44px;
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%), linear-gradient(135deg, #6b7280 50%, transparent 50%);
    background-position: calc(100% - 18px) 19px, calc(100% - 12px) 19px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.outing-plan-form input:focus,
.outing-plan-form select:focus,
.outing-plan-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 94, 148, 0.14);
}

.outing-plan-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.outing-plan-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.outing-ticket-locked-card {
    border: 1.5px solid #e0d4f7;
    border-radius: 10px;
    background: #f8f4ff;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.outing-ticket-locked-card[hidden] {
    display: none;
}

.outing-ticket-locked-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.outing-ticket-locked-label {
    font-size: 0.78rem;
    color: #7c6fa0;
    min-width: 70px;
    flex-shrink: 0;
}

.outing-ticket-locked-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2d1b5e;
}

.outing-ticket-locked-note {
    font-size: 0.72rem;
    color: #a89cc4;
    margin-top: 2px;
}

#outing-companion-select-wrap[hidden],
#outing-type-grade-select-wrap[hidden] {
    display: none;
}

.outing-international-checklist {
    border: 1px solid #d7dce5;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.outing-international-checklist[hidden] {
    display: none;
}

.outing-checklist-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.outing-checklist-title {
    font-size: 0.92rem;
    font-weight: 650;
    color: #111827;
}

.outing-checklist-sub {
    margin-top: 3px;
    color: #6b7280;
    font-size: 0.72rem;
    line-height: 1.45;
    font-weight: 500;
}

.outing-premium-badge {
    border-radius: 999px;
    padding: 4px 8px;
    background: #eef2f7;
    color: #475569;
    font-size: 0.64rem;
    font-weight: 600;
    white-space: nowrap;
}

.outing-premium-badge.is-premium {
    background: rgba(255, 95, 158, 0.12);
    color: #db2777;
}

.outing-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.outing-plan-form .outing-check-grid label {
    flex-direction: row;
    align-items: center;
    gap: 7px;
    font-weight: 500;
    font-size: 0.76rem;
    color: #374151;
}

.outing-plan-form .outing-check-grid input {
    width: 16px;
    height: 16px;
    padding: 0;
    accent-color: var(--primary);
}

.outing-plan-note-label {
    margin-top: 0;
}

.outing-plan-archive-wrap {
    margin-top: 14px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.outing-plan-archive-head {
    margin: 0 0 8px;
    font-size: 0.82rem;
    font-weight: 650;
    color: #111827;
}

.outing-plan-archive {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.outing-plan-archive-empty {
    padding: 14px 12px;
    border: 1px dashed #cfd5df;
    border-radius: 8px;
    color: #6b7280;
    font-size: 0.84rem;
    text-align: center;
}

.outing-plan-archive-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
}

.outing-plan-archive-main,
.outing-plan-archive-delete {
    border: 1px solid #d7dce5;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font: inherit;
}

.outing-plan-archive-main {
    min-width: 0;
    padding: 10px 11px;
    text-align: left;
}

.outing-plan-archive-delete {
    padding: 0 10px;
    color: #6b7280;
    font-size: 0.78rem;
    font-weight: 600;
}

.outing-plan-archive-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 650;
}

.outing-plan-archive-meta {
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #6b7280;
    font-size: 0.76rem;
}

.outing-calendar-panel {
    padding: 58px 14px 18px;
    background: #f8fafc;
    color: #111827;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.outing-calendar-panel .outing-mini-btn {
    background: #111827;
    color: #fff;
}

.outing-calendar-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.outing-calendar-month {
    margin: 10px 0 2px;
    color: #6b7280;
    font-size: 0.76rem;
    font-weight: 600;
}

.outing-calendar-item {
    display: grid;
    grid-template-columns: 62px 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 58px;
    border: 1px solid #dde3ec;
    border-radius: 8px;
    background: #fff;
    padding: 9px 10px;
    box-shadow: 0 8px 20px rgba(15,23,42,0.04);
}

.outing-calendar-date {
    color: #6b7280;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}

.outing-calendar-badge {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 650;
    letter-spacing: 0;
}

.outing-calendar-item.type-plan .outing-calendar-badge {
    background: #ff5f9e;
}

.outing-calendar-item.type-date .outing-calendar-badge {
    background: #7c5cff;
}

.outing-calendar-item.type-outing .outing-calendar-badge,
.outing-calendar-item.type-photo .outing-calendar-badge {
    background: #0f766e;
}

.outing-calendar-body {
    min-width: 0;
}

.outing-calendar-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 650;
    color: #111827;
}

.outing-calendar-sub {
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #6b7280;
    font-size: 0.76rem;
    line-height: 1.3;
}

.outing-calendar-empty {
    padding: 26px 12px;
    border: 1px dashed #cfd5df;
    border-radius: 8px;
    color: #6b7280;
    font-size: 0.84rem;
    text-align: center;
    background: #fff;
}

@media (min-width: 520px) {
    .outing-plan-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .outing-plan-choice-grid,
    .outing-check-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
.tv2-freetalk-next-btn {
    background: var(--primary, #e06);
    border: none;
    border-radius: 20px;
    color: #fff;
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0;
}

.tv2-freetalk-next-btn:disabled {
    opacity: 0.6;
    cursor: default;
}
