:root {
  --bg: #050403;
  --panel: rgba(18, 15, 12, .9);
  --panel-solid: #14110e;
  --line: rgba(160, 140, 105, .4);
  --gold: #a38762;
  --gold-hi: #d8c49a;
  --text: #cfc2a8;
  --muted: #8a7c66;
  --active: #3a3228;
  --danger: #c4553a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: Georgia, "Times New Roman", serif; }
[hidden] { display: none !important; }

#scene { position: fixed; inset: 0; }
#scene canvas { display: block; touch-action: none; }

.gothic { font-family: UnifrakturCook, Georgia, serif; font-weight: 700; color: var(--gold-hi); }

button { font: 20px/1 UnifrakturCook, Georgia, serif; color: var(--gold); background: var(--panel);
  border: 1px solid var(--line); padding: 10px 16px; cursor: pointer; }
button:hover:not(:disabled) { color: var(--gold-hi); border-color: var(--gold); }
button:focus-visible, label:focus-within span { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--active); color: var(--gold-hi); border-color: var(--gold); }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 10; }
#loading { background: var(--bg); font-size: 28px; }
#menu { background: radial-gradient(ellipse at center, rgba(5, 4, 3, .2), rgba(5, 4, 3, .75)); }

.panel { background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 0 0 4px rgba(10, 8, 7, .9), 0 0 0 5px var(--line), 0 20px 60px #000;
  padding: 28px 32px; max-width: 460px; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; }
.panel h1 { font-size: 64px; margin: 0; text-align: center; line-height: 1; }
.panel h2 { font-size: 36px; margin: 0 0 18px; text-align: center; }
.subtitle { text-align: center; color: var(--muted); margin: 6px 0 20px; font-style: italic; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 18px 0 0; text-align: center; }

fieldset { border: 0; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px; }
legend { width: 100%; padding: 0; margin-bottom: 8px; color: var(--muted); font-size: 14px;
  text-transform: uppercase; letter-spacing: .12em; }
fieldset label { flex: 1 1 0; min-width: 100px; }
fieldset input { position: absolute; opacity: 0; pointer-events: none; }
fieldset span { display: block; text-align: center; font: 19px/1 UnifrakturCook, Georgia, serif; color: var(--gold);
  border: 1px solid var(--line); padding: 10px 8px; cursor: pointer; background: rgba(10, 8, 7, .6); }
fieldset input:checked + span { background: var(--active); color: var(--gold-hi); border-color: var(--gold); }
fieldset span:hover { color: var(--gold-hi); }

.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.actions button { flex: 1 1 160px; padding: 13px 16px; font-size: 22px; }

#hud { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: space-between;
  align-items: flex-start; gap: 12px; padding: 14px 16px; pointer-events: none; flex-wrap: wrap; }
#hud > * { pointer-events: auto; }
#hud nav { display: flex; gap: 8px; flex-wrap: wrap; }
.status { background: var(--panel); border: 1px solid var(--line); padding: 10px 16px; min-width: 220px; }
#status { display: block; font: 22px/1.1 UnifrakturCook, Georgia, serif; color: var(--gold-hi); }
#status.check { color: var(--danger); }
#last-move { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; min-height: 1em; }

.promo-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.promo-choices button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px;
  font-size: 16px; }
.glyph { font: 44px/1 "Noto Sans Symbols 2", "Segoe UI Symbol", serif; color: var(--gold-hi); }

.banner { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 6;
  background: var(--panel); border: 1px solid var(--gold); box-shadow: 0 10px 40px #000;
  padding: 18px 24px; text-align: center; width: min(520px, calc(100vw - 32px)); }
.banner p { font-size: 30px; margin: 0 0 12px; }

@media (max-width: 560px) {
  .panel { padding: 22px 18px; }
  .panel h1 { font-size: 52px; }
  button { font-size: 17px; padding: 9px 12px; }
  .status { min-width: 0; flex: 1 1 100%; }
  #hud nav { flex: 1 1 100%; }
  #hud nav button { flex: 1; }
  .promo-choices { grid-template-columns: repeat(2, 1fr); }
}
