:root {
  color-scheme: dark;
  --ink: #eef9ff;
  --muted: #a9bdcb;
  --cyan: #72e9fa;
  --gold: #f5d487;
  --line: #263e4e;
  color: var(--ink);
  background: #080c14;
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 85% 12%, #11243d 0, transparent 51%),
    radial-gradient(ellipse at 0 68%, #102b35 0, transparent 36%), #080c14;
}
.shell { width: min(100% - clamp(1.5rem, 6vw, 6rem), 86rem); margin-inline: auto; }
a { color: inherit; text-underline-offset: .23em; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
.site-header {
  position: relative;
  border-bottom: 1px solid #263446;
  background: #080d16db;
}
.site-header::after {
  position: absolute;
  inset: auto 0 -1px;
  height: 2px;
  background: linear-gradient(90deg, #050608 0 34%, #d64449 34% 66%, #2685e8 66%);
  content: "";
}
.site-bar { display: flex; min-height: 4.6rem; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand-seal {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  color: var(--gold);
  border: 1px solid #a48550;
  border-radius: 50%;
  box-shadow: inset 0 0 12px #f4d47f36;
  font: 1.7rem/1 Georgia, serif;
}
.brand strong { display: block; font-size: 1.05rem; line-height: 1.15; letter-spacing: .16em; }
.brand small { display: block; font-size: .55rem; color: var(--muted); font-weight: 650; letter-spacing: .12em; }
.site-bar nav { display: flex; flex-wrap: wrap; justify-content: end; gap: .15rem 1.3rem; }
.site-bar nav a { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; font-size: .88rem; color: #d5e6ed; text-decoration: none; }
.site-bar a:hover { color: var(--cyan); }
main { padding-block: clamp(1rem, 3vw, 2.5rem) 2.5rem; }
.welcome {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: min(38rem, 74svh);
  min-height: max(30rem, min(38rem, 74svh));
  padding: clamp(1.5rem, 7vw, 6rem);
  border: 1px solid #344b5c;
  border-radius: 1.65rem;
  background: #080e1a;
  box-shadow: 0 26px 70px #0009;
}
.welcome img {
  position: absolute;
  z-index: -2;
  inset: 0 0 0 auto;
  width: 73%;
  height: 100%;
  object-fit: cover;
  object-position: 64% center;
}
.welcome::before, .welcome::after { position: absolute; inset: 0; z-index: -1; content: ""; pointer-events: none; }
.welcome::before { background: linear-gradient(90deg, #080e1a 4%, #080e1af5 29%, #080e1a65 60%, #080e1a12 100%); }
.welcome::after { inset: .6rem; border: 1px solid #e7c68826; border-radius: 1.18rem; }
.welcome-content { max-width: 35rem; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 .55rem;
  color: var(--cyan);
  font-size: .72rem;
  font-weight: 780;
  letter-spacing: .16em;
}
.eyebrow span, .table-label span { width: .25rem; height: .25rem; border-radius: 50%; background: var(--gold); box-shadow: 0 0 .5rem var(--gold); }
h1, h2, p, dl { margin-top: 0; }
.welcome h1 { margin-bottom: 1rem; font-size: clamp(3.4rem, 8.7vw, 7.8rem); line-height: .88; letter-spacing: -.07em; }
.welcome h1 em { color: var(--gold); font-style: normal; }
.intro { max-width: 31ch; color: #dfeef5; font-size: clamp(1rem, 1.65vw, 1.25rem); margin-bottom: 1.5rem; }
.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  min-height: 48px;
  padding: .65rem 1.08rem;
  border: 1px solid #8cdef2;
  border-radius: .55rem;
  text-decoration: none;
  font-weight: 730;
}
.primary { background: linear-gradient(115deg, #f9e2a1, #ddb55e); border-color: #f4d98b; color: #181712; box-shadow: 0 0 22px #e6bf6c35, inset 0 1px #fff2c6; }
.primary:hover { background: #ffe6a1; box-shadow: 0 0 30px #e6bf6c56; }
#start { min-width: 10.5rem; justify-content: space-between; }
.primary:disabled { opacity: .58; }
.secondary { background: #10212e; color: var(--ink); border-color: #446273; }
.secondary:hover { border-color: var(--cyan); background: #1b3948; }
.welcome-note { margin: .68rem 0 0; font-size: .84rem; color: #bed0da; }
.arena-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.arena-heading h1 { font-size: clamp(1.85rem, 4.3vw, 4rem); letter-spacing: -.05em; line-height: 1.02; margin: 0; }
.score { display: flex; margin: 0; gap: .55rem; }
.score div { min-width: 5.3rem; padding: .4rem .7rem .52rem; background: #0d1a26; border: 1px solid #315065; border-top: 2px solid var(--cyan); border-radius: .5rem; }
.score div:nth-child(2) { border-top-color: #ed8797; }
.score div:last-child { border-top-color: var(--gold); }
.score dt { font-size: .74rem; color: var(--muted); }
.score dd { margin: .13rem 0 0; color: var(--ink); font: 700 1.55rem/1.1 ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.arena-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(12rem, 15rem); gap: 1rem; }
.table-shell {
  position: relative;
  isolation: isolate;
  min-width: 0;
  padding: clamp(.5rem, 1.2vw, 1rem);
  border: 1px solid #6d5a37;
  border-radius: 1.45rem;
  background: linear-gradient(152deg, #78613a, #273241 24%, #172130 67%, #483725);
  box-shadow: inset 0 1px #d1ab734d, 0 .85rem 2.1rem #0009;
}
.board {
  position: relative;
  min-height: 15rem;
  height: clamp(15rem, 32vw, 28rem);
  overflow: hidden;
  border: 1px solid #50969b;
  border-radius: 1rem;
  background:
    radial-gradient(ellipse at center, #206279c9, #0a273c 68%, #071521 100%),
    repeating-linear-gradient(35deg, transparent 0 2px, #7cc6d64a 2px 3px);
  box-shadow: inset 0 0 42px #000c, 0 0 16px #72e9fa23;
}
.board::before, .board::after {
  position: absolute;
  inset: .55rem;
  border: 1px solid #7ef4f543;
  border-radius: .62rem;
  content: "";
  pointer-events: none;
}
.board::after {
  inset: 14% 20%;
  border-radius: 50%;
  border-color: #f6d3844f;
  box-shadow: 0 0 0 .48rem #f6d38410, inset 0 0 2rem #72e9fa19;
}
.table-mark {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-items: center;
  color: #f4d38060;
  font: clamp(5rem, 13vw, 12rem)/1 Georgia, serif;
  text-shadow: 0 0 30px #f4d38023;
  pointer-events: none;
}
.table-label {
  position: absolute;
  inset: auto 0 .85rem;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .46rem;
  color: #b3dbe2;
  font-size: clamp(.51rem, 1vw, .67rem);
  font-weight: 800;
  letter-spacing: .15em;
  pointer-events: none;
}
.board-tiles { position: absolute; inset: .8rem .85rem 1.95rem; z-index: 3; }
.board.scored { animation: table-score .78s ease-out; }
@keyframes table-score { 26% { box-shadow: inset 0 0 48px #61dff991, 0 0 32px #61dff982; } }
.readout, .rack, #round-result { min-width: 0; border: 1px solid var(--line); border-radius: .9rem; background: #0b1723e8; }
.readout { padding: 1.1rem; }
.readout h2, .rack h2 { margin: 0; font-size: 1rem; }
.total { margin: .35rem 0 .35rem; color: var(--gold); font: 740 clamp(2.8rem, 5.2vw, 4.8rem)/1.05 ui-monospace, monospace; }
.score-note, .ends { color: var(--muted); font-size: .85rem; margin-bottom: .65rem; }
.ends { color: #c7eaf1; }
.status { margin: .85rem 0 0; padding-top: .85rem; border-top: 1px solid var(--line); color: var(--ink); font-size: .93rem; }
.rack { margin-top: .95rem; padding: clamp(.7rem, 2vw, 1.15rem); box-shadow: inset 0 1px #619cb733; }
.rack-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .55rem; margin-bottom: .6rem; }
.rack-heading p { margin: 0; color: var(--muted); text-align: right; font-size: .8rem; }
.hand, .choices { display: flex; flex-wrap: wrap; gap: .6rem; }
.choices:not(:empty), #draw:not([hidden]), #pass:not([hidden]) { margin-top: .8rem; }
.tile {
  --pip: #131a20;
  display: grid;
  grid-template-rows: 1fr 1fr;
  padding: 0;
  color: #10212b;
  background: linear-gradient(145deg, #fff9e2, #e7d4a8);
  border: 1px solid #cfb677;
  border-radius: .36rem;
  box-shadow: inset 0 1px #fff, inset 0 -3px #9c7e5465, 0 3px 7px #000a;
}
.hand .tile { width: clamp(44px, 5.2vw, 61px); height: clamp(74px, 9.3vw, 101px); }
.tile-face { position: relative; display: block; min-width: 0; min-height: 0; }
.tile-face + .tile-face { border-top: 1px solid #876f3f91; }
.tile-pip {
  position: absolute;
  display: block;
  left: calc(24% + var(--pip-x) * 26%);
  top: calc(24% + var(--pip-y) * 26%);
  width: 19%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--pip);
  box-shadow: inset 0 1px #000a, 0 1px #fffa;
}
.hand .tile:disabled { opacity: .67; }
.hand .tile:enabled { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 0 13px #61eaff75, inset 0 1px #fff; }
.hand .tile:enabled:hover, .hand .tile[aria-pressed=true] { background: #c3f7fa; transform: translateY(-3px); }
.board .tile { position: absolute; }
.board .horizontal { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.board .horizontal .tile-face + .tile-face { border-top: 0; border-left: 1px solid #876f3f91; }
.choices button { flex-direction: column; gap: .04rem; align-items: start; min-width: 6.5rem; }
.choices small { color: var(--muted); font-size: .7rem; }
.choices .scores small { color: var(--gold); }
#round-result { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem; margin-top: .95rem; padding: 1.05rem; }
#round-result h2 { margin: 0; color: var(--gold); font-size: 1.18rem; }
#round-result p { margin: .28rem 0 0; color: var(--muted); }
.result-actions { display: flex; gap: .55rem; flex-wrap: wrap; }
@media (max-width: 800px) {
  .arena-grid { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
  .readout { display: grid; grid-template-columns: 1fr auto; gap: .2rem .7rem; align-items: center; padding: .62rem .8rem; }
  .readout h2 { font-size: .87rem; }
  .total { grid-column: 2; grid-row: 1 / span 2; margin: 0; font-size: 2rem; text-align: center; }
  .score-note { margin: 0; font-size: .73rem; }
  .ends, .status { grid-column: 1 / -1; margin: 0; }
  .ends { font-size: .77rem; }
  .status { margin-top: .2rem; padding-top: .35rem; font-size: .82rem; }
  .rack { margin-top: .65rem; }
}
@media (max-width: 560px) {
  .site-bar { min-height: 3.9rem; gap: .4rem; }
  .site-bar nav { gap: .15rem .55rem; }
  .site-bar nav a { font-size: .69rem; }
  .brand { gap: .43rem; }
  .brand strong { font-size: .84rem; }
  .brand small { font-size: .46rem; letter-spacing: .07em; }
  .brand-seal { width: 2rem; height: 2rem; font-size: 1.3rem; }
  .welcome { align-items: end; padding: 1.4rem; }
  .welcome img { width: 100%; height: 70%; object-position: 68% 31%; }
  .welcome::before { background: linear-gradient(180deg, #080e1a04 4%, #080e1a26 27%, #080e1ae8 55%, #080e1a 75%); }
  .arena-heading { align-items: start; flex-direction: column; gap: .65rem; margin-bottom: .65rem; }
  .score { width: 100%; gap: .4rem; }
  .score div { flex: 1; min-width: 0; }
  .score dd { font-size: 1.15rem; }
  .board { height: 14rem; min-height: 14rem; }
  .hand { gap: .45rem; }
  .rack-heading p { font-size: .73rem; }
}
@media (prefers-reduced-motion: reduce) {
  .board.scored { animation: none; }
  .hand .tile:enabled:hover, .hand .tile[aria-pressed=true] { transform: none; }
}
