/* Immanuel Game Design — one house style for the whole site.
   White page, black text, Inter. Game worlds stay 3D; their words match this file. */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;1,200&display=swap');

:root {
    --ink: #111111;
    --muted: #5c5c5c;
    --line: #e6e6e6;
    --paper: #ffffff;
    --soft: #f6f6f6;
    --font: "Inter", "Segoe UI", system-ui, sans-serif;
    --bar: 52px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.site {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
body.site a { color: inherit; }
body.site :focus-visible { outline: 2px solid #111; outline-offset: 3px; }
.skip {
    position: absolute; left: 12px; top: -40px; background: #111; color: #fff;
    padding: 8px 12px; border-radius: 8px; z-index: 20;
}
.skip:focus { top: 8px; }

/* ---------- top bar ---------- */
.suite-banner {
    height: 96px; display: flex; align-items: center; padding: 0 28px;
    background: #000;
}
.suite-banner img { height: 72px; width: auto; display: block; }
.menu-btn {
    display: none;
    font: 600 14px var(--font);
    border: 1px solid #111;
    background: #fff;
    color: #111;
    border-radius: 999px;
    padding: 8px 14px;
    min-height: 40px;
    cursor: pointer;
}
.site-bar, .game-bar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 22px;
    height: var(--bar); padding: 0 22px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    font-family: var(--font);
    color: var(--ink);
}
.game-bar {
    position: fixed; left: 0; right: 0; top: 0; z-index: 800;
}
.brand {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--ink);
    font-weight: 600; letter-spacing: -0.02em; white-space: nowrap;
}
.logo-mark { width: 28px; height: 28px; display: block; }
.site-nav, .game-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a, .game-nav a {
    text-decoration: none; color: var(--ink);
    font-size: 14px; font-weight: 500;
    padding: 6px 10px; border-radius: 8px;
}
.site-nav a:hover, .game-nav a:hover { background: var(--soft); }
.gd-suite { position: relative; }
.gd-suite-link {
    appearance: none; background: transparent; border: 0; cursor: pointer;
    font: 500 14px var(--font); color: var(--ink);
    padding: 6px 10px; border-radius: 8px;
}
.gd-suite-link:hover, .gd-suite.is-open .gd-suite-link { background: var(--soft); }
.gd-suite-panel {
    display: block; visibility: hidden; opacity: 0; pointer-events: none;
    position: absolute; top: calc(100% + 8px); left: 0; width: min(360px, 78vw);
    padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12); z-index: 50; text-align: left;
}
.gd-suite:hover .gd-suite-panel,
.gd-suite:focus-within .gd-suite-panel,
.gd-suite.is-open .gd-suite-panel {
    visibility: visible; opacity: 1; pointer-events: auto;
}
.site-nav .gd-suite-panel a {
    display: block; white-space: normal; text-decoration: none; color: var(--ink);
    border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 400; line-height: 1.4;
}
.site-nav .gd-suite-panel a:hover,
.site-nav .gd-suite-panel a:focus-visible { background: var(--soft); }
.gd-suite-panel strong { display: block; font-size: 14px; font-weight: 600; letter-spacing: -0.02em; }
.gd-suite-panel span { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; color: var(--muted); }
.gd-suite-new {
    display: inline-block; margin-left: 6px; padding: 1px 6px 2px; border-radius: 999px;
    background: #111; color: #fff; font-style: normal; font-size: 10px; font-weight: 600;
    letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 1px;
}
.bar-spacer { flex: 1; }

