:root {
    color-scheme: dark;
    font-family: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
    --bg: #0b1220;
    --bg-soft: #121d33;
    --panel: rgba(11, 18, 32, 0.78);
    --line: rgba(162, 184, 230, 0.16);
    --text: #ebf1ff;
    --muted: #aab8d8;
    --accent: #4fc3f7;
    --accent-strong: #1d8bff;
    --warm: #ffd166;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

.demo-code-block {
    height: 300px;
    overflow: scroll;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(29, 139, 255, 0.22), transparent 30%),
        radial-gradient(circle at top right, rgba(255, 209, 102, 0.16), transparent 24%),
        linear-gradient(180deg, #08101c 0%, #0b1220 46%, #0d1424 100%);
}

a {
    color: inherit;
}

code {
    font-family: "JetBrains Mono", "Source Code Pro", monospace;
}

.page-shell {
    width: min(1180px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 40px 0 56px;
}

.hero,
.panel {
    backdrop-filter: blur(14px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero {
    padding: 36px;
    overflow: hidden;
    position: relative;
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -80px -80px auto;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 195, 247, 0.32), rgba(79, 195, 247, 0));
    pointer-events: none;
}

.eyebrow,
.section-label {
    margin: 0 0 10px;
    color: var(--warm);
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero h1,
.panel h2 {
    margin: 0;
    line-height: 1.15;
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    max-width: 10.5em;
}

.hero-copy {
    margin: 18px 0 0;
    max-width: 760px;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.8;
}

.hero-actions,
.source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.panel {
    margin-top: 24px;
    padding: 28px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: clamp(1.45rem, 2.5vw, 2rem);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid var(--line);
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

button.button {
    font: inherit;
    color: inherit;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
    color: #041220;
    border-color: transparent;
    font-weight: 700;
}

.button.secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

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

.info-card,
.demo-note,
.canvas-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
}

.info-card {
    padding: 20px;
}

.info-card h3,
.demo-note h3 {
    margin: 0 0 12px;
    font-size: 1.02rem;
}

.info-card p,
.demo-note p,
.canvas-note,
.steps li,
.copy-status {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.info-card p + p,
.demo-note p + p {
    margin-top: 10px;
}

.steps {
    margin: 0;
    padding-left: 1.35rem;
    display: grid;
    gap: 10px;
}

.demo-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
    gap: 18px;
    align-items: start;
}

.canvas-card {
    padding: 18px;
}

.canvas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.canvas-badge {
    color: var(--muted);
    font-size: 0.86rem;
    letter-spacing: 0.04em;
}

.demo-stage {
    width: 100%;
    aspect-ratio: 3 / 2;
    min-height: 320px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at 20% 20%, rgba(79, 195, 247, 0.2), transparent 28%),
        radial-gradient(circle at 80% 25%, rgba(255, 209, 102, 0.14), transparent 24%),
        #050b16;
}

.demo-stage:fullscreen {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    border-radius: 0;
    border: none;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

.canvas-note {
    margin-top: 14px;
}

.demo-note {
    padding: 20px;
}

.source-panel {
    overflow: hidden;
}

.source-header {
    align-items: center;
}

.copy-status {
    min-height: 1.8em;
    margin-bottom: 12px;
}

.source-block {
    margin: 0;
    padding: 18px;
    border-radius: 20px;
    background: #07101e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: auto;
    max-height: 70vh;
}

.source-block code {
    display: block;
    color: #d9e8ff;
    font-size: 0.9rem;
    line-height: 1.65;
    white-space: pre;
}

.editor-shell {
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #07101e;
}

.live-editor-shell {
    position: relative;
    min-height: 540px;
}

.editor-highlight {
    margin: 0;
    min-height: 540px;
    padding: 18px;
    overflow: auto;
    color: #d9e8ff;
    font: 0.9rem/1.65 "JetBrains Mono", "Source Code Pro", monospace;
    white-space: pre;
    pointer-events: none;
}

.source-editor {
    width: 100%;
    min-height: 540px;
    display: block;
    border: none;
    padding: 18px;
    resize: vertical;
    background: #07101e;
    color: #d9e8ff;
    font: 0.9rem/1.65 "JetBrains Mono", "Source Code Pro", monospace;
    outline: none;
    tab-size: 4;
}

.live-source-editor {
    position: absolute;
    inset: 0;
    min-height: 100%;
    background: transparent;
    color: transparent;
    caret-color: #f4f8ff;
    overflow: auto;
}

.live-source-editor::selection {
    background: rgba(79, 195, 247, 0.28);
}

.issues-box {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.issue-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
}

.issue-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.issue-badge.ok {
    background: rgba(88, 214, 141, 0.18);
    color: #c9ffdb;
}

.issue-badge.warn {
    background: rgba(255, 209, 102, 0.18);
    color: #ffe8aa;
}

.issue-badge.error {
    background: rgba(255, 107, 107, 0.18);
    color: #ffd6d6;
}

.issue-text {
    color: var(--muted);
    line-height: 1.7;
}

.analysis-panel {
    margin-bottom: 24px;
}

.analysis-file-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.analysis-tab {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    font: inherit;
}

.analysis-tab.active {
    background: linear-gradient(135deg, rgba(29, 139, 255, 0.95), rgba(79, 195, 247, 0.92));
    color: #041220;
    border-color: transparent;
    font-weight: 700;
}

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

.analysis-card,
.analysis-preview-card {
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    padding: 18px;
}

.analysis-card h3,
.analysis-preview-card h3 {
    margin: 0 0 14px;
    font-size: 1rem;
}

.analysis-preview-card {
    margin-top: 16px;
}

.analysis-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.analysis-list {
    display: grid;
    gap: 12px;
}

.analysis-item {
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    padding: 12px 14px;
}

.analysis-item.active {
    border-color: rgba(79, 195, 247, 0.5);
    background: rgba(79, 195, 247, 0.08);
}

.analysis-item-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.analysis-item-meta {
    color: var(--muted);
    font-size: 0.82rem;
}

.analysis-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.analysis-pill,
.analysis-chip,
.analysis-state {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.analysis-pill,
.analysis-chip {
    background: rgba(79, 195, 247, 0.14);
    border: 1px solid rgba(79, 195, 247, 0.18);
    color: #c7ecff;
}

.analysis-chip.subtle {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--muted);
}

.analysis-pill.empty {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.07);
    color: var(--muted);
}

.analysis-state.ok {
    background: rgba(88, 214, 141, 0.18);
    color: #bcffd4;
}

.analysis-state.error {
    background: rgba(255, 107, 107, 0.18);
    color: #ffd0d0;
}

.analysis-empty {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.analysis-preview {
    margin: 0;
    padding: 18px;
    border-radius: 16px;
    background: #07101e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: auto;
    max-height: 70vh;
}

.analysis-preview code,
.source-block code {
    font-family: "JetBrains Mono", "Source Code Pro", monospace;
}

.token-comment {
    color: #6b7d99;
}

.token-string {
    color: #ffd479;
}

.token-number {
    color: #b4f3a1;
}

.token-keyword {
    color: #71d7ff;
    font-weight: 700;
}

.token-class {
    color: #ff9ad5;
    font-weight: 700;
}

.token-base {
    color: #c7b3ff;
}

.token-property {
    color: #8fe7b5;
}

.token-punct {
    color: #9fb1cf;
}

@media (max-width: 920px) {
    .page-shell {
        width: min(100vw - 20px, 1180px);
        padding: 20px 0 36px;
    }

    .hero,
    .panel {
        border-radius: 20px;
    }

    .hero,
    .panel {
        padding: 22px;
    }

    .card-grid,
    .demo-layout,
    .analysis-grid {
        grid-template-columns: 1fr;
    }

    .panel-header,
    .source-header {
        align-items: start;
        flex-direction: column;
    }

    .source-actions {
        margin-top: 0;
    }

    .canvas-toolbar {
        align-items: start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .hero h1 {
        max-width: none;
    }

    .source-block {
        max-height: none;
    }

    .source-editor {
        min-height: 420px;
    }

    .editor-highlight,
    .live-editor-shell {
        min-height: 420px;
    }

    .analysis-preview-header {
        align-items: start;
        flex-direction: column;
    }
}
