* { box-sizing: border-box; }

:root {
  --gold: #d9b568;
  --gold-bright: #f0d79b;
  --gold-dim: #9c7c46;
  --brass-edge: rgba(206, 168, 92, 0.55);
  --panel: #2a160c;
  --ink: #0b0705;
  --cream: #e9d6ae;
  --board-w: 1000px;
  --board-x: 0px;
  --board-y: 0px;
  --board-bottom: 82vh;
  --tray-w: 180px;
  --tray-h: 88px;
}

html, body {
  margin: 0;
  height: 100%;
  background: #070504;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--cream);
  font-family: "Alegreya Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button { font: inherit; }
button:focus-visible, input:focus-visible {
  outline: 1px solid rgba(255, 226, 160, 0.78);
  outline-offset: 2px;
}

.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #070504;
  z-index: 0;
  pointer-events: none;
  transform-origin: 50% 60%;
}
.scene.drifting { animation: camera-drift 26s ease-in-out infinite alternate; }

@keyframes camera-drift {
  0% { transform: translate3d(0, 0, 0) scale(1.001); }
  50% { transform: translate3d(-2.5px, 1.4px, 0) scale(1.002); }
  100% { transform: translate3d(1.8px, -1px, 0) scale(1.001); }
}

.room {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 72%;
  object-fit: cover;
  object-position: 50% 38%;
  filter: brightness(0.74) saturate(0.9) contrast(1.03) blur(1.15px);
  opacity: 0.92;
  z-index: 0;
}

.table {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 58%;
  object-fit: cover;
  object-position: 50% 88%;
  filter: brightness(0.68) saturate(0.92) contrast(1.02) blur(0.4px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.55) 9%, #000 26%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.55) 9%, #000 26%);
  z-index: 1;
}

.board-wrap {
  position: absolute;
  left: var(--board-x);
  top: var(--board-y);
  width: var(--board-w);
  height: var(--board-w);
  z-index: 4;
  pointer-events: auto;
}

.board-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  filter: saturate(1.02) contrast(1.015) brightness(0.99);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.4) 5%, #000 17%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.4) 5%, #000 17%);
  pointer-events: none;
}

.glow-layer, .pieces, .flyers, .coords, .board-deselect {
  position: absolute;
  inset: 0;
}

.glow-layer { z-index: 2; pointer-events: none; }
.pieces { z-index: 50; pointer-events: none; }
.flyers { z-index: 180; pointer-events: none; }
.coords { z-index: 6; pointer-events: none; }

.board-deselect {
  z-index: 1;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
  pointer-events: auto;
}

.piece {
  position: absolute;
  height: auto;
  transform: translate(-50%, -100%);
  transform-origin: 50% 100%;
  transform-box: border-box;
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
  transition: filter 180ms ease, transform 180ms ease;
}
.piece.selected {
  z-index: 300 !important;
  transform: translate(-50%, -100%) translateY(-4px) scale(1.02);
}
.piece.flying { pointer-events: none; transition: none; }
.piece.landed { animation: piece-settle 280ms ease-out; }
.piece.entering { animation: piece-in 260ms ease-out both; }

@keyframes piece-in {
  from { opacity: 0; transform: translate(-50%, -100%) translateY(-6px) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, -100%); }
}

@keyframes piece-settle {
  0% { transform: translate(-50%, -100%) scaleY(1); }
  38% { transform: translate(-50%, -100%) scaleY(0.965) scaleX(1.02); }
  100% { transform: translate(-50%, -100%) scaleY(1) scaleX(1); }
}

.cell {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 220ms ease;
  will-change: opacity, filter;
}
.cell.on { opacity: 1; }

