/* =====================================================
   模拟支教体验游戏 · 样式表
   设计风格：温暖水彩 / 剪贴簿质感 / 移动端优先
   ===================================================== */

:root {
    --bg-cream: #FDF6EC;
    --bg-warm: #F5E6D0;
    --bg-paper: #FFF9F0;
    --text-primary: #4A3728;
    --text-secondary: #7D6B5D;
    --text-muted: #B5A48E;
    --accent-green: #7EC8A0;
    --accent-orange: #E8A87C;
    --accent-blue: #85B8CB;
    --accent-pink: #F5A6A6;
    --san-color: #E57373;
    --voice-color: #64B5F6;
    --dialogue-bg: rgba(255, 249, 240, 0.97);
    --dialogue-bg-solid: #FFF8EE;
    --shadow-sm: 0 2px 6px rgba(74, 55, 40, 0.08);
    --shadow-md: 0 4px 16px rgba(74, 55, 40, 0.12);
    --shadow-lg: 0 8px 32px rgba(74, 55, 40, 0.16);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --font-body: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    --font-diary: 'STKaiti', 'KaiTi', 'Kaiti SC', serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    /* Game layout: these two values must be kept in sync */
    --dialogue-h: 52%;      /* height of dialogue panel from bottom */
    --status-bar-h: 48px;   /* approximate height of top status bar */
}

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

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-cream);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

/* =====================================================
   首页 (index)
   ===================================================== */

.index-page {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

.index-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.85);
    z-index: 0;
}

.index-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(180deg, rgba(253, 246, 236, 0.2) 0%, rgba(253, 246, 236, 0.85) 50%, rgba(253, 246, 236, 0.95) 100%);
    display: flex;
    align-items: flex-end;
    padding: 2rem 1.5rem calc(2rem + var(--safe-bottom));
}

.index-content {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
}

.index-title {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.5);
}

.index-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.index-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    letter-spacing: 0.1em;
}

.gender-select {
    margin-bottom: 2rem;
}

.gender-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.gender-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.gender-btn {
    flex: 1;
    max-width: 150px;
    padding: 1rem;
    background: var(--bg-paper);
    border: 2px solid #E0D5C5;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.gender-icon {
    font-size: 1.8rem;
    line-height: 1;
}

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

.gender-btn.selected {
    background: var(--accent-green);
    color: #fff;
    border-color: var(--accent-green);
    box-shadow: var(--shadow-md);
}

.start-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent-orange) 0%, #DC8B5C 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.start-btn:not(:disabled):active {
    transform: scale(0.98);
    box-shadow: var(--shadow-sm);
}

.start-btn:disabled {
    background: #D9CCBC;
    cursor: not-allowed;
    box-shadow: none;
}

/* =====================================================
   游戏页面 (game)
   ===================================================== */

.game-viewport {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    overflow: hidden;
    /* Match dialogue panel color so any exposed gaps are invisible */
    background: var(--dialogue-bg-solid);
}

/* Status bars — sit on top of everything, height sets --status-bar-h */
.status-bars {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: calc(0.5rem + var(--safe-top)) 1rem 0.5rem;
    min-height: var(--status-bar-h);
    background: rgba(255, 249, 240, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
}

.status-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 6px;
    background: #E8E0D4;
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-fill.san {
    background: linear-gradient(90deg, var(--san-color), #EF9A9A);
}

.bar-fill.voice {
    background: linear-gradient(90deg, var(--voice-color), #90CAF9);
}

.status-value {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 1.6rem;
    text-align: right;
}

.progress-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.2rem 0.6rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    flex-shrink: 0;
}

/* Background layer.
   Height covers only the scene area (above the card at its resting position) plus
   a small gradient overlap zone. Keeping this div short prevents background-size:cover
   from having to fill the full portrait viewport with a landscape image — which would
   crop too much off the sides. When the card is dragged up the cream-colored viewport
   background shows beneath this div seamlessly (same color as the card). */
.vn-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: calc(100% - var(--dialogue-h) + 10%);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.25s ease;
}

/* Gradient fades the scene into the card color at the bottom overlap zone. */
.vn-background::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 42%;
    background: linear-gradient(
        180deg,
        rgba(255, 248, 238, 0)    0%,
        rgba(255, 248, 238, 0.4)  40%,
        rgba(255, 248, 238, 0.82) 72%,
        var(--dialogue-bg-solid)  92%,
        var(--dialogue-bg-solid)  100%
    );
    pointer-events: none;
}

