/* ──────────────────────────────────────────────────────────────
   Dragon's Den — provably fair dice
   Dark, layered UI: glass surfaces over an ambient-glow base,
   Space Grotesk display type, Inter body, mono for anything the
   math touches. All fonts self-hosted (CSP: style/font 'self').
   ────────────────────────────────────────────────────────────── */

@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/space-grotesk-latin-500-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/space-grotesk-latin-700-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/inter-latin-400-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/inter-latin-500-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/inter-latin-600-normal.woff2') format('woff2');
}

:root {
    --bg: #0b0e14;
    --surface: rgba(255, 255, 255, 0.035);
    --surface-strong: rgba(255, 255, 255, 0.055);
    --panel: rgba(13, 17, 24, 0.82);
    --border: rgba(255, 255, 255, 0.09);
    --border-soft: rgba(255, 255, 255, 0.055);
    --text: #e8ecf1;
    --text-dim: #9aa4b2;
    --text-faint: #667080;
    --accent: #34f5a2;
    --accent-2: #59d4ff;
    --accent-dim: rgba(52, 245, 162, 0.12);
    --accent-border: rgba(52, 245, 162, 0.28);
    --danger: #ff6b7a;
    --code-label: #7dd3fc;
    --code-value: #f0a06c;
    --code-formula: #c4b5fd;
    --code-comment: #7fd08f;
    --radius: 16px;
    --radius-sm: 10px;
    --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --mono: 'Cascadia Code', Consolas, ui-monospace, 'SF Mono', Menlo, monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Ambient glow — two soft radial lights behind everything */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(560px 420px at 12% -8%, rgba(52, 245, 162, 0.09), transparent 65%),
        radial-gradient(720px 520px at 95% 12%, rgba(89, 130, 255, 0.08), transparent 65%),
        var(--bg);
}

::selection {
    background: rgba(52, 245, 162, 0.28);
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Chrome: navbar + status bar ─────────────────────────────── */

.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 14, 20, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-soft);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.logo {
    font-family: var(--display);
    font-weight: 700;
    font-size: 16.5px;
    letter-spacing: -0.01em;
    color: var(--text);
}

a.logo-link,
a.logo-link:link,
a.logo-link:visited {
    text-decoration: none;
}

a.logo-link:hover .logo {
    color: var(--accent);
}

.discord-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: #5865F2;
    color: #fff;
    border: none;
    border-radius: 999px;
    text-decoration: none;
    font-family: var(--body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.discord-button img {
    width: 17px;
    height: 17px;
    filter: brightness(0) invert(1);
}

.discord-button:hover {
    background: #6a76f4;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(88, 101, 242, 0.35);
}

.navbar .discord-button {
    padding: 7px 16px;
    font-size: 13.5px;
}

.status-bar {
    padding: 12px 24px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-soft);
}

.status-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-dim);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 6px 14px;
}

.status-item [data-hall] {
    color: var(--text);
    font-family: var(--mono);
    font-size: 12.5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(52, 245, 162, 0.5);
    animation: pulse 2.6s ease-out infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 245, 162, 0.45); }
    70% { box-shadow: 0 0 0 7px rgba(52, 245, 162, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 245, 162, 0); }
}

/* ── Verify pages ────────────────────────────────────────────── */

.verify-card {
    margin: 20px 24px 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.verify-card.verify-error .verify-title {
    color: var(--danger);
}

.verify-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 15.5px;
    color: var(--accent);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.verify-results {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-family: var(--mono);
    font-size: 13.5px;
}

.verify-row {
    display: flex;
    gap: 14px;
    align-items: baseline;
    flex-wrap: wrap;
}

.verify-label {
    color: var(--code-label);
    min-width: 110px;
}

.verify-value {
    color: var(--text);
    font-weight: bold;
    word-break: break-all;
}

.verify-value.muted {
    color: var(--text-faint);
    font-weight: normal;
}

.verify-note {
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--text-dim);
    max-width: 880px;
    line-height: 1.55;
}

.editor-header {
    margin: 18px 24px 0;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    color: var(--text-dim);
}

.run-button {
    background: linear-gradient(135deg, var(--accent), #2bd9c7);
    color: #06130c;
    border: none;
    padding: 8px 20px;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--body);
    font-size: 13.5px;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.run-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(52, 245, 162, 0.35);
}

.editor-container {
    flex: 1;
    min-height: 420px;
    position: relative;
    margin: 0 24px 24px;
    border: 1px solid var(--border);
    border-top: 1px solid var(--border-soft);
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
    background: #1e1e1e;
}

#oc-editor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Covers the sandbox until OUR Java has actually landed in it (verify.js
   hides this on the editor's populate acknowledgment) — also hides the
   editor's default file during boot. */
.editor-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #1e1e1e;
    color: var(--text-dim);
    font-size: 14px;
    text-align: center;
    padding: 20px;
    pointer-events: none;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

.editor-loading.hidden {
    opacity: 0;
    visibility: hidden;
}

.editor-loading-spinner {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}

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