.cell.legal {
  background: radial-gradient(ellipse at center, rgba(131, 178, 92, 0.55) 0%, rgba(84, 134, 62, 0.22) 48%, rgba(60, 100, 45, 0) 74%);
  filter: blur(2.4px);
  animation: seep 2.8s ease-in-out infinite alternate;
}
.cell.legal.capture {
  background: radial-gradient(ellipse at center, rgba(60, 100, 45, 0) 27%, rgba(168, 186, 96, 0.62) 45%, rgba(96, 140, 66, 0.26) 58%, rgba(60, 100, 45, 0) 76%);
}
@keyframes seep {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

.cell.last {
  background: radial-gradient(ellipse at center, rgba(232, 172, 86, 0.34) 0%, rgba(210, 146, 62, 0.15) 52%, rgba(170, 110, 40, 0) 76%);
  filter: blur(3px);
}
.cell.selglow {
  background: radial-gradient(ellipse at center, rgba(202, 182, 108, 0.4) 0%, rgba(140, 146, 80, 0.16) 50%, rgba(100, 120, 60, 0) 75%);
  filter: blur(2px);
}
.cell.check {
  mix-blend-mode: normal;
  background: radial-gradient(ellipse at center, rgba(255, 146, 40, 0.42) 0%, rgba(226, 104, 24, 0.26) 44%, rgba(168, 64, 16, 0) 74%);
  filter: blur(2.6px);
  animation: check-breath 2s ease-in-out infinite;
}
@keyframes check-breath {
  0%, 100% { opacity: 0.55; filter: blur(2.5px) brightness(0.85); }
  50% { opacity: 1; filter: blur(2.5px) brightness(1.2); }
}
.cell.hint {
  background: radial-gradient(ellipse at center, rgba(255, 216, 128, 0.6) 0%, rgba(224, 172, 74, 0.24) 50%, rgba(180, 120, 40, 0) 76%);
  filter: blur(2.4px);
  animation: hint-glow 1.4s ease-in-out infinite alternate;
}
@keyframes hint-glow {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

.tap-target {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  z-index: 200;
}

.coord {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: "Alegreya SC", serif;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: rgba(235, 211, 160, 0.5);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.tray {
  position: absolute;
  width: var(--tray-w);
  height: var(--tray-h);
  z-index: 7;
  pointer-events: none;
  opacity: 0;
  transition: opacity 350ms ease;
  border-radius: 2px;
  padding: 5px;
  background:
    linear-gradient(145deg, rgba(96, 58, 30, 0.95), rgba(44, 22, 10, 0.98) 64%, rgba(24, 11, 5, 1));
  border: 1px solid rgba(190, 148, 76, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 221, 161, 0.16),
    inset 0 -2px 6px rgba(0, 0, 0, 0.7),
    0 10px 20px rgba(0, 0, 0, 0.55);
}
.tray-black { transform: rotate(-3.2deg); }
.tray-white { transform: rotate(2.4deg); }

.tray-felt {
  position: absolute;
  inset: 5px;
  border-radius: 1px;
  background: radial-gradient(ellipse at 28% 22%, #264832, #152a1e 66%, #0d1c14);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.8), inset 0 -1px 0 rgba(120, 160, 120, 0.12);
  overflow: hidden;
}
.tray-pieces { position: absolute; inset: 0; }
.tray-pieces img {
  position: absolute;
  transform-origin: 50% 50%;
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.65));
  pointer-events: none;
}

.lamp-glow {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background:
    radial-gradient(ellipse 52% 42% at 6% 0%, rgba(255, 198, 116, 0.2), rgba(255, 186, 100, 0.055) 48%, transparent 72%),
    linear-gradient(100deg, rgba(255, 205, 130, 0.07) 0%, transparent 38%);
  mix-blend-mode: screen;
  animation: lamp-sway 11s ease-in-out infinite alternate;
}
@keyframes lamp-sway {
  from { opacity: 0.72; transform: translateX(-0.5%); }
  to { opacity: 1; transform: translateX(0.5%); }
}

.motes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 9;
  pointer-events: none;
  opacity: 0.85;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 42% 42%, rgba(0, 0, 0, 0) 34%, rgba(0, 0, 0, 0.22) 62%, rgba(0, 0, 0, 0.62) 88%, rgba(0, 0, 0, 0.88) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.28) 0%, transparent 14%, transparent 76%, rgba(0, 0, 0, 0.38) 100%);
}

