:root {
    color-scheme: dark;
    --bg: #050b16;
    --panel: rgba(9, 19, 35, 0.88);
    --panel-border: rgba(143, 179, 255, 0.22);
    --text: #e8eefc;
    --muted: #9fb0cb;
    --accent: #7db6ff;
    --accent-2: #87e2d9;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top, rgba(78, 118, 194, 0.22), transparent 32%),
        linear-gradient(180deg, #07111f 0%, #040812 100%);
    color: var(--text);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

body {
    min-height: 100vh;
}

#app-shell {
    min-height: 100vh;
    padding: 24px;
}

#start-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 14, 0.82);
    z-index: 20;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#start-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

#btn-start,
#controls button,
.back-link {
    border: 1px solid rgba(143, 179, 255, 0.34);
    border-radius: 999px;
    background: rgba(16, 31, 55, 0.94);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

#btn-start {
    padding: 18px 42px;
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(135deg, #8bdcff 0%, #7db6ff 100%);
    color: #05101f;
}

#controls button:hover,
#btn-start:hover,
.back-link:hover {
    transform: translateY(-1px);
    border-color: rgba(167, 202, 255, 0.78);
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin: 0 auto 18px;
    max-width: 1440px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent-2);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.8rem, 2.6vw, 3rem);
    line-height: 1.18;
}

.summary {
    max-width: 780px;
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.back-link {
    display: inline-flex;
    align-items: center;
    padding: 12px 18px;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.stage-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.75fr);
    gap: 18px;
    max-width: 1440px;
    margin: 0 auto;
}

.stage-panel,
.info-panel,
#controls {
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.stage-panel {
    padding: 14px;
}

#platform-svg {
    display: block;
    width: 100%;
    height: auto;
}

.info-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
}

#subtitle-box,
.scene-notes {
    border: 1px solid rgba(143, 179, 255, 0.18);
    border-radius: 20px;
    background: rgba(7, 15, 28, 0.72);
    padding: 18px;
}

#speaker-name {
    margin-bottom: 10px;
    color: var(--accent-2);
    font-weight: 700;
}

#dialogue-text,
#scene-note {
    color: var(--text);
    line-height: 1.8;
}

#scene-formula {
    color: #dff7ee;
    line-height: 1.8;
}

.scene-notes h2 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.emphasis-note {
    border-color: rgba(135, 226, 217, 0.22);
    background: linear-gradient(180deg, rgba(9, 24, 33, 0.9), rgba(8, 17, 29, 0.78));
}

.emphasis-note[data-tone="blue"] {
    border-color: rgba(125, 182, 255, 0.28);
    background: linear-gradient(180deg, rgba(12, 28, 50, 0.92), rgba(9, 18, 35, 0.8));
}

.emphasis-note[data-tone="cyan"] {
    border-color: rgba(113, 232, 220, 0.26);
    background: linear-gradient(180deg, rgba(8, 27, 34, 0.92), rgba(8, 18, 27, 0.8));
}

.emphasis-note[data-tone="teal"] {
    border-color: rgba(94, 231, 210, 0.3);
    background: linear-gradient(180deg, rgba(10, 34, 34, 0.94), rgba(8, 23, 23, 0.82));
}

.emphasis-note[data-tone="amber"],
.emphasis-note[data-tone="gold"] {
    border-color: rgba(242, 193, 98, 0.28);
    background: linear-gradient(180deg, rgba(42, 28, 12, 0.92), rgba(27, 19, 8, 0.8));
}

.emphasis-note[data-tone="red"] {
    border-color: rgba(255, 146, 146, 0.28);
    background: linear-gradient(180deg, rgba(45, 17, 20, 0.92), rgba(28, 12, 14, 0.8));
}

.emphasis-note[data-tone="purple"] {
    border-color: rgba(176, 148, 255, 0.28);
    background: linear-gradient(180deg, rgba(31, 18, 50, 0.92), rgba(18, 11, 31, 0.8));
}

.emphasis-note[data-tone="green"] {
    border-color: rgba(166, 255, 116, 0.32);
    background: linear-gradient(180deg, rgba(18, 34, 12, 0.94), rgba(13, 24, 10, 0.82));
}

