/* ————— Lacquer & Jade ————— */
:root {
  --lacquer: #150d12;
  --lacquer-2: #251019;
  --panel: rgba(24, 13, 19, 0.88);
  --gold: #d4af37;
  --gold-dim: #8a6d2f;
  --gold-faint: rgba(212, 175, 55, 0.28);
  --ink: #ead9bc;
  --ink-dim: #a9946f;
  --good: #46d488;
  --bad: #e05252;
  --jade: #4fae87;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 30%, #2b1420 0%, #170c13 55%, #0a0509 100%);
  color: var(--ink);
  font-family: 'Spectral', serif;
  font-weight: 300;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, transparent 55%, rgba(5,2,4,0.55) 100%);
}

#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

/* ————— Panels ————— */
.panel {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 40px 36px 32px;
  background: var(--panel);
  border: 1px solid var(--gold-dim);
  outline: 1px solid rgba(212,175,55,0.12);
  outline-offset: 5px;
  backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  text-align: center;
  animation: panelIn 0.55s cubic-bezier(.21,.8,.32,1) both;
}
@keyframes panelIn {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.97); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.panel .hanzi {
  position: absolute; top: 6px; right: 14px;
  font-family: 'Noto Serif SC', serif; font-weight: 300;
  font-size: 84px; line-height: 1; color: rgba(212,175,55,0.10);
  user-select: none; writing-mode: vertical-rl;
}

.panel h1 {
  font-family: 'Marcellus', serif; font-weight: 400;
  font-size: 38px; letter-spacing: 0.14em; text-transform: uppercase;
  margin: 0 0 2px; color: var(--gold);
  text-shadow: 0 0 24px rgba(212,175,55,0.25);
}
.panel .subtitle {
  font-style: italic; color: var(--ink-dim); font-size: 15px;
  margin-bottom: 30px; letter-spacing: 0.08em;
}

/* ————— Fields ————— */
.field { margin: 20px 0; text-align: left; }
.field > label {
  display: block; font-family: 'Marcellus', serif;
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 9px;
}

.segmented { display: flex; gap: 6px; }
.segmented button {
  flex: 1; padding: 9px 0 8px;
  background: transparent; color: var(--ink-dim);
  border: 1px solid rgba(212,175,55,0.25);
  font-family: 'Spectral', serif; font-size: 14px;
  cursor: pointer; transition: all 0.18s ease;
}
.segmented button:hover { border-color: var(--gold); color: var(--ink); }
.segmented button.active {
  background: linear-gradient(180deg, #e3c25a, #b8922e);
  color: #221408; border-color: var(--gold);
  box-shadow: 0 2px 14px rgba(212,175,55,0.35);
}

#oppList { display: flex; flex-direction: column; gap: 7px; }
.oppRow {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border: 1px solid rgba(212,175,55,0.16);
  background: rgba(0,0,0,0.22);
}
.oppRow .stone { width: 16px; height: 16px; border-radius: 50%;
  box-shadow: inset -2px -3px 4px rgba(0,0,0,0.55), inset 2px 2px 3px rgba(255,255,255,0.35), 0 1px 3px rgba(0,0,0,0.5); }
.oppRow .name { flex: 1; font-size: 15px; }
.oppRow select {
  background: var(--lacquer-2); color: var(--ink);
  border: 1px solid rgba(212,175,55,0.3); padding: 5px 8px;
  font-family: 'Spectral', serif; font-size: 13px; cursor: pointer;
}

/* toggle */
.toggle { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; color: var(--ink); }
.toggle input { display: none; }
.toggle .box {
  width: 17px; height: 17px; border: 1px solid var(--gold-dim);
  display: inline-block; position: relative; flex: none;
}
.toggle input:checked + .box::after {
  content: ''; position: absolute; inset: 3px; background: var(--gold);
}
.toggle .legend { margin-left: auto; color: var(--ink-dim); font-size: 12.5px; display: flex; align-items: center; gap: 5px; }

.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; margin: 0 1px; }
.sw.good { background: var(--good); box-shadow: 0 0 7px var(--good); }
.sw.bad  { background: var(--bad);  box-shadow: 0 0 7px var(--bad); }

button.primary {
  margin-top: 26px; width: 100%;
  padding: 14px 0 12px;
  font-family: 'Marcellus', serif; font-size: 17px;
  letter-spacing: 0.18em; text-transform: uppercase;
  background: linear-gradient(180deg, #e9c95e, #b8922e);
  color: #221408; border: none; cursor: pointer;
  box-shadow: 0 4px 24px rgba(212,175,55,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
button.primary:hover { transform: translateY(-1px); box-shadow: 0 7px 30px rgba(212,175,55,0.5); }

.footnote { margin-top: 16px; font-size: 13px; font-style: italic; color: var(--ink-dim); }

/* ————— HUD ————— */
#turnBanner {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  pointer-events: none; /* informational — never block board clicks */
  display: flex; align-items: center; gap: 10px;
  padding: 9px 22px 8px;
  background: var(--panel); border: 1px solid rgba(212,175,55,0.3);
  backdrop-filter: blur(10px);
  font-family: 'Marcellus', serif; font-size: 15px; letter-spacing: 0.12em;
}
#turnBanner .dot { width: 13px; height: 13px; border-radius: 50%;
  box-shadow: inset -2px -3px 4px rgba(0,0,0,0.55), inset 2px 2px 3px rgba(255,255,255,0.35); }
#turnBanner.thinking .who::after { content: ' …'; }

#hudHint {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  pointer-events: none;
  font-size: 13.5px; color: var(--ink-dim); font-style: italic;
  background: rgba(10,5,9,0.55); padding: 7px 16px; backdrop-filter: blur(8px);
  border: 1px solid rgba(212,175,55,0.14);
  white-space: nowrap;
}

#controls { position: absolute; top: 18px; right: 18px; display: flex; gap: 8px; }
#controls button {
  padding: 8px 16px 7px; background: var(--panel); color: var(--ink-dim);
  border: 1px solid rgba(212,175,55,0.3); backdrop-filter: blur(10px);
  font-family: 'Marcellus', serif; font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer; transition: all 0.15s ease;
}
#controls button:hover:not(:disabled) { color: var(--gold); border-color: var(--gold); }
#controls button:disabled { opacity: 0.35; cursor: default; }
#controls button.on { color: #221408; background: linear-gradient(180deg, #e3c25a, #b8922e); }

/* standings list (shared) */
ol#winStandings, ol#standings { list-style: none; margin: 8px 0 0; padding: 0; text-align: left; }
ol#winStandings li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; font-size: 15px;
  border-bottom: 1px solid rgba(212,175,55,0.12);
}
ol#winStandings li .place { font-family: 'Marcellus', serif; color: var(--gold); width: 26px; }
ol#winStandings li .dot { width: 12px; height: 12px; border-radius: 50%;
  box-shadow: inset -2px -3px 4px rgba(0,0,0,0.55), inset 2px 2px 3px rgba(255,255,255,0.35); }

@media (max-width: 880px) {
  /* controls row would collide with the centered banner — stack them */
  #turnBanner { top: 64px; }
}

@media (max-width: 560px) {
  .panel { padding: 28px 20px 24px; }
  .panel h1 { font-size: 28px; }
  #hudHint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .panel { animation: none; }
  button.primary { transition: none; }
}
