/* Syd the Cat Games — portal styles. No framework; system fonts; light and dark.
   Black and white, like Syd: a tuxedo cat. The only colour is for status (ok / warning / error). */

:root {
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-2: #efefef;
  --ink: #111111;
  --ink-2: #4a4a4a;
  --ink-3: #767676;
  --line: #dedede;
  --accent: #111111;
  --accent-ink: #ffffff;
  --accent-soft: #e8e8e8;
  --ok: #2f7d4f;
  --ok-soft: #e1f2e7;
  --warn: #9a6b00;
  --warn-soft: #fbf0cf;
  --bad: #b3372b;
  --bad-soft: #fbe3e0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .06);
  --radius: 14px;
  --radius-small: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0b;
    --surface: #161616;
    --surface-2: #202020;
    --ink: #f5f5f5;
    --ink-2: #bdbdbd;
    --ink-3: #8c8c8c;
    --line: #2f2f2f;
    --accent: #f5f5f5;
    --accent-ink: #0b0b0b;
    --accent-soft: #2c2c2c;
    --ok: #6cc38f;
    --ok-soft: #1c3326;
    --warn: #e5b64a;
    --warn-soft: #3a2f13;
    --bad: #f08a7e;
    --bad-soft: #3d1f1b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-bottom: 64px; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h2 { font-size: 1.35rem; margin-top: 1.6em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
code, kbd, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
pre {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-small);
  padding: 14px 16px; overflow-x: auto; line-height: 1.5; margin: 0 0 1em;
}
pre code { background: none; padding: 0; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); font-size: .9em; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .9em; }
.right { text-align: right; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Header ----------------------------------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none;
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
.brand-tld { color: var(--ink-3); }
.main-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.main-nav a { color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 550; white-space: nowrap; }
.main-nav a:hover { background: var(--surface-2); color: var(--ink); }
.main-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.header-account { margin-left: auto; }
@media (max-width: 640px) {
  .header-row { gap: 10px; }
  .brand span { display: none; }
  .main-nav a { padding: 8px 9px; }
}

.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: block; object-fit: cover; }
.avatar-letter { background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; }
.avatar-button { border-radius: 50%; }
.avatar-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 20;
}
.menu-panel a, .menu-panel .linklike { display: block; width: 100%; text-align: left; padding: 8px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font: inherit; }
.menu-panel a:hover, .menu-panel .linklike:hover { background: var(--surface-2); }
.menu-who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; }
.menu-who span { color: var(--ink-3); font-size: .85em; overflow: hidden; text-overflow: ellipsis; }

/* Footer ------------------------------------------------------------------------------------ */
.site-footer { border-top: 1px solid var(--line); color: var(--ink-3); font-size: .9em; }
.footer-row { display: flex; justify-content: space-between; gap: 16px; padding-top: 20px; padding-bottom: 20px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 16px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }

/* Buttons & forms ---------------------------------------------------------------------------- */
.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  padding: 10px 18px; border-radius: 999px; font: 600 1rem/1.2 var(--font); cursor: pointer; text-decoration: none;
  transition: transform .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px;
}
.btn-small { padding: 7px 14px; font-size: .9rem; }
.btn-large { padding: 14px 26px; font-size: 1.1rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn-danger-ghost:hover { background: var(--bad-soft); filter: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
form.inline { display: inline; }

label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.field { margin-bottom: 16px; }
.field-hint { color: var(--ink-3); font-size: .85rem; font-weight: 400; margin-top: 4px; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea, input[type=file] {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-small); padding: 9px 12px;
}
textarea { min-height: 96px; resize: vertical; }
input[type=file] { padding: 7px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Surfaces ------------------------------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card + .card { margin-top: 18px; }
:where(.grid, .features, .plans, .stats) > .card + .card { margin-top: 0; }
.card + .grid, .grid + .card, .grid + .grid { margin-top: 18px; }
.row-between > h1, .row-between > h2 { margin-top: 0; margin-bottom: 0; }
.section > .row-between + .grid { margin-top: 14px; }
.card-danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.page-head { padding: 36px 0 18px; }
.page-head p { color: var(--ink-2); font-size: 1.1rem; max-width: 640px; }
.section { margin-top: 28px; }

.flash { margin-top: 18px; padding: 12px 16px; border-radius: var(--radius-small); font-weight: 500; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.notice { padding: 14px 16px; border-radius: var(--radius-small); background: var(--surface-2); border: 1px solid var(--line); }
.notice-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.notice-bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.notice-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 650;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); margin-right: 6px; vertical-align: 1px; }
.dot-on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* Tables -------------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 650; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td .faint { display: block; }
.empty { padding: 28px; text-align: center; color: var(--ink-3); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

/* Home ------------------------------------------------------------------------------------------ */
.hero { padding: 64px 0 40px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
.hero p { font-size: 1.2rem; color: var(--ink-2); max-width: 560px; }
.hero-art { display: grid; place-items: center; }
.hero-art img { width: min(300px, 70%); filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .18)); animation: bob 5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-2deg); } }
@media (prefers-reduced-motion: reduce) { .hero-art img { animation: none; } }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; padding-top: 36px; } .hero-art { display: none; } }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin: 12px 0 8px; }
.feature h3 { margin-bottom: .3em; }
.feature p { color: var(--ink-2); margin: 0; }