.search { position: relative; width: min(240px, 28vw); }
.search input {
    width: 100%; font: 500 14px var(--font); color: var(--ink);
    background: var(--soft); border: 1px solid transparent;
    border-radius: 8px; padding: 7px 32px 7px 12px; outline: none;
}
.search input:focus { border-color: #ccc; background: #fff; }
.search kbd {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    font: 500 11px var(--font); color: var(--muted);
    border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; background: #fff;
}
.search-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08); padding: 6px; z-index: 50;
}
.search-results a, .search-results button {
    display: block; width: 100%; text-align: left; text-decoration: none;
    font: 500 14px var(--font); color: var(--ink); background: none; border: 0;
    border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.search-results a:hover, .search-results button:hover,
.search-results a[aria-selected="true"], .search-results button[aria-selected="true"] { background: var(--soft); }
.bar-actions { display: flex; align-items: center; gap: 8px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: 600 14px var(--font); text-decoration: none; cursor: pointer;
    border-radius: 999px; padding: 8px 14px; border: 1px solid #111;
    background: #fff; color: #111;
}
.btn:hover { background: var(--soft); }
.btn.solid { background: #111; color: #fff; }
.btn.solid:hover { background: #2a2a2a; }
.paypal-checkout {
    display: flex; align-items: center; gap: 16px; width: 100%; box-sizing: border-box;
    margin-top: 4px; padding: 14px 16px; background: #fff; color: #111;
    border: 1px solid #cfcfcf; border-radius: 12px; text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.paypal-checkout:hover { border-color: #003087; background: #fff; }
.paypal-checkout img { height: 28px; width: auto; display: block; }
.paypal-copy { display: grid; gap: 2px; text-align: left; }
.paypal-copy strong { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.paypal-copy small { color: #555; font-size: 13px; font-weight: 500; }
.btn[hidden], .form-note[hidden], .or[hidden], .access-card[hidden], form[hidden], .paypal-checkout[hidden] { display: none !important; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.wide { padding: 12px 18px; font-size: 15px; }

/* ---------- landing ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 72px 24px 40px; }
.eyebrow {
    margin: 0 0 14px; font-size: 17px; font-weight: 200; font-style: italic;
    letter-spacing: 0.01em; color: #111;
}
.hero-row { position: relative; min-height: 220px; overflow: visible; }
.gd-scenes {
    position: absolute; z-index: 0; pointer-events: none;
    top: 0;
    left: calc((100% - 100vw) / 2 + 28px);
    width: min(460px, 38vw);
    height: 300px;
    -webkit-mask-image: radial-gradient(ellipse 62% 58% at 46% 50%, #000 0%, transparent 72%);
    mask-image: radial-gradient(ellipse 62% 58% at 46% 50%, #000 0%, transparent 72%);
}
.gd-scenes img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: contain; object-position: center center;
    opacity: 0;
}
.gd-scene-node { animation: gd-node 12s ease-in-out infinite; }
.gd-scene-world { animation: gd-world 12s ease-in-out infinite; }
@keyframes gd-node {
    0%, 22% { opacity: 1; transform: scale(1.02); }
    34%, 90% { opacity: 0; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1.02); }
}
@keyframes gd-world {
    0%, 24% { opacity: 0; transform: scale(1.04); }
    36%, 78% { opacity: 1; transform: scale(1.02); }
    90%, 100% { opacity: 0; transform: scale(1.05); }
}
.gd-scenes::after {
    content: "";
    position: absolute; inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 76% 70% at 46% 50%, transparent 8%, rgba(255, 255, 255, 0.5) 55%, #fff 76%);
}
@media (max-width: 1100px) {
    .gd-scenes {
        position: relative;
        left: auto;
        top: auto;
        width: min(100%, 520px);
        height: 200px;
        margin: 0 0 12px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .gd-scene-node, .gd-scene-world { animation: none; }
    .gd-scene-node { opacity: 0; }
    .gd-scene-world { opacity: 1; }
}
.hero { position: relative; z-index: 1; max-width: 680px; }
.actions-row, .versions { position: relative; z-index: 1; }
.pastel {
    position: absolute; z-index: 0; pointer-events: none;
    right: -4%; top: 0; width: min(520px, 46vw); height: 100%;
    -webkit-mask-image: radial-gradient(ellipse 68% 64% at 58% 46%, #000 26%, transparent 74%);
    mask-image: radial-gradient(ellipse 68% 64% at 58% 46%, #000 26%, transparent 74%);
}
.hero h1 {
    margin: 0; font-size: clamp(34px, 4.6vw, 58px); font-weight: 600;
    letter-spacing: -0.045em; line-height: 1.05;
}
.lede {
    max-width: 740px; margin: 18px 0 0; font-size: 18px; color: var(--muted); line-height: 1.5;
}
.actions-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 28px;
}
.signup {
    display: flex; align-items: center; background: #fff;
    border: 1px solid #d0d0d0; border-radius: 999px; padding: 4px 4px 4px 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.signup input {
    border: 0; outline: none; font: 500 15px var(--font); width: min(260px, 52vw);
    background: transparent; color: var(--ink); padding: 8px 0;
}
.signup .btn { border: 0; }
.form-note { flex-basis: 100%; min-height: 1.2em; margin: 0; font-size: 14px; color: var(--muted); }
.form-note.ok { color: #111; font-weight: 600; }

.versions { margin-top: 36px; }
.versions h2 {
    margin: 0 0 12px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
}
.version-circles { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.version-circles a {
    width: 58px; height: 58px; border-radius: 50%;
    border: 1px solid #111; display: grid; place-items: center;
    text-decoration: none; color: #111; font-weight: 600; font-size: 14px;
    background: #fff; transition: background 0.15s, color 0.15s, transform 0.15s;
}
.version-circles a:hover { background: #111; color: #fff; transform: translateY(-2px); }
.play-link { margin: 14px 0 0; font-size: 14px; }
.play-link a { font-weight: 600; }

/* cinematic worlds */
.deck {
    max-width: 1180px; margin: 56px auto 24px; padding: 0 24px;
    display: grid; grid-template-columns: 1.55fr 0.85fr; gap: 14px; align-items: stretch;
}
.viewport {
    position: relative; overflow: visible;
    background: transparent; color: #f4f7ff;
}
.viewport canvas {
    display: block; width: 100%; height: 100%;
    -webkit-mask-image: radial-gradient(ellipse 72% 68% at 50% 46%, #000 42%, transparent 78%);
    mask-image: radial-gradient(ellipse 72% 68% at 50% 46%, #000 42%, transparent 78%);
}
.main-world { min-height: 640px; }
.main-world canvas { height: 640px; }
.side-world { min-height: 640px; }
.side-world canvas { height: 640px; }
.deck-bar {
    position: absolute; z-index: 3; top: 14px; left: 14px; right: 14px;
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
    color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,0.45);
    pointer-events: none;
}
.deck-meta { margin-left: auto; font-weight: 500; opacity: 0.85; }
.live { display: inline-flex; align-items: center; gap: 6px; }
.live i {
    width: 8px; height: 8px; border-radius: 50%; background: #3ddc84;
    box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.7);
    animation: pulse-live 1.8s ease-out infinite;
}
@keyframes pulse-live {
    70% { box-shadow: 0 0 0 8px rgba(61, 220, 132, 0); }
    100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}
.hud {
    position: absolute; z-index: 4;
    background: rgba(8, 12, 28, 0.72);
    border: 1px solid rgba(255,255,255,0.14);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-radius: 16px; color: #f4f7ff;
    box-shadow: 0 16px 40px rgba(0,0,0,0.28);
}
.hud-label {
    font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; opacity: 0.7; margin-bottom: 8px;
}
.chat-panel { left: 16px; bottom: 16px; width: min(300px, 42%); padding: 12px 14px; }
#chat-lines { display: grid; gap: 6px; font-size: 13px; line-height: 1.35; min-height: 4.2em; }
#chat-lines b { font-weight: 700; }
.console-panel { right: 16px; bottom: 16px; width: min(320px, 46%); padding: 12px 14px; }
#console-lines {
    margin: 0; font: 500 12px/1.45 ui-monospace, "Cascadia Code", Consolas, monospace;
    white-space: pre-wrap; min-height: 5.6em; color: #d7ffe8;
}
.q-panel {
    left: 50%; top: 58px; transform: translateX(-50%);
    width: min(420px, 70%); padding: 14px 16px 12px;
    background: rgba(255,255,255,0.94); color: #111;
}
.q-teacher { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.q-text { margin: 0 0 10px; font-size: 20px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.25; }
.q-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.q-opt { border: 1px solid #ddd; border-radius: 10px; padding: 8px 10px; font-size: 14px; background: #fff; }
.q-opt.picked { background: #111; color: #fff; border-color: #111; }
.q-tick { margin: 8px 0 0; font-weight: 700; font-size: 13px; }

.page { max-width: 760px; margin: 0 auto; padding: 56px 24px 80px; }
.profile-page { max-width: 1040px; display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 36px; align-items: start; }
.profile-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 24px; padding-top: 36px; }
.profile-nav a, .profile-nav button {
    background: none; border: 0; padding: 8px 0; text-align: left; cursor: pointer;
    font: 600 16px var(--font); color: #111; text-decoration: none;
}
.profile-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
.profile-nav button { margin-top: 28px; color: #444; }
.page h1 { font-size: clamp(36px, 5vw, 52px); letter-spacing: -0.04em; font-weight: 600; margin: 0 0 10px; }
.page .lede { margin-top: 0; }
.stack { display: grid; gap: 14px; margin-top: 28px; }
.stack label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.stack input, .stack textarea {
    font: 500 15px var(--font); color: var(--ink); background: #fff;
    border: 1px solid #ccc; border-radius: 12px; padding: 12px 14px; width: 100%;
}
.stack textarea { min-height: 90px; resize: vertical; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
.or::before, .or::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.cards { display: grid; gap: 12px; margin-top: 28px; }
.card-item {
    border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; background: #fff;
}
.card-item h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.02em; }
.card-item p { margin: 0; color: var(--muted); }
.card-item a.out, .card-item a { font-weight: 600; color: #111; }
a.card-link { display: block; text-decoration: none; color: inherit; }
a.card-link:hover { border-color: #111; }
.access-list { margin: 12px 0 18px; padding-left: 18px; }
.access-list li { margin: 6px 0; }
.empty { color: var(--muted); }

.site-foot {
    margin-top: 36px; border-top: 1px solid #d4d4d4;
    color: var(--muted); font-size: 14px;
}
.suite-row {
    max-width: 1120px; margin: 0 auto; padding: 18px 24px 40px;
    display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline;
}
.suite-label { color: #111; font-weight: 600; }
.site-foot a { color: var(--ink); font-weight: 600; }
.prose h2 { font-size: 22px; letter-spacing: -0.03em; margin: 28px 0 8px; }
.prose h3 { font-size: 17px; margin: 18px 0 6px; }
.prose p, .prose li { font-size: 15px; line-height: 1.55; }
.prose ul { padding-left: 18px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0 20px; }
.prose th, .prose td { border-bottom: 1px solid #e6e6e6; text-align: left; padding: 8px 6px; vertical-align: top; }
.profile-who { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.banner { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; margin-bottom: 10px; display: block; }
.lesson-layout { max-width: 1100px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr); gap: 24px; align-items: start; }
.video-slot { position: sticky; top: 16px; background: #111; color: #fff; border-radius: 16px; min-height: 180px; overflow: hidden; }
.video-slot iframe { width: 100%; aspect-ratio: 16/9; border: 0; display: block; }
.video-slot .empty { color: #ddd; padding: 24px; }
.btn.solid.is-done, .btn.is-done { background: #1f8a4c; color: #fff; border-color: #1f8a4c; }
.celebrate { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none; }
.celebrate[hidden] { display: none; }
.celebrate-card { background: #fff; border: 1px solid #e6e6e6; border-radius: 24px; padding: 28px 36px; text-align: center; box-shadow: 0 24px 80px rgba(0,0,0,.14); }
.celebrate-kicker { margin: 0 0 6px; color: #1f8a4c; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
.celebrate-title { margin: 0; font-size: 1.35rem; font-weight: 600; }
fieldset.stack { border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin: 0; }

@media (max-width: 860px) {
    .profile-page { grid-template-columns: 1fr; gap: 8px; }
    .profile-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 8px 18px; padding-top: 0; }
    .profile-nav button { margin-top: 0; }
    .hero-row { min-height: 0; }
    .pastel { opacity: 0.45; width: 100%; height: 220px; right: 0; top: -10px; }
    .suite-banner { height: 64px; padding: 0 14px; }
    .suite-banner img { height: 44px; }
    .site-bar, .game-bar { gap: 10px; padding-left: 14px; padding-right: 14px; }
    .brand span { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
    .bar-spacer { display: none; }
    .menu-btn { display: inline-flex; align-items: center; margin-left: auto; }
    .site-bar { flex-wrap: wrap; height: auto; min-height: var(--bar); padding-top: 8px; padding-bottom: 8px; }
    .site-nav, .game-bar .game-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        width: 100%;
        background: #fff;
        padding: 6px 0 8px;
    }
    .site-nav.is-open, .game-bar .game-nav.is-open { display: flex; }
    .site-nav a, .game-nav a { padding: 12px 8px; font-size: 16px; }
    .gd-suite-link { width: 100%; text-align: left; padding: 12px 8px; font-size: 16px; }
    .gd-suite-panel {
        position: static; width: auto; margin-top: 4px; box-shadow: none;
        display: none; visibility: visible; opacity: 1; pointer-events: auto;
    }
    .gd-suite.is-open .gd-suite-panel { display: block; }
    .site-nav .gd-suite-panel a { font-size: 14px; padding: 10px 12px; }
    .game-bar { flex-wrap: nowrap; height: var(--bar); overflow: visible; }
    .game-bar .game-nav {
        position: absolute; top: 100%; left: 0; right: 0;
        border-bottom: 1px solid var(--line);
        padding: 8px 14px 12px;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
    }
    .search { order: 5; width: 100%; flex: 1 0 100%; margin-top: 6px; }
    .bar-actions .btn { min-height: 40px; }
    .deck { grid-template-columns: 1fr; padding: 0 16px; margin-top: 28px; }
    .main-world, .side-world, .main-world canvas, .side-world canvas { min-height: 420px; height: 420px; }
    .chat-panel, .console-panel { position: static; width: auto; margin: 10px; }
    .q-panel { position: static; transform: none; width: auto; margin: 10px; }
    .main-world { display: flex; flex-direction: column; }
    .main-world canvas { order: -1; height: 280px; min-height: 280px; }
    .wrap { padding: 28px 16px 24px; }
    .signup { width: 100%; }
    .signup input { width: 1px; flex: 1; min-width: 0; }
    .actions-row .btn.wide, .stack .btn { width: 100%; min-height: 48px; }
    .page { padding: 28px 16px 64px; }
    .q-options { grid-template-columns: 1fr; }
    .version-circles a { width: 64px; height: 64px; }
    .lesson-layout { grid-template-columns: 1fr; }
    .video-slot { position: static; }
}

/* =====================================================================
   Games. One text system on v1–v5 and /play, loaded after each page's CSS.
   ===================================================================== */
body.igd-game,
body.igd-game button,
body.igd-game input,
body.igd-game textarea,
body.igd-game select,
body.igd-game h1,
body.igd-game h2,
body.igd-game h3,
body.igd-game h4,
body.igd-game p,
body.igd-game li,
body.igd-game label,
body.igd-game a,
body.igd-game span {
    font-family: var(--font) !important;
}

body.igd-game #lobby,
body.igd-game #lobby-modal {
    background: #fff !important;
    color: #111 !important;
}
body.igd-game :is(
    .lobby-card, .panel-side, #studio-panel, .panel, #stats, #leaderboard,
    #ui, #chat, #chat-container, #time-dial, #lesson-card, .about-box,
    .about-popup-content, #anim-bar, .anim-bar, #dial, #toast, .modal-box,
    #emote-bar, .home-link, .back-btn, .top-nav, .tag > span, .nametag
) {
    background: #fff !important;
    color: #111 !important;
    border-color: #e6e6e6 !important;
    text-shadow: none !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06) !important;
}
body.igd-game :is(
    .lobby-card, .panel-side, #studio-panel, .panel, #stats, #leaderboard,
    #ui, #lesson-card, .about-box, .about-popup-content, .modal-box, #hud, #lobby
) :is(h1, h2, h3, h4, p, li, label, span, a, small, div) {
    color: #111 !important;
    text-shadow: none !important;
    font-family: var(--font) !important;
}
body.igd-game :is(.stage-title, .studio-top, .drag-hint, #help, #anim-explain) {
    color: #111 !important;
    text-shadow: none !important;
}
body.igd-game .stage-title,
body.igd-game .drag-hint {
    background: rgba(255, 255, 255, 0.94) !important;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 8px 12px;
}
body.igd-game .panel-actions { background: #fff !important; }
body.igd-game .hero-title {
    background: none !important;
    -webkit-text-fill-color: #111 !important;
    color: #111 !important;
}
/* The white menu is fixed over the game. Drop the whole screen below it
   so titles, health, and the join card are not sliced off. */
body.igd-game :is(#lobby, #lobby-modal, #studio) {
    top: var(--bar) !important;
    bottom: 0 !important;
    height: auto !important;
}
body.igd-game .modal-box {
    max-height: calc(100dvh - var(--bar) - 28px);
    overflow: auto;
}
body.igd-game .studio-top {
    top: 16px !important;
    background: #fff !important;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 8px 12px;
    color: #111 !important;
}
body.igd-game .studio-top h1,
body.igd-game .studio-top h1 span {
    color: #111 !important;
    text-shadow: none !important;
    background: transparent !important;
    font-size: 18px !important;
}

body.igd-game button:not(.sw):not(.swatch-btn) {
    font-family: var(--font) !important;
    background: #fff !important;
    color: #111 !important;
    border: 1px solid #111 !important;
    border-radius: 999px !important;
    box-shadow: none !important;
}
body.igd-game button:not(.sw):not(.swatch-btn):hover {
    background: #f6f6f6 !important;
}
body.igd-game :is(button.on, button[aria-pressed="true"], #join-btn, #enter-btn, .btn-gold):not(.sw):not(.swatch-btn) {
    background: #111 !important;
    color: #fff !important;
    border-color: #111 !important;
}
body.igd-game .sw.on,
body.igd-game .swatch-btn[aria-pressed="true"] {
    outline: 2px solid #111 !important;
    box-shadow: none !important;
}
body.igd-game :is(input[type="text"], input[type="search"], #username-input, #name-input, #chat-input) {
    background: #fff !important;
    color: #111 !important;
    border: 1px solid #ccc !important;
    border-radius: 10px !important;
    font-family: var(--font) !important;
}
body.igd-game .about-scroll,
body.igd-game .about-scroll h2,
body.igd-game .about-scroll h3,
body.igd-game .about-scroll p,
body.igd-game .about-scroll li,
body.igd-game #about-toc a {
    color: #111 !important;
    font-family: var(--font) !important;
}
body.igd-game .about-scroll pre,
body.igd-game .about-scroll code {
    background: #f6f6f6 !important;
    color: #111 !important;
}
body.igd-game #about-modal,
body.igd-game #about-popup { z-index: 900 !important; }
body.igd-game > #hud { top: var(--bar) !important; }
body.igd-game > #stats,
body.igd-game > #ui,
body.igd-game > #time-dial,
body.igd-game > .back-btn,
body.igd-game > .top-nav,
body.igd-game #global-nav,
body.igd-game #about-game-btn { top: calc(var(--bar) + 12px) !important; }
body.igd-game > #ui { max-width: calc(100vw - 24px); }
body.igd-game .home-link {
    top: calc(var(--bar) + 12px) !important; bottom: auto !important;
    right: 16px !important; left: auto !important;
    background: #fff !important; color: #111 !important;
    border: 1px solid #111 !important; border-radius: 999px !important;
    text-decoration: none;
}
body.igd-game > #leaderboard { top: calc(var(--bar) + 64px) !important; }
body.igd-game > #minimap-wrap { top: calc(var(--bar) + 170px) !important; }
@media (max-width: 720px) {
    body.igd-game > #stats,
    body.igd-game > #ui { width: min(168px, 46vw) !important; padding: 10px !important; }
    body.igd-game > #leaderboard { width: min(168px, 46vw) !important; }
    body.igd-game > #time-dial { width: min(150px, 42vw) !important; }
    body.igd-game #chat,
    body.igd-game #chat-container {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        left: 10px !important;
        right: auto !important;
    }
    body.igd-game #lobby { overflow: auto !important; }
    body.igd-game .stage-title h1 { font-size: 26px !important; }
}
body.igd-game .version-link {
    background: #fff !important; color: #111 !important;
    border: 1px solid #111 !important; border-radius: 999px !important;
}
body.igd-game #lesson-options button.right { background: #111 !important; color: #fff !important; }
body.igd-game #lesson-options button.wrong { background: #fff !important; color: #111 !important; text-decoration: line-through; }
body.igd-game #color-error { color: #111 !important; }

/* Chat, the same card on every version. */
body.igd-game :is(#chat, #chat-container) {
    padding: 10px 12px !important;
    border-radius: 16px !important;
    border: 1px solid #e6e6e6 !important;
    width: min(320px, calc(100vw - 24px)) !important;
}
body.igd-game :is(#chat-log, #messages) {
    max-height: 112px;
    overflow-y: auto;
    margin: 0 0 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    line-height: 1.4;
    text-shadow: none !important;
    color: #111;
}
body.igd-game :is(#chat-log, #messages) .sys,
body.igd-game .msg.system {
    color: #666 !important;
    font-style: italic;
}
body.igd-game #chat-input {
    width: 100% !important;
    box-sizing: border-box;
    padding: 8px 10px !important;
    border-radius: 10px !important;
    border: 1px solid #ccc !important;
    background: #f6f6f6 !important;
    color: #111 !important;
    font: 500 13px var(--font) !important;
    text-shadow: none !important;
    outline: none;
}
body.igd-game #chat-input::placeholder { color: #888; }

/* Phones and tablets: one control deck, one open panel, nothing piled up. */
body.igd-compact :is(#chat, #chat-container, #stats, #ui, #leaderboard, #minimap-wrap, #time-dial, .version-container) {
    display: none !important;
}
body.igd-compact :is(#help, .version-container) {
    display: none !important;
}
body.igd-compact #mobile-deck {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px)) 156px;
    pointer-events: none;
    background: linear-gradient(to top, rgba(255,255,255,.92), rgba(255,255,255,0));
}
body.igd-compact #mobile-deck.no-joy { padding-left: 8px; }
body.igd-compact #mobile-deck .mobile-actions,
body.igd-compact #mobile-deck .mobile-tabs { pointer-events: auto; }
body.igd-compact .mobile-actions,
body.igd-compact .mobile-tabs {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
}
body.igd-compact .mobile-actions:not(:has(button:not([hidden]))) { display: none; }
body.igd-compact .mobile-tabs button {
    flex: 1 0 auto;
    min-width: 72px;
    min-height: 44px;
    padding: 8px 12px !important;
    background: #fff !important;
    color: #111 !important;
    border: 1px solid #111 !important;
    border-radius: 999px !important;
    white-space: nowrap;
}
body.igd-compact .mobile-tabs button.on {
    background: #111 !important;
    color: #fff !important;
}
body.igd-compact #emote-bar,
body.igd-compact #emote-bar .row {
    position: static !important;
    transform: none !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 6px;
    width: auto !important;
    max-width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow-x: auto;
}
body.igd-compact #emote-bar button {
    flex: none;
    min-height: 44px;
    background: #fff !important;
    color: #111 !important;
    border: 1px solid #111 !important;
    border-radius: 999px !important;
    white-space: nowrap;
}
body.igd-compact #emote-bar kbd { display: none !important; }
body.igd-compact #action-btn {
    position: static !important;
    transform: none !important;
    animation: none !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    flex: none;
    min-height: 44px;
    background: #111 !important;
    color: #fff !important;
    border-radius: 999px !important;
}
body.igd-compact #speed-bar.mobile-speed {
    display: flex !important;
    position: fixed;
    top: calc(var(--bar) + var(--cookie, 0px) + 8px);
    left: 8px;
    max-width: calc(100vw - 136px);
    z-index: 30;
    gap: 6px;
    overflow-x: auto;
    pointer-events: auto;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}
body.igd-compact #speed-bar.mobile-speed button {
    flex: none;
    min-height: 36px;
    background: #fff !important;
    color: #111 !important;
    border: 1px solid #111 !important;
    border-radius: 999px !important;
    white-space: nowrap;
}
body.igd-compact #speed-bar.mobile-speed button.on {
    background: #111 !important;
    color: #fff !important;
}
body.igd-compact #mobile-sheet {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--deck, 120px) + var(--keyboard, 0px) + 8px);
    z-index: 54;
    max-height: min(42vh, calc(100dvh - var(--bar) - var(--deck, 120px) - var(--keyboard, 0px) - 24px));
    overflow: auto;
    pointer-events: auto;
    background: #fff;
    color: #111;
    border: 1px solid #e6e6e6;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.12);
    padding: 12px;
}
body.igd-compact #mobile-sheet :is(#chat, #chat-container, #stats, #ui, #leaderboard, #minimap-wrap, #time-dial) {
    display: flex !important;
    flex-direction: column;
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    pointer-events: auto !important;
    overflow: visible !important;
}
body.igd-compact #mobile-sheet .chat-compose {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}
body.igd-compact #mobile-sheet .chat-compose #chat-input {
    width: auto !important;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
}
body.igd-compact #mobile-sheet .chat-send {
    flex: none;
    min-height: 44px;
    padding: 8px 14px !important;
    background: #111 !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 10px !important;
}
body.igd-compact #lesson-card.mobile-lesson {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    bottom: calc(var(--deck, 120px) + var(--keyboard, 0px) + 8px) !important;
    transform: none !important;
    z-index: 70 !important;
    max-height: min(46vh, calc(100dvh - var(--deck, 120px) - var(--keyboard, 0px) - 80px));
    overflow: auto;
    pointer-events: auto !important;
}
body.igd-compact #lesson-card.mobile-lesson button { min-height: 44px; }
body.igd-compact :is(#joystick, #joystick-base) {
    display: block !important;
    z-index: 56;
    bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
    pointer-events: auto !important;
}

/* Phones: the character must stay in view. Titles sit beside the picture, not on it. */
@media (max-width: 900px) {
    body.igd-game #lobby {
        background: #101426 !important;
        grid-template-rows: minmax(340px, 54vh) minmax(0, 1fr) !important;
    }
    body.igd-game .stage {
        display: flex !important;
        flex-direction: column !important;
        min-height: 0;
    }
    body.igd-game #studio-canvas {
        order: 2;
        flex: 1 1 auto !important;
        min-height: 220px !important;
    }
    body.igd-game .stage-title { order: 1; }
    body.igd-game .drag-hint { order: 3; }
    body.igd-game .anim-bar { order: 4; }
    body.igd-game .stage-title,
    body.igd-game .drag-hint,
    body.igd-game .studio-top,
    body.igd-game #studio-stage #anim-bar {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        padding: 6px 12px 0 !important;
        max-width: none !important;
        width: auto !important;
        transform: none !important;
        text-align: left;
    }
    body.igd-game #studio-stage {
        display: flex !important;
        flex-direction: column !important;
    }
    body.igd-game #studio-canvas {
        order: 2;
        flex: 1 1 auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: 200px !important;
    }
    body.igd-game .studio-top { order: 1; }
    body.igd-game #studio-stage #anim-bar { order: 3; background: #fff !important; border-radius: 16px; margin: 0 8px 8px; }
    body.igd-game #studio-stage .drag-hint { order: 4; }
    body.igd-game #studio-stage .studio-top {
        background: #fff !important;
        border-radius: 12px;
        margin: 8px 10px 0;
        padding: 8px 12px !important;
    }
    body.igd-game .stage .stage-title {
        background: #fff !important;
        border: 1px solid #e6e6e6 !important;
        border-radius: 12px;
        margin: 8px 10px 0;
        padding: 8px 12px !important;
    }
    body.igd-game .stage .drag-hint { color: #fff !important; }
    body.igd-game .stage-title h1 { font-size: 22px !important; margin: 0 !important; }
    body.igd-game .stage-title p,
    body.igd-game .drag-hint { margin: 2px 0 0 !important; font-size: 13px !important; }
    body.igd-game #studio {
        flex-direction: column !important;
    }
    body.igd-game #studio-stage {
        flex: none !important;
        height: 54vh !important;
        min-height: 320px !important;
    }
    body.igd-game #studio-panel {
        width: 100% !important;
        max-width: none !important;
        flex: 1 !important;
    }
    body.igd-game #lobby-modal .modal-box {
        flex-direction: column !important;
    }
    body.igd-game #lobby-modal .modal-right {
        order: -1;
        width: 100% !important;
        height: 280px !important;
        min-height: 280px !important;
    }
}
