/* Likha Games — design tokens. Dark is the default; [data-theme="light"] swaps the set. */
:root {
  --bg: #0d1120;
  --bg-glow: rgba(255, 138, 61, .10);
  --surface: #151a2e;
  --surface-2: #1c2340;
  --border: #262f52;
  --border-strong: #35406b;
  --text: #eef1fb;
  --text-2: #b0b8d4;
  --muted: #7884a8;
  --primary: #ff8a3d;
  --primary-strong: #ff7417;
  --on-primary: #1b1206;
  --secondary: #6b95ff;
  --hot: #ff5c8a;
  --good: #2fcf7a;
  --good-strong: #1fa862;
  --bad: #ff5d5d;
  --gold: #ffc63d;
  /* Small text in a status colour (pills, links, field errors): at least 4.5:1 on the surfaces and tints they sit on. */
  --primary-text: #ff8a3d;
  --good-text: #2fcf7a;
  --gold-text: #ffc63d;
  --bad-text: #ff5d5d;
  --on-hot: #2a0612;
  --shadow: 0 10px 30px -16px rgba(0, 0, 0, .7);
  --radius: 16px;
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef1f8;
  --bg-glow: rgba(242, 112, 29, .08);
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --border: #dde2ef;
  --border-strong: #c3cbe0;
  --text: #121831;
  --text-2: #46506f;
  --muted: #7a84a3;
  --primary: #f2701d;
  --primary-strong: #dc5f0f;
  --on-primary: #1b1206;
  --secondary: #2f6fed;
  --hot: #e8457a;
  --good: #1fa862;
  --good-strong: #168a4f;
  --bad: #e5484d;
  --gold: #d99a00;
  --primary-text: #b54d0c;
  --good-text: #0f6b3b;
  --gold-text: #8a5d00;
  --bad-text: #c4262c;
  --on-hot: #2a0612;
  --shadow: 0 10px 28px -16px rgba(18, 24, 49, .35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: radial-gradient(1200px 500px at 85% -10%, var(--bg-glow), transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; border-radius: 6px; }

/* ── top bar ── */
.lg-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.lg-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.lg-mark { width: 34px; height: 34px; flex: none; }
.lg-brand-text { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -.3px; }
.lg-brand-text span { color: var(--primary); }
.lg-top-spacer { flex: 1; }
.lg-icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.lg-icon-btn:hover { border-color: var(--border-strong); }
.lg-user { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; }
.lg-user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-logout { border: 1px solid var(--border); background: transparent; color: var(--text-2); border-radius: 10px; padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.lg-logout:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
/* The Access link carries the pending-accounts badge: keep "Access" and the badge on one line. */
.lg-top a.lg-logout { display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; text-decoration: none; }
@media (max-width: 560px) {
  .lg-user-name { display: none; }
  .lg-top { padding: 10px 14px; gap: 8px; }
  .lg-top.is-admin .lg-brand-text { display: none; }   /* admins have one more button; the logo mark stays (link keeps its aria-label) */
}
@media (max-width: 360px) {
  .lg-top { padding: 10px 12px; gap: 6px; }
  .lg-top .lg-logout { padding: 7px 9px; }
}

/* ── avatars ── */
.lg-av {
  width: 30px; height: 30px; border-radius: 50%; flex: none; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--secondary), var(--hot)); color: #fff;
  font-size: 12px; font-weight: 700;
}
.lg-av img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── page shell ── */
.lg-main { max-width: 1120px; margin: 0 auto; padding: 26px 20px 60px; }
@media (max-width: 560px) { .lg-main { padding: 18px 14px 48px; } }
.lg-hello { font-family: var(--font-display); font-size: clamp(26px, 4.4vw, 40px); font-weight: 800; letter-spacing: -.8px; line-height: 1.1; margin: 0; text-wrap: balance; }
.lg-hello span { color: var(--primary); }
.lg-sub { color: var(--text-2); margin: 8px 0 0; max-width: 60ch; }

.lg-section { margin-top: 34px; }
.lg-section-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.lg-section-title b { color: var(--text-2); font-weight: 700; }
.lg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.lg-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 18px; border-radius: var(--radius); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease;
}
.lg-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }
.lg-card-top { display: flex; align-items: center; gap: 12px; }
.lg-card-emoji { width: 48px; height: 48px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 26px; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
.lg-card-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -.2px; }
.lg-card-blurb { color: var(--text-2); font-size: 13.5px; margin: 0; }
.lg-card-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12.5px; color: var(--muted); }
.lg-card-foot b { color: var(--text); font-variant-numeric: tabular-nums; }
.lg-card-foot .lg-crown { color: var(--gold); }