/* Game cards ------------------------------------------------------------------------------------ */
.game-card { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); overflow: hidden; padding: 0; }
.game-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.game-art { aspect-ratio: 16 / 9; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800;
  font-size: 2rem; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.25); padding: 12px; text-align: center; }
.game-card-body { padding: 16px 18px 18px; }
.game-card-body h3 { margin: 0 0 4px; }
.game-card-body p { color: var(--ink-2); margin: 0; font-size: .95rem; }
.game-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.art-0 { background: linear-gradient(135deg, #3a3a3a, #0e0e0e); }
.art-1 { background: linear-gradient(135deg, #5a5a5a, #1c1c1c); }
.art-2 { background: linear-gradient(160deg, #0e0e0e 55%, #444 55%); }
.art-3 { background: linear-gradient(135deg, #6e6e6e, #2a2a2a); }
.art-4 { background: radial-gradient(circle at 30% 30%, #555, #111 70%); }
.art-5 { background: linear-gradient(20deg, #111 50%, #3c3c3c 50%); }

.game-hero { border-radius: var(--radius); margin: 28px 0 8px; aspect-ratio: auto; min-height: 180px; font-size: clamp(2rem, 6vw, 3.4rem); }

.server-list { display: flex; flex-direction: column; gap: 10px; }
.server-item { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); flex-wrap: wrap; }
.server-item h3 { margin: 0; font-size: 1.05rem; }

/* Pricing ------------------------------------------------------------------------------------------ */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.plan { display: flex; flex-direction: column; }
.plan .price { font-family: var(--font-display); font-size: 2rem; font-weight: 800; margin: 4px 0 10px; }
.plan ul { padding-left: 1.1em; color: var(--ink-2); margin: 0 0 18px; flex: 1; }
.plan-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }

/* Login ---------------------------------------------------------------------------------------------- */
.login-box { max-width: 420px; margin: 56px auto 0; text-align: center; }
.login-box img { width: 72px; }
.google-btn { width: 100%; background: var(--surface); color: var(--ink); border: 1px solid var(--line); gap: 12px; }
.google-btn:hover { background: var(--surface-2); filter: none; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: .85rem; margin: 22px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* Player ---------------------------------------------------------------------------------------------- */
body.playing main { padding-bottom: 0; display: flex; flex-direction: column; }
body.playing .site-footer { display: none; }
.player-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface); flex-wrap: wrap; }
.player-bar h1 { font-size: 1.05rem; margin: 0; }
.player-status { font-size: .9rem; color: var(--ink-2); }
.player-stage { flex: 1; background: #000; position: relative; min-height: calc(100vh - 64px - 56px); }
.player-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.player-ended { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 24px 16px; text-align: center; color: #eee; }
.player-ended h2 { color: #fff; margin: 0; }
.player-ended p { color: #bbb; max-width: 44ch; }
.player-ended .row { justify-content: center; }
.player-ended .btn-ghost { color: #eee; border-color: #555; }

/* Admin ---------------------------------------------------------------------------------------------- */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; padding: 18px 0 0; }
.admin-nav a { padding: 7px 12px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: .95rem; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat { padding: 18px; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.9rem; line-height: 1.1; }
.stat span { color: var(--ink-3); font-size: .9rem; }
.stat a { color: inherit; text-decoration: none; }
details.disclose summary { cursor: pointer; color: var(--accent); font-weight: 550; }
details.disclose[open] summary { margin-bottom: 12px; }
.events { list-style: none; padding: 0; margin: 8px 0 0; font-size: .88rem; color: var(--ink-2); }
.events li { padding: 4px 0; border-top: 1px dashed var(--line); }

.secret { display: flex; gap: 8px; align-items: stretch; }
.secret code { flex: 1; display: block; padding: 10px 12px; word-break: break-all; border: 1px solid var(--line); border-radius: var(--radius-small); }

.prose h2 { margin-top: 1.8em; }
.prose p, .prose li { color: var(--ink-2); }

/* Utilities (the CSP forbids inline style attributes) ------------------------------------------ */
.align-start { align-items: start; }
.lead { color: var(--ink-2); font-size: 1.15rem; }
.mt-0 { margin-top: 0; }
.mt-xs { margin-top: 4px; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 22px; }
.mb-0 { margin-bottom: 0; }
.h-small { font-size: 1.65rem; }
.text-left { text-align: left; }
.w-full { width: 100%; }

/* Controllers ------------------------------------------------------------------------------------ */
.hidden, [hidden] { display: none !important; }
.break { overflow-wrap: anywhere; }
.plain-list { margin: 0; padding-left: 1.2em; color: var(--ink-2); }
.plain-list li + li { margin-top: 6px; }
.pads { margin-bottom: 16px; }
.pads > .card + .card { margin-top: 16px; }
.pad .badge { flex: none; }
.pad-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pad-chip { min-width: 44px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  text-align: center; font-size: .85rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pad-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pad-sticks { margin-top: 8px; font-variant-numeric: tabular-nums; }
.pad-wizard { margin-top: 16px; padding: 16px; border-radius: 12px; background: var(--accent-soft, var(--surface)); border: 1px solid var(--line); }
.pad-wizard h3 { margin: 4px 0; }
.pad-prompt { font-size: 1.4rem; }
