/* === 《歧路》视觉设计系统 — 电影级剧情游戏 === */
:root {
    --bg-deep: #060a12;
    --bg-panel: rgba(8, 12, 22, 0.88);
    --bg-choice: rgba(14, 20, 35, 0.92);
    --gold: #d4a843;
    --gold-dim: #8a7032;
    --red: #c1272d;
    --red-glow: #ff3a3a;
    --green: #2ecc71;
    --blue: #3498db;
    --text: #e8e0d0;
    --text-dim: #8a8578;
    --text-bright: #fff;
    --serif: 'Noto Serif SC', 'Songti SC', serif;
    --sans: 'Noto Sans SC', sans-serif;
    --shadow: 0 4px 30px rgba(0,0,0,0.6);
    --radius: 6px;
}
* { margin:0; padding:0; box-sizing:border-box; }
html, body { width:100%; height:100%; overflow:hidden; background: var(--bg-deep); color: var(--text); }

/* === Cinematic Layers === */
#bg-layer {
    position: fixed; inset: 0; z-index: 0;
    background-size: cover; background-position: center;
    transition: background-image 1.2s ease, filter 0.8s ease;
    filter: brightness(0.7) saturate(0.9);
    background-image: url('../assets/images/bg_title.jpg');
}
#vignette {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.7) 100%);
}
#grain {
    position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* === Screens === */
.screen { position: fixed; inset: 0; z-index: 10; display: none; }
.screen.active { display: flex; }

/* === Backgrounds (CSS Art) === */
.bg-office {
    background: linear-gradient(160deg, #0d1520 0%, #1a2332 40%, #13192a 100%);
}
.bg-office::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 75% 30%, rgba(255,200,100,0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 20% 80%, rgba(100,130,200,0.05) 0%, transparent 40%);
}
.bg-club {
    background: linear-gradient(135deg, #1a0a12 0%, #2d1020 40%, #1a0515 100%);
}
.bg-club::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 40%, rgba(200,50,80,0.1) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 70%, rgba(180,100,50,0.06) 0%, transparent 40%);
}
.bg-home {
    background: linear-gradient(145deg, #1a1510 0%, #2a2118 40%, #1f1a12 100%);
}
.bg-home::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(255,220,150,0.1) 0%, transparent 50%);
}
.bg-restaurant {
    background: linear-gradient(150deg, #1a1008 0%, #2d1f0e 40%, #1a1208 100%);
}
.bg-restaurant::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(255,180,80,0.12) 0%, transparent 45%),
                radial-gradient(ellipse at 20% 30%, rgba(200,100,30,0.06) 0%, transparent 30%);
}
.bg-meeting {
    background: linear-gradient(160deg, #121518 0%, #1e2228 40%, #15181e 100%);
}
.bg-meeting::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 20%, rgba(200,210,230,0.08) 0%, transparent 50%);
}
.bg-construction {
    background: linear-gradient(155deg, #1a1610 0%, #2a2418 40%, #1a1812 100%);
}
.bg-street {
    background: linear-gradient(170deg, #080c14 0%, #0f1520 50%, #0a0e18 100%);
}
.bg-street::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 60%, rgba(100,120,180,0.06) 0%, transparent 40%);
}
.bg-court {
    background: linear-gradient(160deg, #1a1c20 0%, #282c32 40%, #1e2025 100%);
}
.bg-court::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(220,220,240,0.1) 0%, transparent 50%);
}
.bg-park {
    background: linear-gradient(155deg, #0a1210 0%, #152018 40%, #0d1512 100%);
}

/* === Title Screen === */
#title-screen {
    flex-direction: column; align-items: center; justify-content: center;
    background: linear-gradient(170deg, #060a12 0%, #0f1520 50%, #0a0510 100%);
    z-index: 100;
}
.title-badge {
    font-family: var(--sans); font-size: 13px; letter-spacing: 6px; color: var(--gold-dim);
    border: 1px solid var(--gold-dim); padding: 6px 24px; margin-bottom: 30px;
    text-transform: uppercase;
}
.title-main {
    font-family: var(--serif); font-size: 120px; font-weight: 900;
    color: var(--text); letter-spacing: 20px; line-height: 1;
    text-shadow: 0 0 60px rgba(212,168,67,0.15);
}
.title-accent { color: var(--gold); }
.title-sub {
    font-family: var(--serif); font-size: 18px; color: var(--text-dim);
    letter-spacing: 8px; margin-top: 12px;
}
.title-desc {
    max-width: 480px; text-align: center; margin: 40px 0 20px;
    font-family: var(--sans); font-size: 15px; line-height: 2;
    color: var(--text-dim); border-left: 2px solid var(--gold-dim); padding-left: 20px;
    text-align: left;
}
.title-desc strong { color: var(--gold); }
.title-controls {
    margin-bottom: 40px;
}
.control-hint {
    font-family: var(--sans); font-size: 12px; color: var(--text-dim);
    letter-spacing: 2px; opacity: 0.6;
}
.btn-cinematic {
    font-family: var(--serif); font-size: 18px; color: var(--text);
    background: transparent; border: 1px solid var(--gold-dim);
    padding: 14px 60px; cursor: pointer; letter-spacing: 6px;
    transition: all 0.4s ease; display: block; margin: 8px auto;
}
.btn-cinematic:hover {
    background: var(--gold); color: var(--bg-deep); border-color: var(--gold);
    box-shadow: 0 0 30px rgba(212,168,67,0.3);
}
.btn-secondary { font-size: 14px; padding: 10px 40px; border-color: var(--text-dim); }
.btn-secondary:hover { background: var(--text-dim); border-color: var(--text-dim); }
.hidden { display: none !important; }

/* === HUD === */
#hud {
    position: fixed; top: 0; left: 0; right: 0; z-index: 20;
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 30px;
    background: linear-gradient(to bottom, rgba(6,10,18,0.8) 0%, transparent 100%);
    pointer-events: none;
}
#hud-chapter {
    font-family: var(--serif); font-size: 14px; color: var(--gold-dim);
    letter-spacing: 4px;
}
#hud-integrity {
    display: flex; align-items: center; gap: 10px;
}
.integrity-label { font-family: var(--sans); font-size: 11px; color: var(--text-dim); letter-spacing: 2px; }
.integrity-bar {
    width: 120px; height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden;
}
.integrity-fill {
    height: 100%; width: 100%; background: var(--green); border-radius: 2px;
    transition: width 1s ease, background 1s ease;
}
.integrity-fill.warn { background: #f39c12; }
.integrity-fill.danger { background: var(--red); }
.integrity-value { font-family: var(--sans); font-size: 13px; color: var(--text-dim); min-width: 28px; text-align: right; }

/* === Speaker Area === */
#speaker-area {
    position: fixed; bottom: 190px; left: 50px; z-index: 21;
}
.speaker-plate {
    display: none; align-items: center; gap: 10px;
    background: var(--bg-panel); border-left: 3px solid var(--gold);
    padding: 8px 20px; font-family: var(--serif);
    animation: fadeInUp 0.3s ease;
}
.speaker-plate.visible { display: flex; }
.speaker-icon { font-size: 18px; }
.speaker-name { font-size: 15px; color: var(--gold); letter-spacing: 2px; }

