/* House of Turns: shared look (copied from the 4Connecting page so every page matches). */
:root {
  --paper: #f5efe4;
  --paper-deep: #ece3d3;
  --card: #fffcf6;
  --card-alt: #fff7df;
  --hole: #fbf7ef;
  --ink: #1f2233;
  --ink-soft: #4a4c5c;
  --muted: #7b7a82;
  --line: #e4dac8;
  --on-ink: #f5efe4;
  --ink-shadow: #000;
  --bubble-mine: #1f2233;
  --bubble-mine-text: #f5efe4;
  --bubble-theirs: #efe7d8;
  --glow-a: rgba(246,196,49,.22);
  --glow-b: rgba(29,95,216,.12);
  --blue: #1d5fd8;
  --blue-deep: #1447a8;
  --blue-light: #3d7cf0;
  --blue-base: #0f3a8c;
  --red: #e8423f;
  --red-deep: #b52622;
  --yellow: #f6c431;
  --yellow-deep: #c98f08;
  --green: #22a75d;
  --active-token: var(--red);
  --display: 'Fraunces', Georgia, serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 22px;
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 12px 30px -18px rgba(60,40,10,.35), 0 2px 6px -2px rgba(60,40,10,.12);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15161d; --paper-deep: #22242e; --card: #1c1e27; --card-alt: #232330; --hole: #0d0e13;
    --ink: #efebe3; --ink-soft: #c7c3ba; --muted: #8e8c95; --line: #2c2e39; --on-ink: #15161d; --ink-shadow: #6f6c66;
    --bubble-mine: #3d7cf0; --bubble-mine-text: #fff; --bubble-theirs: #2a2c37;
    --glow-a: rgba(246,196,49,.08); --glow-b: rgba(61,124,240,.12);
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 14px 30px -16px rgba(0,0,0,.7), 0 2px 6px -2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15161d; --paper-deep: #22242e; --card: #1c1e27; --card-alt: #232330; --hole: #0d0e13;
  --ink: #efebe3; --ink-soft: #c7c3ba; --muted: #8e8c95; --line: #2c2e39; --on-ink: #15161d; --ink-shadow: #6f6c66;
  --bubble-mine: #3d7cf0; --bubble-mine-text: #fff; --bubble-theirs: #2a2c37;
  --glow-a: rgba(246,196,49,.08); --glow-b: rgba(61,124,240,.12);
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 14px 30px -16px rgba(0,0,0,.7), 0 2px 6px -2px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 88% -10%, var(--glow-a), transparent 60%),
    radial-gradient(800px 520px at -10% 110%, var(--glow-b), transparent 60%),
    var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue-light); outline-offset: 2px; }