.editor-loading-note {
    font-size: 12.5px;
    color: var(--text-faint);
    max-width: 440px;
    line-height: 1.55;
}

/* ── Landing ─────────────────────────────────────────────────── */

.landing {
    flex: 1;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px 56px;
}

.landing section {
    margin-top: 72px;
}

.landing h1 {
    font-family: var(--display);
    font-size: clamp(38px, 5.5vw, 56px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin: 0 0 18px;
}

.landing h1 .tok-green {
    background: linear-gradient(100deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.landing h2 {
    font-family: var(--display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 20px;
}

.landing-lede {
    color: var(--text-dim);
    max-width: 560px;
    margin: 0 0 18px;
    font-size: 15.5px;
    line-height: 1.65;
}

.hero {
    display: flex;
    gap: 48px;
    align-items: center;
    justify-content: space-between;
    padding-top: 64px;
    flex-wrap: wrap;
}

.hero-copy {
    flex: 1 1 340px;
}

/* Signature: the terminal card that re-derives a real roll live */
.hero-terminal {
    flex: 1 1 380px;
    max-width: 500px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-family: var(--mono);
    font-size: 13.5px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hero-terminal-title {
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--border-soft);
    padding: 10px 16px;
    color: var(--text-faint);
    font-size: 12px;
    letter-spacing: 0.02em;
}

.hero-terminal-body {
    padding: 18px 20px 20px;
    line-height: 2;
}

.hero-terminal-body .tok-comment { color: var(--code-comment); opacity: 0.75; }
.hero-terminal-body .tok-label { color: var(--code-label); display: inline-block; min-width: 108px; }
.hero-terminal-body .tok-value { color: var(--code-value); word-break: break-all; }
.hero-terminal-body .tok-formula { color: var(--code-formula); }

.hero-result {
    margin-top: 8px;
    font-size: 18px;
}

.hero-result .tok-roll {
    color: var(--accent);
    font-weight: bold;
    text-shadow: 0 0 24px rgba(52, 245, 162, 0.45);
}

.hero-result .tok-check {
    color: var(--code-comment);
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.7s ease;
}

.hero-result .tok-check.shown {
    opacity: 1;
}

.hero-cta {
    display: inline-block;
    margin-top: 14px;
    color: var(--accent-2);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 5px;
    transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

.hero-cta:hover {
    color: #fff;
    text-decoration-color: var(--accent-2);
}

/* How verification works — a real 3-step sequence */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.step {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 20px 22px;
}

.step-n {
    font-family: var(--mono);
    color: var(--accent);
    font-size: 12.5px;
    letter-spacing: 0.04em;
}

.step p {
    margin: 8px 0 0;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.6;
}

/* Game cards */
.games {
    display: grid;
    /* 240px min lets all four games share one row inside the 1080px
       container; narrower viewports wrap to 2x2 then stack. */
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.game-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.game-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-border);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
}

.game-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.game-card h3 {
    margin: 0;
    font-family: var(--display);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.game-cmd {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--code-value);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 3px 8px;
    white-space: nowrap;
}

.game-rule {
    margin: 0;
    color: var(--text-dim);
    font-size: 13.5px;
    line-height: 1.6;
    flex: 1;
}

.game-rule-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.rule-cmd {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--code-value);
}

.game-payout {
    align-self: flex-start;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    padding: 3px 12px;
}

.game-sample {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--code-label);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    line-height: 1.6;
}

.game-sample .tok-roll {
    color: var(--accent);
}

.game-verify {
    align-self: flex-start;
    color: var(--accent-2);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 5px;
    font-size: 13.5px;
    transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

.game-verify:hover {
    color: #fff;
    text-decoration-color: var(--accent-2);
}

/* Status-bar explainer */
.bar-guide {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 6px 22px;
}

.bar-guide-row {
    display: flex;
    gap: 18px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-soft);
    align-items: baseline;
    flex-wrap: wrap;
}

.bar-guide-row:last-child {
    border-bottom: none;
}

.bar-guide-term {
    min-width: 180px;
    font-family: var(--display);
    font-weight: 700;
    font-size: 14.5px;
    white-space: nowrap;
}

.bar-guide-term .live {
    font-family: var(--mono);
    color: var(--accent);
    font-weight: normal;
    font-size: 13px;
}

.bar-guide-def {
    margin: 0;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.6;
    flex: 1;
    min-width: 240px;
}

.landing-footer {
    margin-top: 72px;
    padding-top: 20px;
    border-top: 1px solid var(--border-soft);
    color: var(--text-faint);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.landing-footer a {
    color: var(--accent-2);
}

/* ── Motion preferences ──────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .status-dot {
        animation: none;
    }

    .editor-loading-spinner {
        animation: none;
    }

    .editor-loading {
        transition: none;
    }

    .hero-result .tok-check,
    .discord-button,
    .run-button,
    .game-card,
    .hero-cta,
    .game-verify {
        transition: none;
    }

    .discord-button:hover,
    .run-button:hover,
    .game-card:hover {
        transform: none;
    }
}