/* ── play page ── */
.lg-play { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; margin-top: 18px; }
@media (max-width: 900px) { .lg-play { grid-template-columns: minmax(0, 1fr); } }   /* minmax(0,…): the column must never grow to fit a canvas, or fit() would measure its own board */
.lg-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.lg-back:hover { color: var(--primary); }
.lg-play-head { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.lg-play-title { font-family: var(--font-display); font-size: clamp(24px, 3.6vw, 32px); font-weight: 800; letter-spacing: -.6px; margin: 0; }
.lg-play-blurb { color: var(--text-2); margin: 2px 0 0; font-size: 14px; }

.lg-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.lg-panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.lg-panel-h h2 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.lg-tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.lg-tab { border: 0; background: transparent; color: var(--text-2); font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 7px; cursor: pointer; }
.lg-tab.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.lg-lb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.lg-lb li { display: grid; grid-template-columns: 26px 30px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 10px; font-size: 14px; }
.lg-lb li.me { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.lg-lb .r { font-weight: 800; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.lg-lb li:nth-child(1) .r { color: var(--gold); }
.lg-lb .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lg-lb .s { font-weight: 800; font-variant-numeric: tabular-nums; }
.lg-lb .s small { font-weight: 600; color: var(--muted); margin-left: 3px; }
.lg-lb-empty { color: var(--muted); font-size: 13.5px; padding: 10px 4px; }
.lg-lb li.lg-lb-empty, .lg-lb li.lg-skel { display: block; }
.lg-lb-me { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 13px; color: var(--text-2); }
.lg-lb-me b { color: var(--text); }
.lg-skel { height: 34px; border-radius: 10px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: lgShimmer 1.2s linear infinite; }
@keyframes lgShimmer { to { background-position: -200% 0; } }

/* ── toast ── */
.lg-toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  transition: opacity .2s ease, transform .2s ease; z-index: 100; max-width: calc(100vw - 32px); text-align: center; }
.lg-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── login ── */
.lg-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.lg-login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 28px 24px; }
.lg-login-card .lg-mark { width: 48px; height: 48px; }
.lg-login-title { font-family: var(--font-display); font-size: 28px; font-weight: 800; letter-spacing: -.6px; margin: 14px 0 4px; }
.lg-login-title span { color: var(--primary); }
.lg-login-sub { color: var(--text-2); margin: 0 0 20px; font-size: 14px; }
.lg-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-2); margin: 0 0 6px; }
.lg-input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 16px; font-family: inherit; }
/* Focus = border + ring; the ring stays when a field is marked invalid (red border), so focus is always visible. */
.lg-input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--secondary) 45%, transparent); }
.lg-field { margin-bottom: 14px; }
.lg-error { color: var(--bad-text); font-size: 13.5px; min-height: 20px; margin: -4px 0 10px; }
.lg-primary { width: 100%; border: 0; border-radius: 12px; padding: 13px 16px; font-size: 15px; font-weight: 800; background: var(--primary); color: var(--on-primary); cursor: pointer; }
.lg-primary:hover { background: var(--primary-strong); }
.lg-login-note { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.lg-login-alt { margin: 8px 0 0; font-size: 13.5px; color: var(--text-2); text-align: center; }
.lg-login-alt a { color: var(--primary-text); font-weight: 700; text-decoration: none; }
.lg-login-alt a:hover { text-decoration: underline; }
.lg-ok { margin: -6px 0 16px; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-text); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); }
.lg-help { margin: 6px 0 0; font-size: 12px; color: var(--text-2); }
.lg-field-error { margin: 6px 0 0; font-size: 13px; color: var(--bad-text); }
.lg-field-error:empty { display: none; }
.lg-input.is-bad { border-color: var(--bad); }
.lg-input.is-bad:focus { border-color: var(--bad); }   /* still red, and the focus ring above shows where you are */
.lg-pin { letter-spacing: 4px; }
.lg-primary:disabled { opacity: .65; cursor: progress; }
/* Honeypot: out of sight for people, still in the form for bots. */
.lg-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* small count bubble (e.g. pending sign-ups on the Access link) */
.lg-badge { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 19px; height: 19px; padding: 0 6px;
  border-radius: 999px; background: var(--hot); color: var(--on-hot); font-size: 11px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; vertical-align: 1px; }

/* ══ Shared game chrome (used by every game module) ══ */
.nxg-wrap { max-width: 480px; margin: 0 auto; }
.nxg-bar { display: flex; align-items: stretch; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.nxg-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 7px 14px; min-width: 76px; display: flex; flex-direction: column; gap: 2px; }
.nxg-stat-l { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.nxg-stat-v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.nxg-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nxg-btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer; transition: border-color .12s, background .12s; }
.nxg-btn:hover { border-color: var(--border-strong); }
.nxg-btn.nxg-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.nxg-btn.nxg-primary:hover { background: var(--primary-strong); }
.nxg-stage { position: relative; width: 100%; max-width: 460px; margin: 0 auto; }
.nxg-stage.fit { width: fit-content; }
.nxg-hint { font-size: 12.5px; color: var(--muted); text-align: center; margin: 12px 0 0; }
.nxg-status { text-align: center; font-weight: 700; font-size: 14px; margin: 0 0 10px; min-height: 20px; color: var(--text); }
.nxg-over { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 16px; z-index: 5; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.nxg-over.on { display: flex; }
.nxg-over-t { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--text); }
.nxg-over-s { font-size: 13.5px; color: var(--text-2); margin-bottom: 6px; }
.nxg-canvas { display: block; margin: 0 auto; border-radius: 14px; border: 1.5px solid var(--border-strong); box-shadow: var(--shadow); touch-action: none; }
.nxg-dpad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-areas: ". up ." "left down right"; gap: 6px; justify-content: center; margin-top: 14px; }
.nxg-dpad button { height: 48px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 16px; cursor: pointer; touch-action: manipulation; }
.nxg-dpad button:active { background: var(--surface-2); }
.nxg-dp-up { grid-area: up; } .nxg-dp-left { grid-area: left; } .nxg-dp-down { grid-area: down; } .nxg-dp-right { grid-area: right; }
@media (hover: hover) and (pointer: fine) { .nxg-dpad { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