.shell { width: min(1180px, 100%); margin: 0 auto; padding: 18px 20px 28px; min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 18px; }
.brand { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px; border-radius: 12px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--blue); display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 6px; box-shadow: 0 3px 0 var(--blue-deep); transform: rotate(-6deg); transition: transform .3s; }
.brand:hover .brand-mark { transform: rotate(6deg); }
.brand-mark i { border-radius: 50%; background: var(--red); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { background: var(--yellow); }
.brand-name { font: 700 1.4rem/1 var(--display); letter-spacing: -.02em; }
.top-actions { display: flex; align-items: center; gap: 4px; }
.net { display: inline-flex; align-items: center; gap: 7px; margin-right: 8px; color: var(--muted); font-size: .85rem; }
.status-light { width: 8px; height: 8px; border-radius: 50%; background: #c4bba9; }
.status-light.live { background: var(--green); box-shadow: 0 0 0 4px rgba(34,167,93,.15); }
.status-light.error { background: var(--red); box-shadow: 0 0 0 4px rgba(232,66,63,.15); }
.nav-button { border: 0; background: transparent; padding: 9px 14px; border-radius: 999px; font-weight: 600; font-size: .92rem; color: var(--ink-soft); transition: background .15s, color .15s; }
.nav-button:hover, .nav-button:focus-visible { background: var(--card); color: var(--ink); }
.icon-only { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; }
.icon-only svg { width: 20px; height: 20px; fill: currentColor; }
.sound-button.muted svg { opacity: .35; }
.sun { display: none; }
:root[data-theme="dark"] .sun { display: block; }
:root[data-theme="dark"] .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sun { display: block; }
  :root:not([data-theme="light"]) .moon { display: none; }
}


/* ---------- Shared pieces ---------- */
.primary-button, .secondary-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 50px; padding: 12px 22px; border: 0; border-radius: 999px; font-weight: 700; font-size: 1rem; transition: transform .12s, box-shadow .12s, background .15s; }
.primary-button { background: var(--ink); color: var(--on-ink); box-shadow: 0 4px 0 var(--ink-shadow); }
.secondary-button { background: var(--blue); color: #fff; box-shadow: 0 4px 0 var(--blue-deep); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink-shadow); }
.secondary-button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--blue-deep); }
.primary-button:disabled, .secondary-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.kicker { margin: 0 0 8px; color: var(--muted); font-size: .92rem; font-weight: 600; }
input:not([type=checkbox]) { width: 100%; padding: 13px 16px; border: 2px solid var(--line); border-radius: 14px; background: var(--hole); outline: none; font-size: 1.05rem; transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: var(--blue-light); box-shadow: 0 0 0 4px rgba(61,124,240,.16); }
input::placeholder { color: var(--muted); opacity: .7; }
.modal { width: min(560px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 32px; border: 0; border-radius: 28px; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); overflow: auto; }
.modal::backdrop { background: rgba(20,22,32,.5); }
.modal[open] { animation: pop .25s ease-out; }
@keyframes pop { from { opacity: 0; } }
.modal-close { position: absolute; top: 16px; right: 16px; z-index: 3; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--paper); font-size: 1.4rem; line-height: 1; }
.modal-close:hover { background: var(--paper-deep); }
.modal h2 { margin: 0 0 18px; font: 700 2.2rem/1.05 var(--display); letter-spacing: -.02em; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 60; max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: .92rem; text-align: center; opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.text-button { border: 0; background: none; color: var(--muted); font-weight: 600; padding: 8px 12px; border-radius: 999px; }
.text-button:hover { color: var(--ink); background: var(--paper); }
.field { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--ink-soft); }
.field em { font-style: normal; font-weight: 500; color: var(--muted); }
.danger-button { padding: 10px 18px; border: 2px solid var(--red); border-radius: 999px; background: none; color: var(--red); font-weight: 700; }
.danger-button:hover, .danger-button.solid { background: var(--red); color: #fff; }
.danger-button.solid { display: inline-flex; justify-content: center; align-items: center; min-height: 50px; }

/* ---------- House of Turns home ---------- */
a { color: inherit; }
.primary-button, .secondary-button { text-decoration: none; }
.ghost-button { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 12px 22px; border-radius: 999px; font-weight: 700; text-decoration: none; box-shadow: inset 0 0 0 2px var(--line); background: var(--card); transition: transform .12s; }
.ghost-button:hover { transform: translateY(-1px); }
.nav-button { text-decoration: none; }

/* Brand: a little house with two turn counters */
.brand { text-decoration: none; }
.brand-mark.house { display: block; position: relative; padding: 0; background: var(--ink); box-shadow: 0 3px 0 var(--ink-shadow); }
.brand-mark.house svg { width: 100%; height: 100%; display: block; }
.house-roof { fill: none; stroke: var(--on-ink); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.house-red { fill: var(--red); }
.house-yellow { fill: var(--yellow); }

/* Hero */
.home-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; padding: 30px 0 36px; }
.home-hero h1 { margin: 0; font: 700 clamp(2.6rem, 6vw, 5rem)/1 var(--display); letter-spacing: -.035em; }
.home-hero h1 span { display: block; }
.home-hero h1 em { font-style: italic; font-weight: 600; color: var(--blue-light); }
.home-hero h1 span:last-child em { color: var(--red); }
.home-hero .lede { max-width: 34rem; margin: 22px 0 0; color: var(--ink-soft); font-size: 1.12rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.table-art { position: relative; justify-self: center; width: min(400px, 100%); aspect-ratio: 1.15; border-radius: 40% 40% 34% 34% / 30% 30% 26% 26%; background: radial-gradient(circle at 50% 40%, #2f8a5b, #1d6b43 70%); box-shadow: 0 14px 0 #7a4a24, 0 16px 0 #5d3517, 0 40px 50px -26px rgba(40,20,5,.6), inset 0 0 0 10px rgba(255,255,255,.06); }
.table-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.table-art .t-float { animation: bob 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.table-art .t-float.late { animation-delay: -1.6s; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { .table-art .t-float { animation: none; } }

/* Invite code bar */
.code-bar { display: grid; grid-template-columns: 1fr minmax(0, 360px); gap: 12px 24px; align-items: center; margin-bottom: 44px; padding: 20px 24px; border-radius: var(--radius); background: var(--card-alt); box-shadow: var(--shadow); }
.code-bar h2 { margin: 0; font: 700 1.35rem/1.2 var(--display); }
.code-bar p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.code-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.code-form input { font-weight: 700; letter-spacing: .3em; text-transform: uppercase; }
.code-message { grid-column: 1 / -1; margin: 0; color: var(--red-deep); font-weight: 600; font-size: .9rem; }
.resume-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: -24px 0 32px; padding: 14px 18px; border-radius: 18px; background: color-mix(in srgb, var(--green) 14%, var(--card)); font-weight: 600; }
.resume-bar .secondary-button { min-height: 42px; padding: 8px 18px; }

/* Game catalogue */
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 24px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font: 700 clamp(2rem, 3.6vw, 2.8rem)/1.05 var(--display); letter-spacing: -.03em; }
.section-head p { margin: 6px 0 0; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button { padding: 8px 14px; border: 0; border-radius: 999px; background: var(--card); color: var(--ink-soft); font-weight: 600; font-size: .9rem; box-shadow: inset 0 0 0 1px var(--line); }
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.game-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.game-card:hover, .game-card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow), 0 18px 30px -20px rgba(60,40,10,.4); }
.game-card .art-wrap { display: grid; place-items: center; height: 118px; margin: -6px -6px 2px; border-radius: 16px; background: var(--paper); }
.game-card .art { width: 104px; height: 104px; }
.game-card h3 { margin: 0; padding-right: 90px; font: 700 1.35rem/1.15 var(--display); letter-spacing: -.01em; }
.game-card .aka { margin: -8px 0 0; color: var(--muted); font-size: .85rem; font-weight: 600; }
.game-card .blurb { margin: 0; color: var(--ink-soft); font-size: .93rem; }
.game-card .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: auto; padding-top: 6px; color: var(--muted); font-size: .82rem; }
.status { padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--paper-deep); color: var(--ink-soft); white-space: nowrap; }
.game-card .status { position: absolute; top: 146px; right: 16px; }
.status.live { background: var(--green); color: #fff; }
.status.dev { background: var(--yellow); color: #1f2233; }
.twist-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.twist-chips li { padding: 3px 9px; border-radius: 999px; background: var(--paper); font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.game-card.featured { grid-column: span 2; display: grid; grid-template-columns: 200px 1fr; align-content: start; gap: 8px 22px; background: var(--card-alt); }
.game-card.featured > :not(.art-wrap) { grid-column: 2; }
.game-card.featured .art-wrap { grid-column: 1; grid-row: 1 / span 7; height: auto; min-height: 210px; margin: 0; background: var(--card); }
.game-card.featured .art { width: 160px; height: 160px; }
.game-card.featured .status { position: static; justify-self: start; }
.game-card.featured h3 { padding: 0; font-size: 2rem; }
.game-card.featured .aka { margin: -4px 0 0; }
.game-card.featured .meta { margin-top: 0; padding: 0; }
.game-card.featured .play-now { justify-self: start; margin-top: 4px; }
.game-card.featured .twist-chips li { background: var(--card); }
.empty-note { grid-column: 1 / -1; padding: 30px; text-align: center; color: var(--muted); }

/* How it works + accounts */
.band { margin-top: 64px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding: 24px 22px 22px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 14px; border-radius: 50%; background: var(--red); color: #fff; font: 700 1rem var(--display); }
.steps li:nth-child(2)::before { background: var(--yellow); color: #1f2233; }
.steps li:nth-child(3)::before { background: var(--blue); }
.steps h3 { margin: 0 0 6px; font: 700 1.3rem/1.2 var(--display); }
.steps p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.who-card { display: flex; flex-direction: column; gap: 8px; padding: 26px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.who-card.account { background: var(--ink); color: var(--on-ink); }
.who-card.account p, .who-card.account li { color: color-mix(in srgb, var(--on-ink) 80%, transparent); }
.who-card h3 { margin: 0; font: 700 1.6rem/1.15 var(--display); }
.who-card p { margin: 0; color: var(--ink-soft); }
.who-card ul { margin: 4px 0 14px; padding-left: 20px; color: var(--ink-soft); display: grid; gap: 4px; }
.who-card.account .primary-button { align-self: start; margin-top: auto; background: var(--on-ink); color: var(--ink); box-shadow: 0 4px 0 var(--muted); }
.who-card .ghost-button { align-self: start; margin-top: auto; }
.fine-print { margin: 16px 0 0; color: var(--muted); font-size: .85rem; }

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
footer p { margin: 0; max-width: 52rem; }
footer .text-button { padding: 0; font-size: .85rem; }
footer .text-button:hover { background: none; text-decoration: underline; }
.privacy-list { display: grid; gap: 12px; margin: 0 0 24px; padding-left: 20px; color: var(--ink-soft); }

/* Game art (art.js) */
.art .a-blue { fill: var(--blue); } .art .a-red { fill: var(--red); } .art .a-yellow { fill: var(--yellow); } .art .a-green { fill: var(--green); }
.art .a-ink { fill: var(--ink); } .art .a-paper { fill: #f7f1e6; stroke: #1f2233; stroke-width: 1.5; } .art .a-paper-o { fill: var(--card); stroke: var(--line); stroke-width: 2; }
.art .a-hole { fill: var(--hole); } .art .a-disc-dark { fill: #1f2233; stroke: rgba(255,255,255,.25); } .art .a-disc-light { fill: #f7f1e6; } .art .a-card { fill: #fffdf8; stroke: #d9cfbd; stroke-width: 1; }
.art .a-back { fill: var(--blue); } .art .a-back-in { fill: none; stroke: rgba(255,255,255,.55); stroke-width: 1.5; stroke-dasharray: 3 2; }
.art .a-rank { fill: #1f2233; font: 700 10px var(--body); } .art .a-suit { fill: #1f2233; font: 18px var(--body); } .art .a-red-t { fill: #d13532; }
.art .a-chip-ring { fill: none; stroke: rgba(255,255,255,.8); stroke-width: 1.6; stroke-dasharray: 3 2.5; }
.art .a-big { fill: var(--ink); font: 800 20px var(--display); } .art .a-bang { fill: #fff; font: 800 13px var(--body); }
.art .a-die { fill: #fffdf8; stroke: #d9cfbd; stroke-width: 1.2; } .art .a-pip { fill: #1f2233; } .art .a-pip-w { fill: rgba(255,255,255,.7); }
.art .a-board-light { fill: #f2dfbf; } .art .a-board-dark { fill: #9b6a3c; } .art .a-wood { fill: #b98556; } .art .a-pit { fill: #7d5330; }
.art .a-sea { fill: #2c6fb0; } .art .a-grid { stroke: rgba(255,255,255,.25); stroke-width: 1; fill: none; } .art .a-hit-ring { fill: none; stroke: #fff; stroke-width: 2; }
.art .a-red-soft { fill: color-mix(in srgb, var(--red) 30%, transparent); }
.art .a-line-ink { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; } .art .a-line-ink.thick { stroke-width: 3.5; }
.art .a-line-red { fill: none; stroke: var(--red); stroke-width: 3.5; stroke-linecap: round; } .art .a-line-blue { fill: none; stroke: var(--blue-light); stroke-width: 3.5; }

/* Game detail page */
.detail { display: grid; grid-template-columns: 300px 1fr; gap: 36px; align-items: start; padding: 20px 0; }
.detail-art { display: grid; place-items: center; aspect-ratio: 1; border-radius: 28px; background: var(--card); box-shadow: var(--shadow); }
.detail-art .art { width: 72%; height: 72%; }
.detail h1 { margin: 12px 0 4px; font: 700 clamp(2.4rem, 5vw, 3.8rem)/1 var(--display); letter-spacing: -.03em; }
.detail .aka { margin: 0 0 16px; color: var(--muted); font-weight: 600; }
.detail .lede { margin: 0 0 18px; color: var(--ink-soft); font-size: 1.12rem; max-width: 40rem; }
.detail .status { display: inline-block; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 26px; }
.detail-grid section { padding: 22px 24px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.detail-grid section.twists { background: var(--card-alt); }
.detail-grid h2 { margin: 0 0 12px; font: 700 1.35rem/1.2 var(--display); }
.detail-grid ol, .detail-grid ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-soft); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: .92rem; font-weight: 600; }
.detail .hero-cta { margin-top: 20px; }
.soon-note { margin: 22px 0 0; padding: 14px 18px; border-radius: 16px; background: var(--paper-deep); color: var(--ink-soft); }

@media (max-width: 960px) {
  .home-hero { grid-template-columns: 1fr; gap: 24px; }
  .table-art { width: min(320px, 80%); order: -1; }
  .steps { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; gap: 20px; }
  .detail-art { width: min(220px, 60%); }
}
@media (max-width: 640px) {
  .shell { padding: 12px 16px 20px; }
  .brand-name { font-size: 1.1rem; }
  .nav-button { padding: 8px 9px; font-size: .84rem; }
  .icon-only { width: 36px; height: 36px; }
  .nav-wide { display: none; }
  .home-hero { padding: 6px 0 24px; }
  .table-art { display: none; }
  .home-hero h1 { font-size: 2.6rem; }
  .code-bar { grid-template-columns: 1fr; padding: 18px; margin-bottom: 32px; }
  .game-card.featured { grid-column: auto; grid-template-columns: 1fr; }
  .game-card.featured > :not(.art-wrap) { grid-column: 1; }
  .game-card.featured .art-wrap { grid-row: auto; min-height: 150px; }
  .game-card.featured .art { width: 120px; height: 120px; }
  .who { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .modal { padding: 26px 20px; }
}
