:root {
  color-scheme: dark;
  --bg: #16110e;
  --panel: #221912;
  --text: #fff3e1;
  --muted: #c5aa92;
  --line: #553b2a;
  --gold: #efb76f;
  --focus: #ffd18e;
  font: 16px/1.45 system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 32% 28%, #2c1d14, transparent 65%); }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.shell { width: min(1190px, calc(100% - 64px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid #493325; background: #19120e; }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; gap: 10px; align-items: center; font: bold 1.55rem Georgia, serif; text-decoration: none; }
.mark { color: var(--gold); font: 2rem/1 system-ui, sans-serif; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 315px; gap: 36px; align-items: start; padding: 48px 0; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: Georgia, 'Times New Roman', serif; font-weight: normal; }
h1 { font-size: clamp(2.15rem, 5.2vw, 4.25rem); letter-spacing: -.045em; line-height: 1.02; }
.table-heading p { color: var(--muted); margin: 13px 0 23px; }
.aside { margin-top: 89px; min-width: 0; }
.panel { background: linear-gradient(150deg, #281d15, var(--panel)); border: 1px solid var(--line); border-radius: 17px; padding: 23px; box-shadow: 0 18px 30px #0003; }
.panel h2 { font-size: 1.85rem; margin-bottom: 21px; line-height: 1.15; }
fieldset { margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
legend, .field { font-weight: 650; font-size: .9rem; display: block; margin-bottom: 7px; }
.field span { color: var(--muted); font-weight: 400; margin-left: 4px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.modes label { position: relative; }
.modes input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.modes span { display: block; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 9px 5px; cursor: pointer; font-size: .9rem; }
.modes input:checked + span { border-color: var(--gold); color: var(--gold); background: #412a18; }
.modes input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
input[type=text], #code { width: 100%; min-width: 0; padding: 9px 10px; background: #17110e; border: 1px solid var(--line); border-radius: 8px; color: var(--text); min-height: 43px; }
input::placeholder { color: #b69b85; opacity: 1; }
.button { min-height: 43px; border: 1px solid transparent; border-radius: 8px; padding: 8px 13px; font-size: .91rem; font-weight: 680; }
.button:hover:not(:disabled) { filter: brightness(1.13); }
.button:disabled { opacity: .63; }
.primary { background: var(--gold); color: #291908; }
.secondary { background: #35251a; border-color: #765338; color: var(--text); }
.subtle { background: transparent; border-color: var(--line); color: var(--muted); }
.wide { width: 100%; }
#create > .button { margin-top: 11px; }
.join-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.divider { margin: 18px 0; border-top: 1px solid var(--line); }
.notice { color: #ffe0ad; padding: 9px 12px; margin-top: 10px; border: 1px solid #765338; border-radius: 8px; background: #2b1d13; overflow-wrap: anywhere; }
.board {
  --frame: clamp(7px, 1.25vw, 16px);
  --center: clamp(9px, 2.4vw, 32px);
  display: grid;
  grid-template: minmax(0, 1fr) minmax(0, 1fr) / repeat(6,minmax(0,1fr)) var(--center) repeat(6,minmax(0,1fr));
  position: relative;
  aspect-ratio: 1.52;
  padding: var(--frame);
  gap: 0;
  border-radius: 13px;
  isolation: isolate;
  background: linear-gradient(105deg, #693b22, #a56a42 42%, #4f2918 51%, #9a5c35 94%);
  border: 1px solid #ad784d;
  box-shadow: 0 17px 36px #0007, inset 0 0 0 3px #371b11bb, inset 0 0 0 5px #c0855377;
}
.board::before {
  content: "";
  position: absolute;
  inset: var(--frame);
  z-index: -1;
  background: repeating-linear-gradient(3deg, #94744a15 0 1px, transparent 2px 6px), linear-gradient(110deg, #d0a470, #e1ba86 49%, #c99763);
  border-radius: 3px;
  box-shadow: inset 0 0 13px #51270f99;
}
.point { position: relative; display: flex; align-items: center; flex-direction: column; border: 0; padding: 5px 0; margin: 0; color: #331e10; background: transparent; min-width: 0; min-height: 0; container-type: inline-size; }
.point:disabled { opacity: 1; }
.point::before { content: ""; pointer-events: none; position: absolute; inset: 3% 3% 12%; clip-path: polygon(0 0,100% 0,50% 100%); background: var(--triangle, #78412a); }
.point.light::before { --triangle: #e8c99e; }
.point.bottom { flex-direction: column-reverse; }
.point.bottom::before { inset: 12% 3% 3%; transform: rotate(180deg); }
.point.available { cursor: pointer; }
.point.available .checker:first-of-type { outline: 2px solid #ffe7a7; outline-offset: 1px; }
.point.target { box-shadow: inset 0 0 0 2px #4e3915; background: #ffe59a80; }
.point.selected { background: #fff2a689; box-shadow: inset 0 0 0 2px #654314; }
.point:focus-visible { z-index: 3; outline-offset: -2px; outline-color: #2f1c0c; }
.checker { position: relative; display: grid; place-items: center; flex-shrink: 0; width: 80%; max-width: 53px; aspect-ratio: 1; border-radius: 50%; border: 1px solid #724827; background: radial-gradient(circle at 34% 30%, #fff8df 10%, #f8deb4 53%, #c29a66 79%); color: #3d2616; box-shadow: inset 0 0 0 3px #8f633f42, 0 2px 3px #311b1699; font-size: clamp(.58rem, 31cqw, .95rem); font-weight: 800; }
.checker.dark { border-color: #29150e; color: #fff3e1; background: radial-gradient(circle at 35% 30%, #754a33, #482719 60%, #29160e 85%); box-shadow: inset 0 0 0 3px #e9af742c, 0 2px 3px #311b1699; }
.checker + .checker { margin-top: -1px; }
.bottom .checker + .checker { margin-top: 0; margin-bottom: -1px; }
.point-marker { position: absolute; bottom: 1%; font-size: clamp(.55rem, 21cqw, .76rem); color: #432814; font-weight: 700; }
.bottom .point-marker { bottom: auto; top: 1%; }
.rail { grid-area: 1 / 7 / 3 / 8; background: repeating-linear-gradient(88deg, #e9b47714 0 1px, transparent 2px 5px), linear-gradient(90deg, #3c1f13, #82502f 30%, #82502f 70%, #3c1f13); box-shadow: 0 0 3px #412713; }
.scoreline, .board-actions { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.scoreline { margin-bottom: 8px; flex-wrap: wrap; }
.board-actions { margin-top: 13px; flex-wrap: wrap; }
.player { display: flex; gap: 8px; align-items: center; min-width: 0; overflow-wrap: anywhere; font-size: .9rem; }
.player.active { color: var(--gold); font-weight: 700; }
.seat-dot { width: 13px; height: 13px; display: inline-block; flex: 0 0 auto; border-radius: 50%; background: #f4d8ac; border: 1px solid #c49760; }
.seat-dot.dark { background: #6f432c; }
.room-meta { color: var(--muted); margin-bottom: 6px; font-size: .875rem; }
#room-code { color: var(--gold); letter-spacing: .065em; white-space: nowrap; }
.status-title { font-weight: 750; margin-bottom: 5px; }
.status-note { color: var(--muted); font-size: .9rem; margin-bottom: 9px; }
.dice { display: flex; gap: 6px; margin: 11px 0; }
.die { display: grid; place-items: center; background: #f5e1bd; color: #3d2414; border-radius: 7px; width: 36px; height: 36px; font: 34px/1 system-ui, sans-serif; }
.die.used { opacity: .47; }
#game-state > .button { margin-top: 8px; }
.invite-input { margin-top: 8px; }
@media (max-width: 920px) { .shell { width: calc(100% - 36px); } .layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; } .panel { padding: 17px; } }
@media (max-width: 760px) {
  .shell { width: calc(100% - 26px); }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 19px; padding: 21px 0 32px; }
  .aside { margin-top: 0; }
  .header-inner { min-height: 54px; }
  .table-heading p { margin: 8px 0 14px; font-size: .9rem; }
  .board { border-radius: 8px; }
}
@media (max-width: 390px) { .scoreline, .board-actions { gap: 5px; } .board-actions .button { font-size: .84rem; padding: 5px 8px; } }