/* Character sprites layer.
   Bottom is anchored to the TOP of the dialogue panel via --dialogue-h.
   Characters hang down from here so their feet sit right at the panel edge. */
.vn-characters {
    position: absolute;
    bottom: var(--dialogue-h);
    left: 0;
    right: 0;
    /* Reach from status bar to dialogue panel top */
    height: calc(100% - var(--dialogue-h) - var(--status-bar-h));
    z-index: 20;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    pointer-events: none;
    padding: 0 1rem;
    /* Allow characters to overflow upward into the scene area */
    overflow: visible;
}

.vn-character {
    /* Height relative to viewport so tall PNGs don't get clipped */
    max-height: 44vh;
    max-width: 40%;
    width: auto;
    object-fit: contain;
    object-position: bottom center;
    opacity: 0;
    animation: char-enter 0.45s ease forwards;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.18));
    flex-shrink: 0;
}

.vn-character.pos-center {
    max-width: 52%;
    max-height: 46vh;
}

/* 3-character scene: reduce sizes so left+center+right all fit on narrow screens */
.vn-characters.chars-3 .vn-character {
    max-width: 28%;
    max-height: 38vh;
}

.vn-characters.chars-3 .vn-character.pos-center {
    max-width: 36%;
    max-height: 40vh;
}

@keyframes char-enter {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}

.vn-character.pos-left  { animation-name: char-enter-left; }
.vn-character.pos-right { animation-name: char-enter-right; }

@keyframes char-enter-left {
    from { opacity: 0; transform: translate(-24px, 20px); }
    to   { opacity: 1; transform: translate(0, 0); }
}

@keyframes char-enter-right {
    from { opacity: 0; transform: translate(24px, 20px); }
    to   { opacity: 1; transform: translate(0, 0); }
}

/* Dialogue panel — bottom sheet card.
   `top` is set dynamically by JS; stretches from there to bottom: 0.
   Characters are anchored at --dialogue-h so they sit at the card's resting edge. */
.dialogue-panel {
    position: absolute;
    /* top injected by JS (initial = 48% of viewport height) */
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--dialogue-bg-solid);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -8px 32px rgba(74, 55, 40, 0.14);
    transition: top 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: top;
}

/* Drag handle pill */
.drag-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0 6px;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;     /* let JS own this touch, don't scroll */
    -webkit-user-select: none;
    user-select: none;
}
.drag-handle:active { cursor: grabbing; }

.drag-pill {
    width: 36px;
    height: 4px;
    background: #D0C5B5;
    border-radius: 2px;
}

/* Inner scrollable area */
.panel-scroll {
    flex: 1;
    min-height: 0;           /* allow flex child to shrink below content size */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0 1.25rem calc(1rem + var(--safe-bottom));
}

.scene-title-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.625rem;
    border-bottom: 1px dashed #E0D5C5;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.scene-icon {
    font-size: 1rem;
}

#scene-title {
    font-weight: 700;
    color: var(--text-primary);
}

.scene-time {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 0.15rem 0.6rem;
    background: rgba(232, 168, 124, 0.15);
    color: var(--accent-orange);
    border-radius: 20px;
    flex-shrink: 0;
}

.dialogue-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 1rem;
    min-height: 3em;
    font-weight: 500;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.option-card {
    background: #fff;
    border: 1.5px solid #E8DDC9;
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(8px);
    animation: opt-enter 0.35s ease forwards;
    position: relative;
    overflow: hidden;
}

.option-card:active {
    transform: scale(0.97);
    background: #FFF9F0;
}

.option-card.selected {
    border-color: var(--accent-green);
    background: #F0FAF4;
    pointer-events: none;
}

.option-card.disabled {
    opacity: 0.4;
    pointer-events: none;
}

@keyframes opt-enter {
    to { opacity: 1; transform: translateY(0); }
}

.option-text {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 0.2rem;
}

.option-subtext {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: normal;
    line-height: 1.3;
}

.option-card.special-flag::before {
    content: '✨';
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
    font-size: 0.85rem;
}