.scene-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.scene-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(143, 179, 255, 0.24);
    background: rgba(15, 31, 55, 0.8);
    color: #dce8ff;
    font-size: 0.92rem;
    line-height: 1;
}

.scene-tags[data-tone="blue"] .scene-tag {
    border-color: rgba(125, 182, 255, 0.36);
    background: rgba(20, 40, 74, 0.86);
    color: #dce8ff;
}

.scene-tags[data-tone="cyan"] .scene-tag {
    border-color: rgba(113, 232, 220, 0.34);
    background: rgba(11, 39, 48, 0.86);
    color: #dffcf8;
}

.scene-tags[data-tone="teal"] .scene-tag {
    border-color: rgba(94, 231, 210, 0.36);
    background: rgba(10, 46, 44, 0.9);
    color: #ddfff8;
}

.scene-tags[data-tone="amber"] .scene-tag,
.scene-tags[data-tone="gold"] .scene-tag {
    border-color: rgba(242, 193, 98, 0.34);
    background: rgba(59, 38, 12, 0.86);
    color: #fff1d6;
}

.scene-tags[data-tone="red"] .scene-tag {
    border-color: rgba(255, 146, 146, 0.34);
    background: rgba(63, 20, 24, 0.86);
    color: #ffe3e3;
}

.scene-tags[data-tone="purple"] .scene-tag {
    border-color: rgba(176, 148, 255, 0.34);
    background: rgba(39, 26, 70, 0.86);
    color: #efe5ff;
}

.scene-tags[data-tone="green"] .scene-tag {
    border-color: rgba(166, 255, 116, 0.38);
    background: rgba(27, 53, 18, 0.9);
    color: #efffdc;
}

#controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 1440px;
    margin: 18px auto 0;
    padding: 14px 18px;
}

#controls button {
    padding: 10px 18px;
    font: inherit;
}

#scene-indicator {
    min-width: 116px;
    text-align: center;
    color: var(--accent-2);
    font-weight: 700;
}

.svg-title {
    fill: #eef4ff;
    font-size: 30px;
    font-weight: 700;
}

.svg-subtitle {
    fill: #a9bad8;
    font-size: 15px;
}

.node rect,
.flow,
.flow-return,
#focus-frame {
    transition: opacity 0.55s ease, transform 0.55s ease, stroke 0.55s ease, fill 0.55s ease;
}

.node rect {
    fill: rgba(15, 31, 55, 0.94);
    stroke: rgba(135, 178, 255, 0.42);
    stroke-width: 2;
}

.node-title {
    fill: #eef4ff;
    font-size: 21px;
    font-weight: 700;
}

.node-line {
    fill: #a9bad8;
    font-size: 15px;
}

.node,
.flow,
.flow-return {
    opacity: 0.18;
}

.node.active,
.flow.active,
.flow-return.active {
    opacity: 1;
}

.node.active rect {
    fill: rgba(22, 45, 76, 0.98);
    stroke: rgba(137, 194, 255, 0.95);
    filter: drop-shadow(0 0 22px rgba(99, 160, 255, 0.22));
}

.node.pulse rect {
    stroke: rgba(135, 226, 217, 0.95);
    filter: drop-shadow(0 0 30px rgba(120, 214, 205, 0.35));
}

#motivation-node.active rect {
    fill: rgba(38, 72, 18, 0.98);
    stroke: rgba(166, 255, 116, 0.98);
    filter: drop-shadow(0 0 28px rgba(156, 255, 106, 0.28));
}

#motivation-node.pulse rect {
    stroke: rgba(214, 255, 153, 0.98);
    filter: drop-shadow(0 0 34px rgba(179, 255, 117, 0.42));
}

#skill-node.active rect {
    fill: rgba(17, 70, 72, 0.98);
    stroke: rgba(111, 240, 224, 0.96);
    filter: drop-shadow(0 0 28px rgba(96, 235, 219, 0.24));
}

#skill-node.pulse rect {
    stroke: rgba(174, 255, 244, 0.98);
    filter: drop-shadow(0 0 34px rgba(125, 244, 227, 0.36));
}

.skill-tier .node-title {
    font-size: 15px;
}

.skill-tier .node-line {
    font-size: 10.2px;
}

.skill-tier.active rect {
    fill: rgba(12, 54, 56, 0.98);
    stroke: rgba(111, 240, 224, 0.88);
    filter: drop-shadow(0 0 18px rgba(96, 235, 219, 0.18));
}