/* === Dialogue Panel === */
#dialogue-panel {
    position: fixed; bottom: 30px; left: 40px; right: 40px; z-index: 21;
    background: var(--bg-panel); border: 1px solid rgba(212,168,67,0.12);
    border-radius: var(--radius); padding: 30px 40px 20px;
    min-height: 140px; backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    animation: fadeInUp 0.4s ease;
}
#dialogue-text {
    font-family: var(--serif); font-size: 17px; line-height: 2;
    color: var(--text); white-space: pre-wrap;
}
#dialogue-text .thought { color: var(--text-dim); font-style: italic; }
#dialogue-text .narration { color: var(--text); }
#dialogue-text .emphasis { color: var(--gold); font-weight: 700; }
#dialogue-text .warning { color: var(--red); font-weight: 700; }
#advance-hint {
    text-align: right; font-family: var(--sans); font-size: 11px;
    color: var(--text-dim); margin-top: 12px; opacity: 0;
    animation: blink 1.5s ease-in-out infinite;
    animation-delay: 0.5s;
}
#advance-hint.visible { opacity: 1; }

/* === Choice Panel === */
#choice-panel {
    position: fixed; inset: 0; z-index: 30;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(6,10,18,0.75); backdrop-filter: blur(6px);
    animation: fadeIn 0.5s ease;
}
.choice-title {
    font-family: var(--serif); font-size: 14px; color: var(--gold-dim);
    letter-spacing: 6px; margin-bottom: 30px;
}
#choice-list { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 600px; padding: 0 30px; }
.choice-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--bg-choice); border: 1px solid rgba(212,168,67,0.1);
    border-radius: var(--radius); padding: 18px 24px;
    cursor: pointer; transition: all 0.35s ease;
    animation: slideInLeft 0.4s ease backwards;
}
.choice-card:nth-child(1) { animation-delay: 0.1s; }
.choice-card:nth-child(2) { animation-delay: 0.2s; }
.choice-card:nth-child(3) { animation-delay: 0.3s; }
.choice-card:hover {
    border-color: var(--gold); background: rgba(212,168,67,0.08);
    transform: translateX(8px); box-shadow: 0 0 20px rgba(212,168,67,0.1);
}
.choice-card:active { transform: scale(0.98) translateX(8px); }
.choice-key {
    font-family: var(--sans); font-size: 13px; font-weight: 700;
    color: var(--gold); width: 28px; height: 28px;
    border: 1px solid var(--gold-dim); border-radius: 4px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.choice-text {
    font-family: var(--serif); font-size: 15px; color: var(--text); line-height: 1.6;
}
.choice-card.selected { border-color: var(--gold); background: rgba(212,168,67,0.15); }
.choice-card.faded { opacity: 0.3; pointer-events: none; }

/* === Regulation Panel === */
#regulation-panel {
    position: fixed; inset: 0; z-index: 35;
    display: flex; align-items: center; justify-content: center;
    background: rgba(6,10,18,0.8); backdrop-filter: blur(8px);
    animation: fadeIn 0.5s ease;
}
#regulation-panel > * { max-width: 560px; }
.reg-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
}
.reg-icon { font-size: 28px; color: var(--gold); }
.reg-title { font-family: var(--serif); font-size: 20px; color: var(--gold); letter-spacing: 3px; }
.reg-article {
    font-family: var(--serif); font-size: 14px; color: var(--text-dim);
    letter-spacing: 1px; margin-bottom: 16px; padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.reg-content {
    font-family: var(--sans); font-size: 15px; color: var(--text); line-height: 2;
    background: rgba(255,255,255,0.03); padding: 20px 24px; border-radius: var(--radius);
    border-left: 3px solid var(--gold-dim);
}
.reg-dismiss {
    text-align: center; font-family: var(--sans); font-size: 11px;
    color: var(--text-dim); margin-top: 24px; opacity: 0.6;
    animation: blink 1.5s ease-in-out infinite;
}

/* === Chapter Transition === */
#chapter-transition {
    position: fixed; inset: 0; z-index: 50;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--bg-deep);
}
#chapter-transition.visible { display: flex; }
.ct-chapter {
    font-family: var(--sans); font-size: 13px; color: var(--gold-dim);
    letter-spacing: 8px; margin-bottom: 16px;
    animation: fadeInUp 0.8s ease;
}
.ct-title {
    font-family: var(--serif); font-size: 42px; color: var(--text);
    letter-spacing: 8px; margin-bottom: 20px;
    animation: fadeInUp 0.8s ease 0.2s backwards;
}
.ct-desc {
    font-family: var(--sans); font-size: 14px; color: var(--text-dim);
    letter-spacing: 2px; max-width: 400px; text-align: center; line-height: 1.8;
    animation: fadeInUp 0.8s ease 0.4s backwards;
}