/* Reaction overlay */
.reaction-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fade-in 0.25s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.reaction-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.reaction-sprite {
    max-width: 60%;
    max-height: 50vh;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.25));
}

.reaction-bubble {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 1rem 1.4rem;
    font-size: 1rem;
    color: var(--text-primary);
    max-width: 90%;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
}

.reaction-bubble::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #fff;
}

/* Loading state */
.game-loading {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: var(--bg-cream);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #E8DDC9;
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.game-loading.hidden {
    display: none;
}

/* Bar shake effect */
.bar-fill.shake {
    animation: bar-shake 0.5s ease;
}

@keyframes bar-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* =====================================================
   结果页面 (result)
   ===================================================== */

.result-page {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem calc(2rem + var(--safe-bottom));
    background: var(--bg-cream);
    min-height: 100vh;
}

.result-hero {
    text-align: center;
    padding: 2rem 1rem 2.5rem;
    background:
        linear-gradient(180deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.22) 100%),
        linear-gradient(135deg, var(--theme-color, #7EC8A0) 0%, rgba(255,255,255,0) 130%);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    color: #fff;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.result-hero::before {
    content: '';
    position: absolute;
    top: -50%; left: -20%;
    width: 80%; height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.result-code-badge {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    padding: 0.3rem 1rem;
    background: rgba(0,0,0,0.18);
    border-radius: 20px;
    margin-bottom: 0.75rem;
    backdrop-filter: blur(8px);
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.result-name {
    font-size: 2.2rem;
    font-weight: 800;
    text-shadow: 0 2px 16px rgba(0,0,0,0.45), 0 1px 4px rgba(0,0,0,0.25);
    margin-bottom: 0.625rem;
}

.result-tagline {
    font-size: 0.95rem;
    line-height: 1.5;
    opacity: 1;
    max-width: 320px;
    margin: 0 auto 1.25rem;
    text-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

.result-letter-code {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
}

.letter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border: 1.5px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    backdrop-filter: blur(8px);
}

.result-section {
    margin-bottom: 1.75rem;
    padding: 1.25rem;
    background: var(--bg-paper);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.875rem;
    display: flex;
    align-items: center;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--theme-color, var(--accent-green));
    border-radius: 2px;
    margin-right: 0.5rem;
}

.result-description {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Radar chart */
.radar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    /* Allow SVG labels that use overflow="visible" to bleed outside */
    overflow: visible;
    padding: 0 4px;
}

.radar-container svg {
    max-width: 100%;
    height: auto;
    overflow: visible;
}

.dimension-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #E8DDC9;
}

.dim-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.82rem;
}

.dim-name {
    width: 60px;
    color: var(--text-secondary);
    font-weight: 600;
    flex-shrink: 0;
}

.dim-bar {
    flex: 1;
    height: 6px;
    background: #E8E0D4;
    border-radius: 3px;
    overflow: hidden;
    display: block;
    position: relative;
}

.dim-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease;
}

.dim-pole {
    width: 36px;
    text-align: right;
    color: var(--text-primary);
    font-weight: 600;
    flex-shrink: 0;
    font-size: 0.78rem;
}

/* Diary */
.diary-paper {
    position: relative;
    background: #FFFEF5;
    background-image:
        repeating-linear-gradient(180deg, transparent, transparent 28px, #F0E5D5 28px, #F0E5D5 29px);
    padding: 1.5rem 1.25rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm), inset 0 0 0 1px #F0E5D5;
    transform: rotate(-0.5deg);
    margin: 1rem 0;
}

.diary-tape {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 80px;
    height: 18px;
    background: rgba(232, 168, 124, 0.6);
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.diary-text {
    font-family: var(--font-diary);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-primary);
    text-indent: 2em;
}

.diary-sign {
    text-align: right;
    margin-top: 0.75rem;
    font-family: var(--font-diary);
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Relations */
.relations {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.relation-card {
    text-align: center;
    padding: 1rem 0.75rem;
    border-radius: var(--radius-md);
    background: #fff;
    border: 2px dashed #E8DDC9;
}

.relation-card.soulmate {
    border-color: var(--accent-pink);
    background: #FFF5F5;
}

.relation-card.nemesis {
    border-color: #B19CD9;
    background: #F8F4FF;
}

.relation-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    letter-spacing: 0.1em;
}

.relation-code {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    letter-spacing: 0.05em;
}

.relation-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Action buttons */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-top: 1.5rem;
}