.brand {
  position: absolute;
  top: 2.2vh;
  left: 2.2vw;
  z-index: 30;
  pointer-events: none;
}
.crest {
  display: block;
  width: clamp(54px, 6.1vw, 104px);
  height: auto;
  margin-left: -0.35em;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.72)) brightness(0.98);
}
.brand h1 {
  margin: 0.02em 0 0 -0.04em;
  font-family: "Cormorant Garamond", serif;
  font-weight: 300;
  font-size: clamp(30px, 3.45vw, 60px);
  line-height: 1;
  letter-spacing: 0.15em;
  color: #d8b56a;
  text-shadow:
    0 1px 0 rgba(255, 241, 200, 0.3),
    0 -1px 1px rgba(52, 30, 6, 0.9),
    0 4px 14px rgba(0, 0, 0, 0.72);
}
.status {
  margin: 0.55em 0 0 0.12em;
  font-family: "Alegreya SC", serif;
  font-size: clamp(10px, 0.82vw, 14px);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #b2945d;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.status.alert { color: #e2ab5a; }

.right-panel {
  position: absolute;
  top: 5.2vh;
  right: 2.1vw;
  width: clamp(180px, 16.6vw, 286px);
  z-index: 31;
  display: flex;
  flex-direction: column;
  gap: 2.1vh;
}

.scorecard {
  position: relative;
  display: flex;
  flex-direction: column;
  height: clamp(220px, 42vh, 470px);
  min-height: 0;
  padding: 12px 12px 10px;
  background:
    linear-gradient(157deg, rgba(63, 34, 19, 0.97), rgba(38, 19, 10, 0.98) 58%, rgba(26, 12, 6, 0.99));
  border: 1px solid var(--brass-edge);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.55),
    inset 0 0 46px rgba(0, 0, 0, 0.48),
    0 16px 34px rgba(0, 0, 0, 0.55);
  color: #c9ae7c;
}
.scorecard::before, .scorecard::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(206, 168, 92, 0.4), transparent);
}
.scorecard::before { top: 4px; }
.scorecard::after { bottom: 4px; }

.scorecard-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  margin-bottom: 5px;
  border-bottom: 1px solid rgba(196, 158, 82, 0.22);
}
.log-label {
  font-family: "Alegreya SC", serif;
  font-size: clamp(10px, 0.78vw, 13px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #c5a568;
  white-space: nowrap;
}
.hintline {
  font-family: "Alegreya Sans", sans-serif;
  font-size: clamp(9px, 0.66vw, 12px);
  letter-spacing: 0.04em;
  color: rgba(191, 160, 110, 0.62);
  text-align: right;
  line-height: 1.2;
}

.moves {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 33vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(13px, 1.12vw, 19px);
  line-height: 1.34;
}
.moves::-webkit-scrollbar { display: none; }
.moves.empty { justify-content: center; align-items: center; }
.moves.empty .mv-row { display: block; text-align: center; }
.moves.empty .mv-cell { color: rgba(197, 171, 124, 0.42); font-style: italic; letter-spacing: 0.04em; }
.moves.empty .mv-n { display: none; }

.mv-row {
  display: grid;
  grid-template-columns: 2.1em 1fr 1fr;
  gap: 0.35em;
  color: #c5ab7c;
  padding: 0.02em 0.2em;
}
.mv-n {
  font-family: "Alegreya SC", serif;
  font-size: 0.82em;
  letter-spacing: 0.06em;
  color: rgba(160, 129, 82, 0.85);
  text-align: right;
}
.mv-cell { white-space: nowrap; }
.mv-cell.current {
  color: #f6e1b2;
  text-shadow: 0 0 10px rgba(240, 202, 130, 0.4);
}
.mv-empty { color: rgba(197, 171, 124, 0.28); }

.plaque-stack {
  display: flex;
  flex-direction: column;
  gap: 1.15vh;
}

.plaque {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 7px 12px rgba(0, 0, 0, 0.5));
  transition: filter 180ms ease, transform 180ms ease;
}
.plaque img {
  display: block;
  width: 100%;
  height: clamp(38px, 5.5vh, 62px);
  object-fit: fill;
}
.plaque::after {
  content: "";
  position: absolute;
  inset: 8% 4%;
  background: linear-gradient(150deg, rgba(255, 240, 195, 0) 30%, rgba(255, 241, 199, 0.22) 47%, rgba(255, 241, 199, 0) 64%);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}
.plaque:hover { filter: drop-shadow(0 0 12px rgba(238, 200, 122, 0.26)) brightness(1.17) drop-shadow(0 7px 12px rgba(0,0,0,0.5)); transform: translateY(-1px); }
.plaque:hover::after { opacity: 1; }
.plaque:active { transform: translateY(1px); filter: brightness(1.04) drop-shadow(0 4px 8px rgba(0,0,0,0.55)); }
.plaque:focus-visible { outline: 1px solid var(--gold-bright); outline-offset: 3px; }

