@font-face {
  font-family: "DM Sans";
  src: url('/assets/dm-sans.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url('/assets/cormorant-garamond.woff2') format('woff2');
  font-weight: 500 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #0b090a;
  --cream: #f6e8d5;
  --muted: #c9b8a8;
  --gold: #d4a54a;
  --gold-light: #f0c882;
  --gold-rim: #977139;
  --line: #72552e;
  --surface: #191211;
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden], .sprite { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink) url('/assets/nangles-velvet.webp') center top / cover no-repeat;
  color: var(--cream);
  font: 15px/1.4 var(--body);
}
h1, h2, p { margin: 0; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 4px;
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell, .header-content { width: min(1540px, calc(100% - 48px)); margin-inline: auto; }
.header-content {
  min-height: clamp(80px, 9.35dvh, 106px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 2vw, 32px);
}
.brand {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.55vw, 24px);
  position: relative;
  width: max-content;
}
.brand::before, .brand::after {
  content: "";
  position: absolute;
  width: clamp(24px, 12vw, 210px);
  border-top: 1px solid var(--line);
  top: 50%;
}
.brand::before { right: calc(100% + 12px); }
.brand::after { left: calc(100% + 12px); }
.brand-crest {
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(58px, 7.8dvh, 86px);
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: #131011;
  overflow: hidden;
}
.brand-crest img {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: screen;
}
.brand-type {
  display: grid;
  gap: 3px;
  text-align: center;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--gold-light);
  font: 700 clamp(31px, 3.3vw, 52px)/.94 var(--display);
  letter-spacing: .21em;
}
.brand-type small { font-size: .47em; letter-spacing: .37em; padding-top: 3px; }
.header-pages, .header-tools { display: flex; align-items: center; gap: 10px; z-index: 1; }
.header-pages { grid-column: 1; }
.header-pages button { min-height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #170e11; font-size: 13px; }
.header-pages svg { width: 16px; color: var(--gold-light); }
.header-tools { grid-column: 3; justify-content: end; }
.quiet, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-weight: 650;
}
.quiet:hover, .icon-button:hover { color: var(--gold-light); }
.icon-button { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; }
.header-rules { color: var(--cream); white-space: nowrap; padding: 0 5px; }
.header-rules svg { display: none; }
.header-tools .icon-button svg { width: 17px; }