.action-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: block;
    transition: all 0.2s ease;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--theme-color, var(--accent-green)) 0%, rgba(0,0,0,0.1) 200%);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.action-btn.secondary {
    background: var(--bg-paper);
    color: var(--text-primary);
    border: 1.5px solid #E0D5C5;
}

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

/* =====================================================
   海报 (poster - hidden, rendered by html2canvas)
   ===================================================== */

.poster-template {
    position: fixed;
    top: -10000px;
    left: -10000px;
    width: 750px;
    height: 1100px;
    pointer-events: none;
    z-index: -1;
}

.poster-inner {
    width: 100%;
    height: 100%;
    background: var(--bg-paper);
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(232, 168, 124, 0.15) 39px, rgba(232, 168, 124, 0.15) 40px);
    padding: 60px 50px;
    box-sizing: border-box;
    position: relative;
    border: 8px solid var(--theme-color, #7EC8A0);
    border-radius: 30px;
    font-family: var(--font-body);
}

.poster-header {
    text-align: center;
    padding-bottom: 30px;
    border-bottom: 3px dashed var(--theme-color);
    margin-bottom: 40px;
}

.poster-title {
    font-size: 42px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

.poster-org {
    font-size: 18px;
    color: var(--text-secondary);
    letter-spacing: 0.2em;
}

.poster-body {
    display: flex;
    gap: 40px;
    margin-bottom: 30px;
}

.poster-photo {
    width: 200px;
    height: 260px;
    background: var(--theme-color);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.poster-code {
    font-size: 56px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.05em;
}

.poster-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    justify-content: center;
}

.poster-row {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.poster-key {
    font-size: 18px;
    color: var(--text-secondary);
    width: 60px;
    flex-shrink: 0;
    border-right: 2px solid var(--theme-color);
    padding-right: 12px;
}

.poster-val {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 700;
}

.poster-tagline {
    text-align: center;
    font-size: 22px;
    font-style: italic;
    color: var(--theme-color);
    padding: 20px;
    border-top: 1px dashed #C0B5A0;
    border-bottom: 1px dashed #C0B5A0;
    margin-bottom: 30px;
    line-height: 1.5;
}

.poster-diary {
    font-family: var(--font-diary);
    font-size: 19px;
    line-height: 1.8;
    color: var(--text-primary);
    text-indent: 2em;
    margin-bottom: 30px;
}

.poster-footer {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 16px;
    color: var(--text-muted);
    letter-spacing: 0.2em;
}

/* =====================================================
   隐藏结局 (hidden ending)
   ===================================================== */

.hidden-ending {
    position: relative;
    min-height: 100vh;
    color: #fff;
    padding: 0;
}

.hidden-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.4) blur(2px);
    z-index: 0;
}

.hidden-content {
    position: relative;
    z-index: 1;
    padding: 3rem 1.5rem calc(3rem + var(--safe-bottom));
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hidden-warning {
    text-align: center;
    font-size: 0.85rem;
    letter-spacing: 0.3em;
    color: #FFC107;
    margin-bottom: 1.5rem;
}

.hidden-title {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.75rem;
    text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.hidden-subtitle {
    text-align: center;
    font-size: 1rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 2rem;
}

.hidden-desc {
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.9);
    margin-bottom: 1.5rem;
    background: rgba(0,0,0,0.4);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    backdrop-filter: blur(8px);
}

.hidden-ending .diary-paper {
    color: var(--text-primary);
}

/* =====================================================
   适配
   ===================================================== */

@media (min-width: 600px) {
    body {
        background: #E8DDC9;
    }
    .game-viewport {
        box-shadow: var(--shadow-lg);
        height: 100vh;
        max-height: 920px;
        margin-top: 20px;
        margin-bottom: 20px;
        border-radius: var(--radius-lg);
        /* Clip children (background, panel) to the rounded corners */
        overflow: hidden;
    }
    /* On desktop: top corners stay rounded (same as mobile), bottom corners match viewport */
    .dialogue-panel {
        border-radius: 22px 22px var(--radius-lg) var(--radius-lg);
    }
}