.rail {
  position: absolute;
  left: 1.3vw;
  right: 1.3vw;
  bottom: 1.2vh;
  height: clamp(58px, 10.2vh, 112px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1fr;
  gap: 1.1vw;
  z-index: 32;
}
.tier {
  position: relative;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 7px 12px rgba(0, 0, 0, 0.5));
  transition: filter 200ms ease, transform 200ms ease;
}
.tier img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.tier.dim { filter: brightness(0.72) saturate(0.82) drop-shadow(0 6px 10px rgba(0,0,0,0.5)); }
.tier.dim:hover { filter: brightness(0.86) saturate(0.9) drop-shadow(0 6px 10px rgba(0,0,0,0.5)); }
.tier.active { filter: drop-shadow(0 0 14px rgba(236, 197, 118, 0.2)) drop-shadow(0 7px 12px rgba(0,0,0,0.5)); }
.tier:focus-visible { outline: 1px solid var(--gold-bright); outline-offset: 3px; }
.tier .stamp {
  position: absolute;
  left: 22%;
  right: 22%;
  top: 56%;
  height: 27%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Alegreya SC", serif;
  font-size: clamp(10px, 1.12vw, 17px);
  letter-spacing: 0.12em;
  color: rgba(60, 34, 8, 0.92);
  text-shadow: 0 1px 0 rgba(255, 238, 192, 0.3);
  pointer-events: none;
}
.tier.dim .stamp { color: rgba(232, 205, 148, 0.9); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75), 0 -1px 0 rgba(255, 240, 196, 0.18); }

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(1.2vh + 9.2vh + 14px);
  transform: translateX(-50%);
  z-index: 60;
  padding: 8px 18px;
  background: linear-gradient(160deg, rgba(58, 32, 17, 0.98), rgba(32, 16, 8, 0.98));
  border: 1px solid rgba(206, 168, 92, 0.5);
  color: #d9c08a;
  font-family: "Alegreya SC", serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.6);
  animation: toast-in 220ms ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 2, 1, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-backdrop[hidden] { display: none; }

.modal-panel {
  position: relative;
  width: min(420px, 92vw);
  padding: 20px 22px 18px;
  background:
    linear-gradient(157deg, rgba(62, 34, 19, 0.99), rgba(35, 17, 9, 0.99) 62%, rgba(24, 11, 5, 1));
  border: 1px solid rgba(206, 168, 92, 0.62);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.6),
    inset 0 0 60px rgba(0, 0, 0, 0.5),
    0 26px 60px rgba(0, 0, 0, 0.72);
  color: #d4bb8a;
  animation: panel-in 260ms ease-out;
}
.modal-panel::before, .modal-panel::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(206, 168, 92, 0.5), transparent);
}
.modal-panel::before { top: 5px; }
.modal-panel::after { bottom: 5px; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(196, 158, 82, 0.22);
}
.modal-panel h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e2c78d;
}
.brass-x {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(206, 168, 92, 0.45);
  background: linear-gradient(150deg, rgba(122, 82, 36, 0.5), rgba(54, 30, 12, 0.7));
  color: #e7cd96;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.brass-x:hover { background: linear-gradient(150deg, rgba(156, 108, 48, 0.7), rgba(68, 38, 15, 0.85)); }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(196, 158, 82, 0.12);
  font-family: "Alegreya Sans", sans-serif;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: #cfb687;
}
.setting-row:last-of-type { border-bottom: 0; }

