/* Q hub Chess Club — tokens lifted from the tournament site (canvas club.css), made fluid for the app. */
:root {
  --bg: #efe6d2; --paper: #faf6ec; --paper2: #f3ecd9; --ink: #1c1a17; --muted: #5c5548;
  --hair: rgba(28,26,23,0.15); --edge: #1c1a17; --shadow: #1c1a17;
  --acc: #e0552b; --acc-ink: #a8401c; --gold: #d9a92f; --up: #2d6b34; --dn: #a8401c;
  --btn-edge: #1c1a17;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace; --grot: 'Space Grotesk', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a17; --paper: #26231f; --paper2: #2f2b26; --ink: #efe6d2; --muted: #b3aa98;
    --hair: rgba(239,230,210,0.14); --edge: #efe6d2; --shadow: #e0552b; --acc-ink: #f07a52; --up: #8fd27c; --dn: #f07a52;
    --btn-edge: #efe6d2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1a17; --paper: #26231f; --paper2: #2f2b26; --ink: #efe6d2; --muted: #b3aa98;
  --hair: rgba(239,230,210,0.14); --edge: #efe6d2; --shadow: #e0552b; --acc-ink: #f07a52; --up: #8fd27c; --dn: #f07a52;
  --btn-edge: #efe6d2;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { -webkit-text-size-adjust: 100%; }
.app {
  max-width: 480px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; position: relative;
  background: var(--bg); color: var(--ink); font-family: var(--mono); font-size: 14px; line-height: 1.45;
  display: flex; flex-direction: column; -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.top { padding: calc(20px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--grot); font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.mark { display: grid; grid-template-columns: repeat(2, 9px); grid-template-rows: repeat(2, 9px); flex-shrink: 0; }
.mark i { display: block; background: var(--ink); } .mark i:nth-child(2), .mark i:nth-child(3) { background: var(--acc); }
.body { flex: 1; padding: 4px 16px calc(100px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.body.solo { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.kicker { font-weight: 600; font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--acc-ink); }
.h1 { margin: 0; font-family: var(--grot); font-weight: 700; font-size: 32px; line-height: 1; letter-spacing: -0.04em; }
.h1 .dot, .h2 .dot { color: var(--acc); }
.h2 { margin: 0; font-family: var(--grot); font-weight: 700; font-size: 19px; letter-spacing: -0.03em; }
.sec { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sec a { font-size: 12px; color: var(--acc-ink); text-decoration: underline; text-underline-offset: 3px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.card { background: var(--paper); border: 2px solid var(--edge); box-shadow: 4px 4px 0 var(--shadow); padding: 14px; }
.card.hot { box-shadow: 6px 6px 0 var(--acc); }
.card.flat { box-shadow: none; }
.av { width: 40px; height: 40px; border-radius: 999px; border: 2px solid var(--edge); display: grid; place-items: center; flex-shrink: 0; overflow: hidden;
  font-family: var(--grot); font-weight: 700; font-size: 14px; color: #1c1a17; background: var(--acc); }
.av.s { width: 32px; height: 32px; font-size: 11.5px; border-width: 1.5px; }
.av.l { width: 76px; height: 76px; font-size: 26px; }
.av.g { background: #d9a92f; } .av.v { background: #b8b4ab; } .av.b { background: #b8794f; } .av.e { background: #7dc46a; } .av.t { background: #8fb9c4; }
.av.prov { border-style: dashed; }
.av.ph { background: var(--paper2); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hair); }
.row:first-child { border-top: 0; }
.grow { flex: 1; min-width: 0; }
.name { font-family: var(--grot); font-weight: 700; font-size: 15.5px; letter-spacing: -0.02em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font-family: var(--grot); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.d { font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.d.up { color: var(--up); } .d.dn { color: var(--dn); } .d.eq { color: var(--muted); }
.chip { width: 24px; height: 24px; display: grid; place-items: center; font-size: 11px; font-weight: 600; border: 1px solid var(--edge); flex-shrink: 0; }
.chip.W { background: var(--ink); color: var(--bg); } .chip.D { background: #d9a92f; color: #1c1a17; } .chip.L { background: var(--acc); color: #1c1a17; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 7px; border: 1.5px solid var(--edge); white-space: nowrap; line-height: 1.3; }
.badge.prov { border-style: dashed; color: var(--muted); border-color: var(--muted); }
.badge.disp { background: var(--acc); color: #1c1a17; border-color: var(--acc); }
.badge.you { background: var(--ink); color: var(--bg); }
.badge .sq { width: 7px; height: 7px; background: currentColor; display: inline-block; }
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; width: 100%; padding: 12px 20px;
  font-family: var(--grot); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; color: #1c1a17; background: var(--acc);
  border: 2px solid var(--btn-edge); box-shadow: 4px 4px 0 var(--btn-edge); cursor: pointer; text-decoration: none; }
.input:disabled { opacity: .5; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; }
.btn.sm { min-height: 44px; font-size: 14px; width: auto; padding: 8px 14px; box-shadow: none; }
.link { background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--acc-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }
.link:disabled { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .lbl { font-size: 11.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.input { min-height: 50px; width: 100%; padding: 12px 14px; font: inherit; font-size: 15px; color: var(--ink); background: var(--paper); border: 2px solid var(--edge); border-radius: 0; }
.seg { display: grid; gap: 8px; }
.opt { min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; text-align: center;
  font-family: var(--grot); font-weight: 700; font-size: 15px; color: var(--ink); background: var(--paper); border: 2px solid var(--edge); cursor: pointer; }
.opt.on { background: var(--ink); color: var(--bg); box-shadow: 4px 4px 0 var(--acc); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--grot); font-size: 22px; letter-spacing: -0.03em; }
.stat span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.err { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--dn); }
.err:empty { display: none; }

/* Bottom sheet */
.scrim { position: fixed; inset: 0; background: rgba(20,17,14,0.55); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; z-index: 21; max-height: 90dvh; overflow-y: auto;
  background: var(--bg); color: var(--ink); font-family: var(--mono); font-size: 14px; line-height: 1.45; border-top: 3px solid var(--acc);
  padding: 10px 16px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.grab { width: 44px; height: 5px; background: var(--muted); opacity: .5; margin: 0 auto 4px; border-radius: 3px; }

/* Tab bar (always dark, as in the canvas) */
.tabdock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; }
.tb { max-width: 480px; margin: 0 auto; background: #1c1a17; border-top: 3px solid var(--acc); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 6px 8px calc(18px + env(safe-area-inset-bottom)); font-family: var(--mono); }
.tb a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #b3aa98; text-decoration: none; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; min-height: 52px; }
.tb a svg { stroke: #b3aa98; }
.tb a.on { color: #f07a52; }
.tb a.on svg { stroke: #f07a52; }

/* Install steps */
.step { display: flex; gap: 12px; align-items: flex-start; }
.step .n { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-family: var(--grot); font-weight: 700; font-size: 14px; }

/* Sign-in code boxes */
.digits { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.digit { width: 100%; min-height: 58px; text-align: center; font-family: var(--grot); font-weight: 700; font-size: 24px; color: var(--ink); background: var(--paper); border: 2px solid var(--edge); border-radius: 0; padding: 0; }

/* Me: switches */
.tg { width: 48px; height: 28px; border: 2px solid var(--edge); background: var(--paper); position: relative; flex-shrink: 0; cursor: pointer; padding: 0; }
.tg::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: var(--muted); }
.tg.on { background: var(--ink); } .tg.on::after { left: 23px; background: var(--acc); }

/* How ratings work */
.ex { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ex th { text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; padding: 8px 0; border-bottom: 2px solid var(--edge); }
.ex td { padding: 9px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
.ex td:last-child, .ex th:last-child { text-align: right; font-family: var(--grot); font-weight: 700; white-space: nowrap; padding-left: 10px; }
.pl { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

/* Objection: radio rows */
.rb { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border: 2px solid var(--edge); background: var(--paper); font-weight: 600; font-size: 14px; cursor: pointer; }
.rb input { width: 20px; height: 20px; accent-color: var(--acc); margin: 0; }
.rb.on { box-shadow: 4px 4px 0 var(--acc); }

/* Photo crop editor (full screen) */
.modal-open, .modal-open body { overflow: hidden; overscroll-behavior: contain; }
.crop-wrap { position: fixed; inset: 0; z-index: 30; background: rgba(20,17,14,0.82); overscroll-behavior: contain; }
.crop { height: 100%; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto;
  background: var(--bg); color: var(--ink); font-family: var(--mono); font-size: 14px; line-height: 1.45; }
.crop-head { padding: calc(16px + env(safe-area-inset-top)) 16px 12px; }
.crop-head .h2 { margin-top: 6px; }
.crop-stage { flex: 1; min-height: 0; position: relative; touch-action: none; cursor: grab; background: #1c1a17; border-top: 2px solid var(--edge); border-bottom: 2px solid var(--edge); }
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.crop-foot { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.crop-foot input[type=range] { width: 100%; height: 32px; margin: 0; accent-color: var(--acc); }

/* Photo lightbox */
.avbtn { padding: 0; border: 0; background: none; border-radius: 999px; cursor: zoom-in; flex-shrink: 0; display: block; }
.avbtn:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
.lightbox { position: fixed; inset: 0; z-index: 40; overscroll-behavior: contain; background: rgba(20,17,14,0.82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
.lightbox img { width: min(90vw, 70vh, 480px); height: min(90vw, 70vh, 480px); border-radius: 999px; object-fit: cover; display: block;
  border: 3px solid #efe6d2; box-shadow: 6px 6px 0 var(--acc); background: #f3ecd9; }
.lightbox .cap { font-family: var(--grot); font-weight: 700; font-size: 24px; letter-spacing: -0.03em; color: #efe6d2; }
.lightbox .x { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; display: grid; place-items: center;
  background: #1c1a17; color: #efe6d2; border: 2px solid #efe6d2; cursor: pointer; padding: 0; }