/* === Ending Screen === */
#ending-screen {
    flex-direction: column; align-items: center; justify-content: center;
    background: linear-gradient(170deg, #060a12 0%, #0f1520 50%, #0a0510 100%);
    z-index: 100; overflow-y: auto;
}
.ending-content { max-width: 560px; text-align: center; padding: 40px 20px; }
.ending-icon { font-size: 60px; margin-bottom: 16px; animation: fadeInUp 0.6s ease; }
.ending-type {
    font-family: var(--serif); font-size: 32px; color: var(--text);
    letter-spacing: 6px; animation: fadeInUp 0.6s ease 0.1s backwards;
}
.ending-title {
    font-family: var(--sans); font-size: 14px; color: var(--text-dim);
    letter-spacing: 3px; margin: 8px 0 30px;
    animation: fadeInUp 0.6s ease 0.2s backwards;
}
.ending-story {
    font-family: var(--serif); font-size: 15px; color: var(--text);
    line-height: 2.2; text-align: left; margin-bottom: 30px;
    border-left: 2px solid var(--gold-dim); padding-left: 20px;
    animation: fadeInUp 0.6s ease 0.3s backwards;
}
.ending-stats {
    display: flex; justify-content: center; gap: 30px; margin-bottom: 30px;
    animation: fadeInUp 0.6s ease 0.4s backwards;
}
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-family: var(--sans); font-size: 11px; color: var(--text-dim); letter-spacing: 2px; }
.stat-value { font-family: var(--serif); font-size: 22px; color: var(--gold); }
.ending-regulation {
    font-family: var(--sans); font-size: 13px; color: var(--text-dim);
    line-height: 2; text-align: left; padding: 16px 20px;
    background: rgba(255,255,255,0.03); border-radius: var(--radius);
    margin-bottom: 30px; animation: fadeInUp 0.6s ease 0.5s backwards;
}
.ending-buttons { animation: fadeInUp 0.6s ease 0.6s backwards; }