.switch {
  position: relative;
  width: 48px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid rgba(206, 168, 92, 0.5);
  background: linear-gradient(180deg, #1e1008, #2f1a0d);
  cursor: pointer;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: linear-gradient(150deg, #b68a44, #6d4a1d 65%, #4c3012);
  box-shadow: inset 0 1px 0 rgba(255, 232, 180, 0.4), 0 2px 4px rgba(0,0,0,0.6);
  transition: transform 200ms ease, background 200ms ease;
}
.switch[aria-pressed="true"]::after {
  transform: translateX(24px);
  background: linear-gradient(150deg, #e7c782, #b0803a 60%, #7c5620);
}
.switch[aria-pressed="true"] {
  background: linear-gradient(180deg, #4a2d13, #6a431c);
  box-shadow: inset 0 0 8px rgba(250, 208, 126, 0.22);
}
.switch:focus-visible { outline: 1px solid rgba(255, 226, 160, 0.78); outline-offset: 2px; }

.fineprint {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(196, 158, 82, 0.18);
  font-family: "Alegreya Sans", sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(197, 168, 116, 0.62);
  letter-spacing: 0.02em;
}

.result-panel { text-align: center; }
.result-panel .result-crest {
  width: 112px;
  height: auto;
  display: block;
  margin: 0 auto 2px;
  filter: drop-shadow(0 5px 10px rgba(0,0,0,0.7));
}
.result-panel h2 { margin-top: 2px; font-size: clamp(26px, 4vw, 40px); }
.result-panel p {
  margin: 6px 0 20px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(17px, 2vw, 22px);
  letter-spacing: 0.05em;
  color: #c8ac7a;
}
.result-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.result-new { width: min(210px, 100%); }
.result-new img { height: 52px; }
.brass-button {
  padding: 11px 18px;
  border: 1px solid rgba(206, 168, 92, 0.55);
  background: linear-gradient(160deg, rgba(118, 79, 35, 0.85), rgba(60, 34, 13, 0.95));
  color: #e3c992;
  font-family: "Alegreya SC", serif;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 233, 182, 0.28), 0 8px 18px rgba(0,0,0,0.5);
}
.brass-button:hover { background: linear-gradient(160deg, rgba(150, 102, 44, 0.95), rgba(78, 44, 17, 1)); }

.promo-panel { width: min(440px, 94vw); text-align: center; }
.promo-panel h2 { margin-bottom: 16px; }
.promo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.promo-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px 9px;
  border: 1px solid rgba(206, 168, 92, 0.5);
  background: linear-gradient(160deg, rgba(104, 68, 29, 0.7), rgba(46, 25, 10, 0.9));
  color: #dfc48c;
  font-family: "Alegreya SC", serif;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 233, 182, 0.25), 0 6px 14px rgba(0,0,0,0.45);
}
.promo-option:hover { background: linear-gradient(160deg, rgba(140, 95, 40, 0.9), rgba(62, 34, 13, 0.98)); }
.promo-option img {
  width: 38px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6));
}

body.layout-portrait .brand {
  top: 1.3vh;
  left: 3.6vw;
}
body.layout-portrait .crest { width: clamp(48px, 14vw, 70px); }
body.layout-portrait .brand h1 { font-size: clamp(27px, 8.2vw, 38px); letter-spacing: 0.12em; }
body.layout-portrait .status { font-size: 9px; letter-spacing: 0.2em; margin-top: 0.4em; }

body.layout-portrait .right-panel {
  top: auto;
  left: 2.6vw;
  right: 2.6vw;
  bottom: calc(clamp(54px, 8.8vh, 98px) + 1.8vh);
  width: auto;
  gap: 7px;
}
body.layout-portrait .scorecard { height: auto; padding: 8px 10px 7px; min-height: 0; }
body.layout-portrait .scorecard-head { padding-bottom: 4px; margin-bottom: 3px; }
body.layout-portrait .hintline { display: block; font-size: 9px; letter-spacing: 0; color: rgba(214, 184, 130, 0.82); }
body.layout-portrait .moves { max-height: 58px; font-size: 13px; line-height: 1.3; }
body.layout-portrait .mv-row { padding: 0; }
body.layout-portrait .plaque-stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
body.layout-portrait .plaque img { height: clamp(32px, 5.2vh, 44px); }
body.layout-portrait .rail {
  left: 1.6vw;
  right: 1.6vw;
  bottom: 0.9vh;
  height: clamp(48px, 8.2vh, 74px);
  grid-template-rows: 1fr;
  gap: 0.8vw;
}
body.layout-portrait .tier .stamp { font-size: clamp(10px, 3.15vw, 14px); }
body.layout-portrait .toast { bottom: calc(1.2vh + 8.8vh + 10px); }