.match-bar {
  display: flex;
  align-items: center;
  margin: 4px auto clamp(17px, 2.9dvh, 31px);
  padding: clamp(8px, 1.25dvh, 14px) clamp(12px, 2.1vw, 32px);
  width: min(83%, 1260px);
  border: 1px solid var(--gold-rim);
  border-radius: 19px;
  background: #0b090add;
}
.match-round {
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.match-round > *, .score-row { padding-inline: clamp(12px, 2.2vw, 35px); }
.match-round strong { font: 700 clamp(23px, 2.4vw, 33px)/1 var(--display); }
.match-round span { font-size: clamp(13px, 1.4vw, 20px); }
.match-round span, .scores, .score-row + .score-row { border-left: 1px solid var(--line); }
.scores {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}
.score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(7px, 1.2vw, 17px);
  min-width: 0;
  position: relative;
  font: 700 clamp(19px, 2.1vw, 28px)/1 var(--display);
}
.scores:where(:has(> :nth-child(5))) .score-row { padding-inline: clamp(4px, 1vw, 14px); }
.score-row.self { color: var(--gold-light); }
.score-row.self::before {
  content: "";
  position: absolute;
  inset: -4px 12px;
  border: 1px solid var(--gold-rim);
  border-radius: 99px;
  pointer-events: none;
}
.score-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-name small {
  display: block;
  font: 500 12px/1.1 var(--body);
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.knockout-note {
  margin: -6px auto 12px;
  padding-inline: 12px;
  color: var(--gold-light);
  font-size: 13px;
  text-align: center;
}
.score-number { color: var(--cream); font: 700 clamp(14px, 1.6vw, 22px)/1 var(--body); }

.table-card { min-width: 0; }
.felt {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template: auto minmax(0, 1fr) auto / minmax(0, 1fr);
  height: clamp(340px, 55.9dvh, 638px);
  border: 2px solid var(--gold-rim);
  border-radius: clamp(24px, 3.6vw, 53px);
  overflow: hidden;
  background: #171414;
  box-shadow: inset 0 0 120px #000c, 0 10px 35px #0009;
}
.felt::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url('/assets/felt.webp') repeat;
  opacity: .36;
  mix-blend-mode: soft-light;
  pointer-events: none;
}
.felt-frame {
  position: absolute;
  z-index: 2;
  inset: clamp(5px, .72vw, 11px);
  border: 2px solid var(--gold);
  border-radius: inherit;
  pointer-events: none;
}
.felt-frame::after {
  content: "";
  position: absolute;
  inset: clamp(4px, .48vw, 7px);
  border: 1px solid var(--line);
  border-radius: inherit;
}
.table-top {
  display: flex;
  justify-content: center;
  padding: clamp(27px, 5.35dvh, 58px) clamp(21px, 4.5vw, 67px) 0;
  min-width: 0;
}
.opponents {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(16px, 5.25vw, 80px);
  width: 100%;
  min-width: 0;
}
.opponents:where(:has(> :nth-child(4))) { gap: clamp(16px, 2.6vw, 40px); }
.opponent {
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  gap: clamp(7px, 1.18vw, 17px);
  color: var(--cream);
  border: 1px solid transparent;
  border-radius: 15px;
  padding: 3px 5px;
}
.opponent.active {
  border-color: var(--gold-rim);
  background: #302017b0;
  box-shadow: 0 0 24px #c9914533;
}
.opponent:is(.partner, .expert) .opponent-meta { color: var(--gold-light); font-weight: 750; }
.opponent-copy { min-width: 0; }
.opponent-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 clamp(22px, 2.06vw, 30px)/1 var(--display);
}
.opponent-meta {
  color: var(--cream);
  font-size: clamp(12px, 1.17vw, 17px);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background-color: #71472d;
  color: var(--cream);
  font-weight: 800;
  text-transform: uppercase;
}
.opponent .avatar { width: clamp(45px, 7.9dvh, 84px); height: auto; aspect-ratio: 1; }
.avatar.portrait { background-image: url('/assets/portraits.webp'); background-repeat: no-repeat; background-size: 300% 100%; color: transparent; }
.avatar.tone-1 { background-position: 0% 50%; background-color: #8c573a; }
.avatar.tone-2 { background-position: 50% 50%; background-color: #843f4b; }
.avatar.tone-3 { background-position: 100% 50%; background-color: #556c4a; }
.avatar.tone-4 { background-color: #58698b; }
.avatar.tone-5 { background-color: #683345; }
.avatar.tone-6 { background-color: #785326; }
.avatar.portrait.tone-7 { background: #355752 url('/assets/portrait-sandra.webp') center / cover no-repeat; }
.avatar.portrait.tone-8 { background: #643b54 url('/assets/portrait-shan.webp') center / cover no-repeat; }
.avatar.tone-0 { background-color: #604327; }
.tile-back {
  flex: none;
  padding: 4px 8px;
  border: 1px solid var(--gold-rim);
  border-radius: 7px;
  color: var(--gold-light);
  font-size: clamp(11px, 1.15vw, 16px);
  font-weight: 700;
  white-space: nowrap;
}
.tile-back.low-count { background: var(--gold-light); color: #231309; }

.round-ended .felt { height: auto; min-height: clamp(340px, 55.9dvh, 638px); }
.round-ended .board { min-height: clamp(190px, 34dvh, 390px); }
.revealed-opponents {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: start;
  gap: clamp(5px, 1.4vw, 20px);
}
.revealed-opponents .opponent { flex-wrap: wrap; justify-content: center; gap: 6px 8px; }
.revealed-opponents .avatar { width: clamp(29px, 4.7vw, 60px); }
.revealed-hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.revealed-tile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: none;
  width: 46px;
  height: 24px;
  border: 1px solid #ffedce;
  border-radius: 5px;
  background: linear-gradient(#fff1d3, #ead5b2);
  box-shadow: 0 2px #9e7c52;
}
.revealed-tile .half { padding: 2px 3px; }
.revealed-tile .half + .half { border-top: 0; border-left: 1px solid #a48c6b; }
.revealed-tile .pip { width: 3.5px; height: 3.5px; box-shadow: none; }
.revealed-empty { color: var(--muted); font-size: 12px; }

.board {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin-inline: clamp(15px, 4vw, 61px);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.scene, .markers { position: absolute; inset: 0; }
.scene canvas { width: 100%; height: 100%; display: block; }
.markers { pointer-events: none; }
.stamp {
  position: absolute;
  top: 79%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(65px, 10.5vw, 152px);
  height: auto;
  filter: grayscale(1) brightness(.75) drop-shadow(0 2px 1px #050303);
  mix-blend-mode: screen;
  opacity: .2;
  pointer-events: none;
}
.end-marker {
  position: absolute;
  left: var(--end-x);
  top: var(--end-y);
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: grid;
  place-items: center;
  min-width: clamp(28px, 3.55vw, 53px);
  height: clamp(28px, 3.55vw, 53px);
  padding-inline: 4px;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background: #100b0a;
  color: var(--gold-light);
  box-shadow: 0 2px 6px #03010070;
  font: 700 clamp(22px, 2.6vw, 37px)/1 var(--display);
}
.end-marker.available {
  --size: clamp(44px, 3.55vw, 53px);
  left: clamp(var(--size) / 2, var(--end-x), 100% - var(--size) / 2);
  top: clamp(var(--size) / 2, var(--end-y), 100% - var(--size) / 2);
  width: var(--size);
  height: var(--size);
  pointer-events: auto;
  touch-action: manipulation;
  background: var(--gold-light);
  color: #231309;
  box-shadow: 0 0 17px #e6ac5c6b;
}
.last-tile-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid #ffdfaa;
  border-radius: 1px;
  background: var(--gold);
  box-shadow: 0 0 8px #ffe4aa80;
  animation: mark-tile .45s ease-out both;
}
@keyframes mark-tile { 0%, 55% { opacity: 0; } 100% { opacity: 1; } }
.felt-bottom {
  min-height: 43px;
  padding: 0 clamp(25px, 3.8vw, 57px) clamp(12px, 2.1dvh, 23px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.activity, .yard { display: flex; align-items: center; gap: 6px; min-width: 0; }
.activity svg, .log-button svg { width: 15px; height: 15px; color: var(--gold-light); }
.yard, .block-table { justify-self: end; white-space: nowrap; }
.yard strong { color: var(--gold-light); padding-inline: 4px; border: 1px solid var(--line); border-radius: 4px; }
.log-button { color: var(--muted); font-size: 13px; padding: 4px; }
.log-button:disabled { opacity: .5; }
.empty-board {
  display: grid;
  justify-items: center;
  gap: 7px;
  z-index: 1;
  text-align: center;
  background: #140f0ef4;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 16px 25px;
  max-width: min(400px, 95%);
}
.empty-board h3 { font: 700 clamp(28px, 3.4vw, 47px)/1 var(--display); margin: 0; color: var(--gold-light); }
.empty-board p { color: var(--muted); font-size: 14px; }

.table-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 24%);
  align-items: center;
  gap: clamp(20px, 4vw, 59px);
  padding: clamp(13px, 2.7dvh, 28px) clamp(14px, 3.2vw, 46px) 24px;
}
.rack {
  display: grid;
  grid-template: auto 1fr / minmax(160px, 28%) minmax(0, 1fr);
  column-gap: clamp(10px, 2.1vw, 31px);
  min-width: 0;
}
.rack-top {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  padding-inline: 8px;
}
.hand-label { display: flex; align-items: center; gap: 7px; }
.hand-label span { color: var(--gold-light); white-space: nowrap; }
.sort { padding: 2px 5px; font-size: 13px; }
.sort svg { width: 15px; height: 15px; }
.hand {
  grid-row: 2;
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: 9px;
  min-height: 105px;
  padding: 8px 9px 13px;
}
.bone {
  position: relative;
  isolation: isolate;
  flex: none;
  display: grid;
  grid-template-rows: 1fr 1fr;
  width: 45px;
  height: 86px;
  padding: 4px;
  color: #261a13;
  background: #e9d7b8;
  border: 1px solid #fff1d9;
  border-bottom-color: #c5aa83;
  border-radius: 7px;
  box-shadow: 0 4px #8d7150, 0 7px 7px #080401aa, inset 0 0 2px #fff;
  transition: transform .16s, box-shadow .16s, filter .16s;
  touch-action: manipulation;
}
.bone:disabled { filter: saturate(.72) brightness(.82); }
.bone.playable { box-shadow: 0 4px #8d7150, 0 7px 7px #080401aa, 0 0 0 2px var(--gold-light); }
.bone.playable:hover, .bone.selected { transform: translateY(-5px); }
.half { display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); align-items: center; justify-items: center; padding: 6px 4px; }
.half + .half { border-top: 1px solid #a48c6b; }
.pip { background: #251b15; width: 6px; height: 6px; border-radius: 50%; box-shadow: inset 0 1px #080503, 0 1px #fff0dc; }
.flat-bone { position: absolute; width: calc(var(--unit) * .96); height: calc(var(--unit) * 1.93); padding: 2px; border-radius: 5px; }
.flat-bone .half { padding: 10%; }
.flat-bone .pip { width: clamp(2px, calc(var(--unit) * .13), 9px); height: clamp(2px, calc(var(--unit) * .13), 9px); }

.hand.blender-tiles .bone {
  width: clamp(41px, calc((100% - 63px) / 8), min(96px, 9.4dvh));
  height: auto;
  aspect-ratio: 3 / 5;
  appearance: none;
  isolation: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: none;
  transform: none;
}
.hand.blender-tiles .bone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('/assets/domino-rack.webp') var(--tile-art) / 700% 400% no-repeat;
  filter: drop-shadow(0 5px 4px #070301c9);
  transform: rotate(8deg);
  pointer-events: none;
}
.hand.blender-tiles .half { visibility: hidden; }
.hand.blender-tiles .bone:disabled::before { filter: brightness(.79) saturate(.8) drop-shadow(0 3px 3px #070301a0); }
.round-ended .hand .bone:disabled { filter: none; }
.round-ended .hand.blender-tiles .bone:disabled::before { filter: drop-shadow(0 5px 4px #070301c9); }
.hand.blender-tiles .bone.playable::before {
  filter: drop-shadow(0 0 1px #ffdea1) drop-shadow(0 0 2px #f4b65f) drop-shadow(0 4px 7px #c8803680);
}
.hand.blender-tiles .bone.playable:hover, .hand.blender-tiles .bone.selected { transform: translateY(-5px); }
.hand.blender-tiles .bone.playable:hover::before, .hand.blender-tiles .bone.selected::before {
  filter: drop-shadow(0 0 1px #fff1cf) drop-shadow(0 0 3px #ffc05f) drop-shadow(0 6px 8px #c8803690);
}

.rack-bottom {
  grid-area: 1 / 1 / span 2 / 2;
  display: grid;
  align-content: center;
  align-items: start;
  justify-items: start;
  gap: 8px;
  min-width: 0;
}
.turn-message { display: grid; justify-items: start; gap: 5px; color: var(--muted); font-size: 13px; }
.turn-label { color: var(--cream); font: 700 clamp(24px, 3vw, 42px)/1 var(--display); }
.turn-label.live {
  padding: 6px clamp(14px, 2.4vw, 36px) 8px;
  border: 1px solid var(--gold-light);
  border-right-color: var(--line);
  border-radius: 999px;
  background: #100a0add;
}
.rack-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.table-modes { display: grid; gap: 10px; }
.mode-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-items: start;
  gap: 0 12px;
  min-height: clamp(45px, 5.6dvh, 62px);
  padding: 8px clamp(13px, 1.5vw, 24px);
  border: 1px solid var(--gold-rim);
  border-radius: 999px;
  background: #100909dd;
  color: var(--cream);
  text-align: left;
  font-size: clamp(15px, 1.6vw, 23px);
}
.mode-option strong { font-weight: 700; }
.mode-option svg { color: var(--gold-light); width: clamp(20px, 2.1vw, 30px); height: clamp(20px, 2.1vw, 30px); }
.mode-option .chevron { grid-column: 3; grid-row: 1; width: 16px; height: 16px; }
.mode-option small { grid-column: 2; color: var(--gold-light); font-size: 12px; }
.mode-option.solo-option { background: linear-gradient(#825926, #583717); }
.mode-option:hover { border-color: var(--gold-light); background: #361713; }
.mode-option.solo-option:hover { background: #925d2b; }
.forfeit-round { justify-self: center; grid-column: 1 / -1; min-height: 40px; color: #efbaac; font-size: 13px; }
.forfeit-round:hover { color: var(--cream); }

.primary, .secondary, .danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}
.primary { background: var(--gold-light); color: #27170c; }
.primary:hover:not(:disabled) { background: #ffde9f; }
.primary:disabled, .secondary:disabled { opacity: .55; }
.secondary { background: #34231b; border-color: var(--line); }
.secondary:hover:not(:disabled) { background: #50341f; }
.danger { background: transparent; border-color: #835443; color: #efbaac; }
.danger:hover { background: #522321; }

dialog {
  width: min(460px, calc(100% - 26px));
  max-height: calc(100dvh - 26px);
  overflow: auto;
  color: var(--cream);
  background: #1a1212;
  border: 1px solid var(--gold-rim);
  border-radius: 18px;
  box-shadow: 0 20px 70px #050201eb;
  padding: 22px 24px 24px;
}
dialog::backdrop { background: #0b0709dc; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 17px; }
.dialog-header h2 { font: 700 45px/.97 var(--display); }
.dialog-header p { color: var(--gold-light); text-transform: uppercase; letter-spacing: .13em; font-size: 11px; font-weight: 800; margin-bottom: 5px; }
.dialog-header p:empty { display: none; }
.dialog-text, .rules { color: var(--muted); font-size: 14px; }
.dialog-text { margin-bottom: 15px; }
.rules { margin: 0; padding-left: 22px; display: grid; gap: 12px; }
.rules strong { color: var(--cream); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.dialog-actions button { min-height: 42px; }
.dialog-actions .primary { flex: 1; }

body:has(.winner-ceremony[open]) { overflow: hidden; }
.winner-ceremony[open] {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 54px 20px 32px;
  border: 0;
  border-radius: 0;
  display: grid;
  align-content: safe center;
  justify-items: center;
  isolation: isolate;
  text-align: center;
  background: radial-gradient(ellipse at 50% 37%, #4c2416ec 0%, #26121aed 42%, #0d080df5 82%), url('/assets/felt.webp');
}
.winner-ceremony > :is(.dialog-header, #modal-body, .winner-trophy) { z-index: 1; }
.winner-ceremony .dialog-header { justify-content: center; margin: 19px 0 12px; }
.winner-ceremony .dialog-header p { margin-bottom: 10px; font-size: 13px; letter-spacing: .24em; }
.winner-ceremony .dialog-header h2 { font-size: clamp(43px, 8vw, 100px); overflow-wrap: anywhere; color: #fff0cd; }
.winner-ceremony #modal-body { max-width: min(560px, 100%); }
.winner-ceremony .dialog-text { font-size: clamp(15px, 2.2vw, 20px); color: #ead9bd; }
.winner-ceremony .dialog-actions { justify-content: center; margin-top: 28px; }
.winner-ceremony .dialog-actions button { min-width: 112px; min-height: 46px; flex: 0 1 auto; }
.winner-ceremony .close-dialog { position: absolute; top: 12px; right: 12px; }
.winner-team { color: var(--gold-light); margin: 0 0 8px; font-size: 20px; }
.winner-trophy {
  position: relative;
  isolation: isolate;
  width: clamp(178px, min(34vw, 44dvh), 310px);
  aspect-ratio: 1;
  filter: drop-shadow(0 14px 19px #080301aa) drop-shadow(0 0 28px #e79b3e37);
}
.winner-trophy-art { display: block; width: 100%; height: auto; }
.winner-trophy-crest {
  position: absolute;
  left: 49.45%;
  top: 29.2%;
  transform: translate(-50%, -50%);
  width: 36%;
  height: auto;
  border-radius: 50%;
  mix-blend-mode: screen;
}
.winner-effects { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.winner-confetti, .winner-balloon { position: absolute; display: block; }
.winner-confetti {
  left: var(--x);
  top: var(--y);
  width: 8px;
  height: 13px;
  border-radius: 2px;
  background: #efb25f;
  animation: winner-fall 6s linear 2 both;
  animation-delay: calc(0s - var(--delay));
}
.winner-confetti:nth-child(3n) { background: #d66c74; width: 6px; }
.winner-confetti:nth-child(5n) { background: #fff0cd; height: 8px; }
@keyframes winner-fall {
  from { transform: translate(0, -65dvh) rotate(0deg); opacity: .85; }
  85% { opacity: .8; }
  to { transform: translate(12vw, 104dvh) rotate(550deg); opacity: 0; }
}
.winner-balloon {
  --balloon: #c47941;
  --wind: 1;
  width: clamp(32px, 8vw, 100px);
  aspect-ratio: 4 / 5;
  border-radius: 51% 49% 49% 51% / 47% 47% 53% 53%;
  background: radial-gradient(ellipse at 32% 24%, #fff4deaa, transparent 34%), var(--balloon);
  box-shadow: inset -7px -10px 16px #41132077;
  animation: winner-rise 5s cubic-bezier(.18,.5,.42,1) both;
}
.winner-balloon::after {
  content: '';
  position: absolute;
  inset: 99% auto auto 50%;
  width: 11px;
  height: 75%;
  border-left: 1px solid #d6a875b3;
  border-radius: 50%;
}
.winner-balloon:nth-last-child(1) { bottom: 21%; left: 6%; }
.winner-balloon:nth-last-child(2) { bottom: 36%; left: 13%; --balloon: #a33f55; animation-delay: -.8s; }
.winner-balloon:nth-last-child(3) { bottom: 8%; left: 17%; --balloon: #bb4f42; animation-delay: -1.5s; }
.winner-balloon:nth-last-child(4) { bottom: 18%; right: 7%; --balloon: #ae4d5d; --wind: -1; animation-delay: -1.9s; }
.winner-balloon:nth-last-child(5) { bottom: 36%; right: 11%; --wind: -1; animation-delay: -.4s; }
.winner-balloon:nth-last-child(6) { bottom: 8%; right: 18%; --balloon: #a95142; --wind: -1; animation-delay: -1.2s; }
@keyframes winner-rise {
  0% { transform: translate(calc(var(--wind) * -14px), 48dvh) rotate(calc(var(--wind) * -14deg)); }
  38% { transform: translate(calc(var(--wind) * 32px), 22dvh) rotate(calc(var(--wind) * 15deg)); }
  67% { transform: translate(calc(var(--wind) * -16px), 7dvh) rotate(calc(var(--wind) * -8deg)); }
  87% { transform: translate(calc(var(--wind) * 10px), -12px) rotate(calc(var(--wind) * 6deg)); }
  100% { transform: none; }
}
@media (max-width: 520px) { .winner-balloon { opacity: .57; } }
@media (max-height: 420px) { .winner-trophy { width: min(164px, 38dvh); } }
@media (prefers-reduced-motion: reduce) {
  .winner-confetti, .winner-balloon { animation: none; }
  .winner-confetti { opacity: .45; }
}

.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-size: 13px; font-weight: 750; }
.form input, .form select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #120e0d;
  color: var(--cream);
}
.form input[type=checkbox] { accent-color: var(--gold-light); width: 17px; min-height: 17px; }
.form .checkbox { display: flex; align-items: center; gap: 8px; }
.format-hint { color: var(--muted); font-size: 13px; margin-top: -6px; }
.tabs { display: flex; gap: 6px; padding: 4px; background: #120e0d; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 14px; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 5px; padding: 7px 6px; font-weight: 750; }
.tabs button[aria-pressed=true] { background: #573920; color: var(--cream); }
.room-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: #120e0d; padding: 9px 12px; margin-bottom: 12px; }
.room-code strong { color: var(--gold-light); font: 700 36px/1 var(--display); letter-spacing: .12em; user-select: all; }
.room-code .secondary { white-space: nowrap; }
.room-players { list-style: none; padding: 0; margin: 0 0 13px; display: grid; gap: 6px; }
.room-players li { display: flex; gap: 8px; align-items: center; padding: 5px 7px; border-radius: 7px; background: var(--surface); font-size: 13px; }
.room-players .avatar { width: 27px; height: 27px; font-size: 10px; }
.room-players small { margin-left: auto; color: var(--muted); }
.feedback { color: #ffd1b5; font-size: 13px; margin-top: 8px; overflow-wrap: anywhere; }
.feedback:empty { display: none; }
.feedback input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
.move-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.move-log li { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid #553b29; font-size: 13px; color: var(--muted); }
.move-text { min-width: 0; overflow-wrap: anywhere; }
.move-text strong { color: var(--cream); font-weight: 750; }
.move-text small { display: block; margin-top: 2px; }
.move-icon { flex: none; width: 25px; height: 25px; border: 1px solid var(--line); border-radius: 7px; display: grid; place-items: center; color: var(--gold-light); background: #302015; }
.move-icon svg { width: 14px; height: 14px; }
.full-history { max-height: min(54dvh, 470px); overflow: auto; padding-right: 4px; }

@media (max-width: 1050px) {
  .brand::before, .brand::after { width: 8vw; }
  .match-bar { width: 93%; }
  .match-round > *, .score-row { padding-inline: 16px; }
  .score-row.self::before { inset-inline: 7px; }
  .opponents { gap: clamp(9px, 2.8vw, 35px); }
  .table-controls { gap: 18px; padding-inline: 12px; grid-template-columns: minmax(0, 1fr) minmax(172px, 23%); }
  .rack { grid-template-columns: minmax(120px, 25%) minmax(0, 1fr); }
  .mode-option { column-gap: 7px; }
}
@media (max-width: 800px) {
  .shell, .header-content { width: calc(100% - 26px); }
  .header-content { grid-template-columns: minmax(0, 1fr) auto; min-height: 77px; }
  .brand { grid-column: 1; }
  .brand::before, .brand::after { display: none; }
  .header-content { row-gap: 5px; padding-block: 8px; }
  .header-tools { grid-column: 2; grid-row: 1; }
  .header-pages { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .match-bar { width: 100%; }
  .felt { height: clamp(300px, 48dvh, 430px); }
  .table-top { padding-inline: 22px; }
  .tile-back span { display: none; }
  .table-controls { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-inline: 4px; }
  .table-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-option { justify-items: center; font-size: 15px; }
}
@media (max-width: 520px) {
  .shell, .header-content { width: calc(100% - 18px); }
  .header-content { min-height: 66px; gap: 9px; }
  .brand { gap: 8px; }
  .brand-crest { width: clamp(40px, 11.5vw, 55px); }
  .brand-type { font-size: clamp(22px, 6.25vw, 31px); letter-spacing: .13em; gap: 2px; }
  .brand-type small { font-size: .51em; letter-spacing: .24em; padding-top: 1px; }
  .header-tools { gap: 6px; }
  .header-rules, .header-tools .icon-button { width: 40px; height: 40px; padding: 0; }
  .header-rules { border: 1px solid var(--line); border-radius: 50%; }
  .header-rules span { display: none; }
  .header-rules svg { display: block; width: 17px; }
  .match-bar { display: grid; gap: 5px; padding: 6px 8px 8px; border-radius: 12px; margin-bottom: 11px; }
  .match-round { justify-content: center; }
  .match-round strong { font-size: 22px; }
  .match-round span { font-size: 11px; }
  .match-round > *, .score-row { padding-inline: 7px; }
  .scores { border-left: 0; border-top: 1px solid #5c432a; padding-top: 7px; }
  .score-row { font-size: 17px; gap: 4px; }
  .score-row.self::before { inset: -2px 1px; }
  .score-number { font-size: 12px; }
  .score-name small { font-size: 10px; }
  .felt { height: clamp(281px, 42dvh, 365px); border-radius: 24px; }
  .round-ended .felt { min-height: 281px; }
  .revealed-opponents { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr)); }
  .felt-frame { inset: 5px; border-width: 1px; }
  .table-top { padding: 20px 14px 2px; }
  .opponents { align-items: start; gap: 4px; }
  .opponent { justify-content: center; gap: 3px; padding: 2px 4px; }
  .opponent .avatar { width: 28px; }
  .opponent-name { font-size: 16px; }
  .opponent-meta { font-size: 10px; margin-top: 1px; }
  .seat-word { display: none; }
  .tile-back { font-size: 10px; padding: 2px 4px; border-radius: 4px; }
  .board { margin-inline: 13px; }
  .stamp { width: 67px; top: 86%; }
  .end-marker { min-width: 25px; height: 25px; font-size: 19px; }
  .felt-bottom { padding-inline: 15px; min-height: 36px; font-size: 11px; }
  .activity svg, .log-button svg { display: none; }
  .log-button { font-size: 11px; padding-inline: 2px; }
  .table-controls { padding: 8px 2px 14px; gap: 9px; }
  .rack { grid-template: auto auto auto / minmax(0, 1fr); gap: 3px; }
  .rack-top, .hand { grid-column: 1; }
  .rack-bottom { grid-area: 3 / 1; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 0 8px; }
  .rack-top { font-size: 12px; }
  .hand { min-height: 83px; padding: 5px 4px 9px; gap: 5px; }
  .hand.blender-tiles .bone { width: clamp(41px, calc((100% - 35px) / 8), 46px); }
  .turn-label { font-size: 23px; }
  .turn-label.live { padding: 3px 11px 5px; }
  .turn-message { font-size: 11px; gap: 3px; }
  .rack-actions .secondary, .rack-actions .primary { min-height: 44px; padding-inline: 7px; font-size: 12px; }
  .rack-bottom:has([data-end]), .round-ended .rack-bottom { grid-template-columns: 1fr; }
  .rack-actions [data-end] { flex: 1; }
  .mode-option { min-height: 44px; padding-inline: 10px; font-size: 14px; }
  .mode-option { grid-template-columns: auto minmax(0, 1fr); }
  .mode-option .chevron { display: none; }
}
@media (max-width: 395px) {
  .opponent .avatar { width: 22px; }
  .opponent-meta { max-width: 48px; }
  .header-tools { gap: 4px; }

}
@media (max-width: 350px) {
  .header-rules, .header-tools .icon-button { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.home-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, .9fr);
  gap: clamp(28px, 6vw, 96px);
  align-items: center;
  width: min(1180px, calc(100% - 54px));
  min-height: min(680px, 78dvh);
  padding-block: clamp(24px, 5dvh, 62px);
}
.home-intro { min-width: 0; padding: 14px 0; }
.home-crest {
  display: block;
  width: clamp(74px, 10vw, 124px);
  height: auto;
  border: 1px solid var(--gold-rim);
  border-radius: 50%;
}
.home-intro h2 {
  margin-top: 16px;
  color: var(--cream);
  font: 700 clamp(54px, 8vw, 116px)/.88 var(--display);
  letter-spacing: -.055em;
}
.home-intro p { max-width: 365px; margin: 18px 0 23px; color: var(--muted); font-size: clamp(15px, 1.45vw, 19px); }
.home-actions, .home-links { display: flex; flex-wrap: wrap; gap: 10px; }
.home-actions button { min-width: 144px; min-height: 50px; border-radius: 999px; padding-inline: 20px; font-size: 15px; }
.home-actions .secondary { background: #130c0e; }
.home-actions .secondary:hover { background: #33191a; }
.home-links { margin-top: 9px; }
.home-links button { padding: 7px 4px; color: var(--gold-light); }
.weekly-card {
  display: grid;
  gap: 7px;
  max-width: 420px;
  margin-top: 20px;
  padding: 14px 16px;
  background: #150e0fe6;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.weekly-card h3 { margin: 0; color: var(--gold-light); font: 700 27px/1 var(--display); }
.weekly-card p { margin: 0; font-size: 14px; }
.weekly-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.weekly-actions button { min-height: 44px; }
.weekly-actions .quiet { color: var(--gold-light); }
.leaderboard {
  min-width: 0;
  padding: clamp(14px, 2vw, 30px);
  border: 1px solid var(--gold-rim);
  border-radius: 22px;
  background: #100c0dea;
}
.leader-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.leader-header h2 { font: 700 clamp(33px, 4vw, 53px)/1 var(--display); }
.leader-header svg { color: var(--gold-light); width: 25px; height: 25px; }
.leader-scroll { max-height: min(406px, 52dvh); overflow: auto; scrollbar-color: var(--gold-rim) var(--surface); }
.leaderboard table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; }
.leaderboard.dialog-leaderboard { padding: 0; border: 0; background: transparent; box-shadow: none; }
.leaderboard th, .leaderboard td { padding: 10px 4px; border-bottom: 1px solid #523b27; text-align: right; }
.leaderboard thead th { color: var(--gold-light); background: #100c0d; font-weight: 750; position: sticky; top: 0; }
.leaderboard :is(th, td):first-child { text-align: left; width: 13%; }
.leaderboard :is(th, td):nth-child(2) { text-align: left; width: 32%; overflow-wrap: anywhere; }
.leaderboard :is(th, td):last-child { width: 22%; }
.weekly-standings :is(th, td):first-child { width: 49%; overflow-wrap: anywhere; }
.weekly-standings :is(th, td):nth-child(2) { width: 21%; text-align: right; }
.weekly-standings :is(th, td):last-child { width: 30%; }
.leaderboard td[colspan] { width: auto; padding: 17px 4px; color: var(--muted); line-height: 1.55; }
.header-home { padding: 0 4px; }
.profile-code { color: var(--cream); margin-bottom: 16px; }
.profile-code p { color: var(--muted); margin: 3px 0 7px; }
.profile-code code { color: var(--gold-light); font-size: clamp(16px, 4.4vw, 21px); user-select: all; }
.setup-form .feedback { grid-column: 1 / -1; }
.code-help { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.code-help summary { width: fit-content; color: var(--gold-light); cursor: pointer; }
.code-help p { margin: 6px 0 0; }

.drafting .felt { height: auto; min-height: clamp(420px, 57dvh, 620px); }
.drafting .board { min-height: 350px; }
.draft-board {
  position: relative;
  z-index: 2;
  width: min(100%, 540px);
  padding: 14px 5px;
  text-align: center;
  align-self: center;
}
.draft-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 18px; margin-bottom: 10px; }
.draft-status { color: var(--gold-light); font: 700 clamp(23px, 3vw, 35px)/1 var(--display); }
.draft-count { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
#draft-random { min-height: 44px; }
.draft-tiles {
  --size: clamp(31px, min(8vw, 5.7dvh), 48px);
  display: grid;
  grid-template-columns: repeat(7, var(--size));
  grid-auto-rows: calc(var(--size) * 1.68);
  gap: 7px;
  justify-content: center;
  padding: 5px;
}
.draft-tile, .draft-slot {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
}
.draft-tile {
  position: relative;
  background: #171110 url('/assets/nangles-crest.webp') center / 100% auto no-repeat;
  border: 1px solid var(--gold-rim);
  box-shadow: 0 3px 0 #5a3a24, 0 5px 7px #000a;
  transition: transform .14s ease, border-color .14s ease;
}
.draft-tile:not(:disabled):hover { transform: translateY(-3px); border-color: var(--gold-light); }
.draft-tile:disabled { filter: brightness(.72); }
.draft-slot { border: 1px solid #64472950; background: #0f0a0860; }
.shuffling .draft-tile { animation: mix-tile .7s cubic-bezier(.37,.08,.31,1) both; animation-delay: var(--delay); }
@keyframes mix-tile {
  30% { transform: translate(var(--dx), var(--dy)) rotate(var(--twist)) scale(.88); }
  62% { transform: translate(calc(var(--dx) * -.58), calc(var(--dy) * -.62)) rotate(calc(var(--twist) * -.55)); }
  100% { transform: none; }
}
.drafting .stamp { opacity: .08; }
.drafting .felt-bottom { margin-top: 10px; }

@media (min-width: 560px) {
  .setup-form { grid-template-columns: 1fr 1fr; }
  .setup-form .format-hint, .setup-form .primary { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
  .home-screen { grid-template-columns: 1fr; gap: 20px; width: min(580px, calc(100% - 28px)); min-height: 0; }
  .home-intro { padding: 0; }
  .home-crest { width: 72px; }
}
@media (max-width: 520px) {
  .home-actions button { flex: 1; min-width: 0; min-height: 46px; }
  .home-intro p { margin-block: 12px 17px; }
  .leaderboard table { font-size: 12px; }
  .leaderboard th, .leaderboard td { padding: 7px 3px; }
  .drafting .felt { min-height: 0; }
  .drafting .board { min-height: 268px; }
  .draft-tiles { --size: clamp(27px, min(7.9vw, 4.65dvh), 37px); gap: 5px; }
  .header-home { font-size: 12px; padding-inline: 2px; }
  .header-content:has(#home-button:not([hidden])) .brand-type { font-size: clamp(18px, 5.35vw, 27px); }
}
@media (prefers-reduced-motion: reduce) {
  .shuffling .draft-tile { animation: none; }
}