/* Ending color variants */
.ending-gold .ending-type { color: var(--gold); }
.ending-good .ending-type { color: var(--green); }
.ending-warn .ending-type { color: #f39c12; }
.ending-bad .ending-type { color: #e74c3c; }
.ending-worst .ending-type { color: #95a5a6; }

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes blink { 0%,100% { opacity: 0.3; } 50% { opacity: 0.8; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* === Responsive === */
@media (max-width: 768px) {
    /* Title Screen */
    .title-main { font-size: 64px; letter-spacing: 8px; }
    .title-badge { font-size: 13px; letter-spacing: 3px; padding: 6px 18px; }
    .title-sub { font-size: 16px; letter-spacing: 4px; }
    .title-desc { font-size: 16px; line-height: 2; margin: 24px 20px; padding-left: 16px; }
    .btn-cinematic { font-size: 20px; padding: 16px 50px; }
    .control-hint { font-size: 12px; }

    /* HUD */
    #hud { padding: 12px 16px; }
    #hud-chapter { font-size: 14px; }
    .integrity-label { font-size: 11px; }
    .integrity-bar { width: 80px; height: 6px; }
    .integrity-value { font-size: 15px; }

    /* Speaker */
    #speaker-area { bottom: 180px; left: 16px; }
    .speaker-plate { padding: 8px 16px; }
    .speaker-name { font-size: 16px; }
    .speaker-icon { font-size: 20px; }

    /* Dialogue */
    #dialogue-panel { left: 10px; right: 10px; bottom: 14px; padding: 18px 20px 14px; min-height: 130px; }
    #dialogue-text { font-size: 17px; line-height: 1.9; }
    #advance-hint { font-size: 13px; margin-top: 10px; }

    /* Choices */
    .choice-title { font-size: 16px; letter-spacing: 4px; margin-bottom: 20px; }
    #choice-list { padding: 0 14px; gap: 12px; }
    .choice-card { padding: 18px 18px; gap: 14px; }
    .choice-text { font-size: 16px; line-height: 1.7; }
    .choice-key { width: 32px; height: 32px; font-size: 15px; }

    /* Regulation / Knowledge Card - 重点放大 */
    #regulation-panel { padding: 20px; }
    #regulation-panel > * { max-width: 95vw; padding: 0 10px; }
    .reg-icon { font-size: 36px; }
    .reg-title { font-size: 22px; letter-spacing: 4px; }
    .reg-article { font-size: 16px; letter-spacing: 1px; margin-bottom: 18px; padding-bottom: 18px; }
    .reg-content { font-size: 17px; padding: 20px 18px; line-height: 2.2; border-left-width: 4px; }
    .reg-dismiss { font-size: 14px; margin-top: 20px; }
    .reg-header { margin-bottom: 16px; }

    /* Chapter Transition */
    .ct-title { font-size: 32px; letter-spacing: 6px; }
    .ct-chapter { font-size: 14px; letter-spacing: 6px; }
    .ct-desc { font-size: 15px; padding: 0 24px; line-height: 2; }

    /* Ending Screen */
    .ending-content { padding: 24px 18px; }
    .ending-icon { font-size: 52px; }
    .ending-type { font-size: 28px; letter-spacing: 4px; }
    .ending-title { font-size: 16px; }
    .ending-story { font-size: 16px; line-height: 2.2; padding-left: 16px; }
    .ending-stats { gap: 20px; }
    .stat-label { font-size: 13px; }
    .stat-value { font-size: 22px; }
    .ending-regulation { font-size: 15px; padding: 16px 16px; line-height: 2.2; }
}