@media (max-aspect-ratio: 1/1) {
  .scorecard-head .hintline { font-size: 8px; letter-spacing: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .scene.drifting { animation: none; }
  .lamp-glow { animation: none; }
  .cell.legal, .cell.check, .cell.hint { animation: none; }
  .piece.entering { animation: none; }
}

.targets { position: absolute; inset: 0; z-index: 220; pointer-events: none; }
.targets button { pointer-events: auto; }

.levels-panel { width: min(720px, 94vw); }
.levels-heading { min-width: 0; }
.levels-sub {
  margin: 4px 0 0;
  font-family: "Alegreya Sans", sans-serif;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: rgba(197, 168, 116, 0.68);
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 7px;
  max-height: 56vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 3px 3px 5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(170, 128, 58, 0.5) rgba(20, 10, 4, 0.6);
}
.level-grid::-webkit-scrollbar { width: 7px; }
.level-grid::-webkit-scrollbar-track { background: rgba(20, 10, 4, 0.6); }
.level-grid::-webkit-scrollbar-thumb { background: rgba(170, 128, 58, 0.5); }

.level-plate {
  position: relative;
  height: 48px;
  border: 1px solid rgba(60, 38, 14, 0.9);
  border-radius: 1px;
  background:
    linear-gradient(150deg, #b89250 0%, #9a7338 38%, #c3a05c 60%, #8a6528 100%);
  color: #2f1d08;
  font-family: "Alegreya SC", serif;
  font-size: 15px;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255, 239, 196, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 198, 0.34),
    inset 0 -2px 4px rgba(60, 36, 10, 0.45),
    0 3px 7px rgba(0, 0, 0, 0.4);
  transition: filter 150ms ease, transform 150ms ease;
}
.level-plate:hover { filter: brightness(1.14); transform: translateY(-1px); }
.level-plate:active { transform: translateY(1px); }
.level-plate.done {
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 198, 0.34),
    inset 0 -3px 0 rgba(232, 190, 104, 0.8),
    inset 0 -5px 6px rgba(255, 214, 132, 0.22),
    0 3px 7px rgba(0, 0, 0, 0.4);
}
.level-plate.done::after {
  content: "\2713";
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 10px;
  color: rgba(46, 28, 8, 0.8);
}
.level-plate.current {
  filter: brightness(1.16);
  border-color: rgba(255, 222, 152, 0.75);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 198, 0.4),
    inset 0 0 0 1px rgba(255, 225, 160, 0.5),
    0 0 14px rgba(230, 187, 100, 0.32),
    0 3px 7px rgba(0, 0, 0, 0.4);
}
.levels-note { margin-top: 12px; }

body.layout-portrait .levels-panel { width: 94vw; padding: 16px 14px 14px; }
body.layout-portrait .level-grid {
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px;
  max-height: 58vh;
}
body.layout-portrait .level-plate { height: 42px; font-size: 13px; }
body.layout-portrait .levels-sub { font-size: 12px; }

@media (max-height: 620px) and (min-aspect-ratio: 1/1) {
  .brand h1 { font-size: clamp(24px, 3vw, 34px); }
  .crest { width: clamp(44px, 5vw, 60px); }
  .right-panel { top: 2.4vh; gap: 1vh; width: clamp(150px, 16vw, 210px); }
  .scorecard { height: clamp(150px, 34vh, 250px); padding: 6px 8px 5px; }
  .scorecard-head { padding-bottom: 4px; margin-bottom: 3px; }
  .moves { max-height: 21vh; font-size: 12px; }
  .plaque-stack { gap: 4px; }
  .plaque img { height: 30px; }
  .rail { height: 52px; bottom: 0.8vh; }
  .rail .stamp { font-size: 8px; }
  .toast { bottom: calc(1.2vh + 5.2vh + 8px); }
}

.level-jump {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(196, 158, 82, 0.18);
}
.level-jump label {
  font-family: "Alegreya SC", serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(197, 168, 116, 0.75);
  white-space: nowrap;
}
.level-jump input {
  width: 84px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(206, 168, 92, 0.5);
  background: linear-gradient(180deg, rgba(30, 16, 8, 0.9), rgba(54, 30, 13, 0.9));
  color: #edd5a1;
  font-family: "Alegreya SC", serif;
  font-size: 15px;
  letter-spacing: 0.06em;
  outline: none;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.55);
}
.level-jump input:focus { border-color: rgba(255, 222, 152, 0.8); outline: 1px solid rgba(255, 226, 160, 0.55); outline-offset: 1px; }
.level-jump .brass-button { padding: 9px 16px; }
body.layout-portrait .level-jump { margin-top: 9px; padding-top: 9px; }
body.layout-portrait .level-jump input { width: 72px; height: 32px; }
