* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #20110d;
  --panel: #2c1912;
  --panel-2: #3a2118;
  --ink: #fff6e8;
  --muted: #d9bca2;
  --line: rgba(255, 180, 95, .32);
  --gold: #ffb45f;
  --mint: #84e8bd;
  --red: #ff8f80;
  --a: #ffb45f;
  --b: #f27f5e;
  --c: #8fd3c5;
  --d: #c8a7ff;
  --e: #f2db78;
  --f: #84b8ff;
}
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 82% 12%, rgba(255, 180, 95, .22), transparent 28rem),
    linear-gradient(145deg, #21110d, #43261f 58%, #120908);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, a { font: inherit; }
.shell { width: min(1160px, calc(100% - 28px)); margin: 0 auto; padding: 18px 0 30px; }
.topbar, .meta, .controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar { justify-content: space-between; min-height: 56px; margin-bottom: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 22px; font-weight: 900; text-decoration: none; }
.brand span { display: grid; width: 34px; height: 34px; place-items: center; border: 2px solid var(--gold); border-radius: 8px; background: #1b0d09; color: var(--gold); }
.meta span { min-height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; background: rgba(0, 0, 0, .22); font-weight: 850; }
.layout { display: grid; grid-template-columns: minmax(0, 680px) minmax(310px, 430px); gap: 18px; align-items: start; }
.court, .bench { border: 1px solid var(--line); border-radius: 8px; background: rgba(44, 25, 18, .9); box-shadow: 0 24px 70px rgba(0, 0, 0, .35); padding: clamp(18px, 3vw, 28px); }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(34px, 7vw, 62px); line-height: .95; }
h2 { font-size: clamp(24px, 4vw, 38px); line-height: 1; }
h3 { margin: 18px 0 8px; color: var(--gold); font-size: 14px; text-transform: uppercase; }
.court-grid { display: grid; gap: 8px; margin-top: 22px; }
.cell {
  position: relative;
  display: grid;
  min-height: 76px;
  place-items: center;
  border: 1px solid rgba(255, 246, 232, .18);
  border-radius: 7px;
  background: rgba(255, 255, 255, .05);
  color: rgba(27, 13, 9, .78);
  font-weight: 950;
  cursor: pointer;
}
.cell span { position: absolute; left: 8px; top: 6px; color: rgba(27, 13, 9, .62); font-size: 12px; text-transform: uppercase; }
.cell strong { color: #170b08; font-size: clamp(26px, 5vw, 40px); line-height: 1; }
.cell:hover, .cell:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.cell.crowned { box-shadow: inset 0 0 0 3px rgba(255, 246, 232, .42), 0 10px 22px rgba(0, 0, 0, .26); }
.region-a, .swatch.region-a { background: var(--a); }
.region-b, .swatch.region-b { background: var(--b); }
.region-c, .swatch.region-c { background: var(--c); }
.region-d, .swatch.region-d { background: var(--d); }
.region-e, .swatch.region-e { background: var(--e); }
.region-f, .swatch.region-f { background: var(--f); }
.district-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.district-list span, .rule-list li {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .045);
  color: var(--muted);
  font-weight: 850;
}
.swatch { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(255,255,255,.45); }
.district-list span { justify-content: flex-start; }
.district-list .ok, .rule-list .ok { color: var(--mint); border-color: rgba(132, 232, 189, .55); }
.district-list .bad, .rule-list .bad { color: var(--red); border-color: rgba(255, 143, 128, .6); }
.rule-list { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; }
.controls button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: #170b08;
  background: var(--gold);
  font-weight: 900;
  cursor: pointer;
}
.controls button:nth-child(2) { background: #fff0d9; }
#submit-button { background: var(--mint); }
.status { min-height: 48px; color: #fff8ed; font-weight: 760; }
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .shell { width: min(100% - 18px, 700px); }
  .cell { min-height: 54px; }
  .district-list { grid-template-columns: 1fr; }
}