.skill-tier.pulse rect {
    stroke: rgba(190, 255, 248, 0.98);
    filter: drop-shadow(0 0 24px rgba(140, 251, 233, 0.32));
}

.tier-l0.active rect {
    fill: rgba(16, 55, 66, 0.98);
}

.tier-l1.active rect {
    fill: rgba(15, 63, 68, 0.98);
}

.tier-l2.active rect {
    fill: rgba(14, 69, 70, 0.98);
}

.tier-l3.active rect {
    fill: rgba(13, 74, 69, 0.98);
}

.tier-l4.active rect {
    fill: rgba(17, 81, 64, 0.98);
}

.motivation-link.active {
    stroke: #9fe870;
    filter: drop-shadow(0 0 16px rgba(159, 232, 112, 0.28));
}

.skill-link.active {
    stroke: #62ead5;
    filter: drop-shadow(0 0 16px rgba(98, 234, 213, 0.3));
}

.burst rect {
    animation: motivation-burst-node 1.15s ease;
}

.motivation-link.burst {
    animation: motivation-burst-line 1.15s ease;
}

#skill-node.burst rect {
    animation: skill-burst-node 1.15s ease;
}

.skill-tier.burst rect {
    animation: skill-burst-node 1.15s ease;
}

.skill-link.burst {
    animation: skill-burst-line 1.15s ease;
}

@keyframes motivation-burst-node {
    0% {
        filter: drop-shadow(0 0 0 rgba(179, 255, 117, 0));
        transform: scale(1);
    }
    28% {
        filter: drop-shadow(0 0 38px rgba(179, 255, 117, 0.52));
        transform: scale(1.03);
    }
    62% {
        filter: drop-shadow(0 0 18px rgba(179, 255, 117, 0.3));
        transform: scale(1.01);
    }
    100% {
        filter: drop-shadow(0 0 0 rgba(179, 255, 117, 0));
        transform: scale(1);
    }
}

@keyframes motivation-burst-line {
    0% {
        stroke-width: 3;
        filter: drop-shadow(0 0 0 rgba(159, 232, 112, 0));
    }
    30% {
        stroke-width: 6;
        filter: drop-shadow(0 0 18px rgba(159, 232, 112, 0.5));
    }
    100% {
        stroke-width: 3;
        filter: drop-shadow(0 0 0 rgba(159, 232, 112, 0));
    }
}

@keyframes skill-burst-node {
    0% {
        filter: drop-shadow(0 0 0 rgba(98, 234, 213, 0));
        transform: scale(1);
    }
    28% {
        filter: drop-shadow(0 0 38px rgba(98, 234, 213, 0.5));
        transform: scale(1.03);
    }
    62% {
        filter: drop-shadow(0 0 18px rgba(98, 234, 213, 0.28));
        transform: scale(1.01);
    }
    100% {
        filter: drop-shadow(0 0 0 rgba(98, 234, 213, 0));
        transform: scale(1);
    }
}

@keyframes skill-burst-line {
    0% {
        stroke-width: 4;
        filter: drop-shadow(0 0 0 rgba(98, 234, 213, 0));
    }
    30% {
        stroke-width: 7;
        filter: drop-shadow(0 0 18px rgba(98, 234, 213, 0.48));
    }
    100% {
        stroke-width: 4;
        filter: drop-shadow(0 0 0 rgba(98, 234, 213, 0));
    }
}

.flow {
    fill: none;
    stroke: #8fb3ff;
    stroke-width: 4;
    stroke-linecap: round;
    marker-end: url(#flow-arrow);
}

.flow-return {
    fill: none;
    stroke: #7ee7d8;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 10 10;
    marker-end: url(#flow-arrow);
}

#focus-frame {
    fill: none;
    stroke: rgba(125, 182, 255, 0.2);
    stroke-width: 3;
}

@media (max-width: 1080px) {
    .stage-shell {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
    }

    .back-link {
        white-space: normal;
    }
}

@media (max-width: 720px) {
    #app-shell {
        padding: 16px;
    }

    #controls {
        flex-wrap: wrap;
    }

    #scene-indicator {
        width: 100%;
        order: -1;
    }
}
