/* Colors from the mobile app's theme.ts, so the two look like the same game. */
:root {
  --bg: #05241a;
  --felt: #0d6340;
  --felt-dark: #094a30;
  --line: #e9cf86;
  --text: #fbf6e6;
  --text-dim: #b9cdbf;
  --red: #c8102e;
  --win: #7ee08a;
  --lose: #ff8a80;
  --notice: #ffd166;
  --point: #f7c948;
  --win-number: #2196ff;
}

* { box-sizing: border-box; }

/* `hidden` must win over the display rules below (sections and spots set display: flex). */
[hidden] { display: none !important; }

/* Until the first table arrives, keep the page invisible (but laid out, so nothing jumps). */
.column.loading { visibility: hidden; }

/* Read by screen readers but not drawn on screen. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.4; }
button:focus-visible { outline: 3px solid var(--notice); outline-offset: 2px; }

/* A phone-width column, centered on bigger screens. */
.column {
  margin: 0 auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
/* Everything is one centered column, as wide as the main table (--table-width)... */
.column { --table-width: 400px; }
.column > :not(.toast, .visually-hidden, .table-row) { width: 100%; max-width: var(--table-width); }
/* ...except the table row, which holds the main table with Hardways to its left and Don't to
   its right (when they're switched on), centered as a group. Sections that don't fit wrap to
   the next line. */
.column > .table-row {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
}
.table-row > .felt { flex: 0 1 var(--table-width); min-width: 0; margin-top: 0; }
/* The table and its roll rail travel together, so the rail matches the table's height rather
   than the tallest section in the row. */
.table-row > .table-center { flex: 0 1 auto; min-width: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.table-center > .felt { flex: 0 1 var(--table-width); min-width: 0; }
/* The side sections (Lucky, Hardways, Horn, and Hop on the left; Don't and One-roll on the right) are
   narrower than the table. Each side stacks in a column, which takes no space when all of its
   sections are off. */
.table-row > .felt.section { flex-basis: 340px; }
.table-row > .side-col { flex: 0 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.side-col > .section { margin-top: 0; }
/* The Lucky bands have no border of their own beyond the felt sections', so keep them the same width. */
.side-col > .lucky-band { min-width: 0; }
.side-col:not(:has(> .section:not([hidden]))) { display: none; }
/* The left column (Hardways, Hop) comes after the table in the page, so narrow screens show the
   table first. Once it fits beside the table and the roll rail (340 + 400 + 48 + gaps + page padding = 832px),
   Hardways moves to the table's left. (Media queries can't read --table-width, so this
   number has to change with it.) */
@media (min-width: 832px) {
  .table-row > .side-col.left { order: -1; }
}

/* ---- Logo fonts: the mobile app's icon artwork (SIL Open Font License, see fonts/) ---- */
@font-face {
  font-family: "Fredoka";
  src: url("fonts/Fredoka.ttf") format("truetype");
  font-weight: 300 700;
  /* Wait briefly for the real font rather than drawing the logo in a fallback first. */
  font-display: block;
}
@font-face {
  font-family: "Pacifico";
  src: url("fonts/Pacifico-Regular.ttf") format("truetype");
  font-display: block;
}

/* ---- Money bar: money on the left, the logo in the middle, Menu on the right ---- */
.money-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.bar-start { display: flex; gap: 14px; }
.bar-end { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

/* The logo, as on the app icon: "Oh," in gold script, tilted, over a cream "CRAPS!" whose
   layered red edges make it look raised. */
.logo { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 1; user-select: none; }
.logo .oh {
  font-family: "Pacifico", cursive;
  font-size: 20px;
  color: #f7c948;
  /* Up and to the left of CRAPS!, just touching its C, as on the icon. */
  margin-bottom: -4px;
  transform: rotate(-12deg) translate(-38px, -2px);
  /* A dark brown outline, as on the icon. */
  text-shadow: -1px -1px 0 #3a2205, 1px -1px 0 #3a2205, -1px 1px 0 #3a2205, 1px 1px 0 #3a2205, 0 2px 3px #0008;
}
.logo .craps {
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 29px;
  letter-spacing: -0.5px;
  color: #fff3d6;
  text-shadow: 0 1px 0 #b80f2f, 0 2px 0 #b80f2f, 0 3px 0 #7a0a1b, 0 4px 6px #0009;
}
.money { display: flex; flex-direction: column; }
/* Playable is a button (it opens Reset) that looks like the plain Bet amount beside it. */
.money-btn {
  align-items: flex-start;
  background: none;
  border: none;
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: 8px;
  text-align: left;
}
.money-btn:hover:not(:disabled) { background: #ffffff14; }
.money-btn:disabled { opacity: 1; cursor: default; }   /* only mid-roll: don't dim the money */
.dialog-note { margin: 0 0 4px; color: var(--text-dim); font-size: 14px; }
.money-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.money-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.small-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
}

/* ---- Dice bubble ---- */
.dome-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
/* Both sides center their button on the bubble's middle, so More Bets and Bets On/Off line up. */
.dome-side { position: relative; display: flex; justify-content: center; align-items: center; }
/* A round glass bubble, as in the mobile app (DiceDome.tsx), 1.2 times its size. */
.dome {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(170, 215, 255, 0.16);
  border: 2px solid rgba(220, 240, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
/* The glint on the glass: a soft white oval near the top left, tilted. */
.shine {
  position: absolute;
  top: 13px;
  left: 24px;
  width: 43px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transform: rotate(-30deg);
  pointer-events: none;
}
/* The dice rest a little below the middle, as if sitting on the bottom of the bubble. */
.dice { display: flex; gap: 9px; transform: translateY(10px); }
/* Red dice with white pips, like the mobile app. */
.die {
  width: 34px;
  height: 34px;
  background: #c8102e;
  border: 1px solid #7a0019;
  border-radius: 18%;
  box-shadow: 0 2px 4px #0006;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 10%;
}
/* Whole-pixel sizes and a fixed 1:1 shape keep pips round at small sizes. */
.pip { width: 6px; height: 6px; aspect-ratio: 1; border-radius: 50%; background: #fff; place-self: center; }
.dice.rolling .die { animation: tumble 0.25s linear infinite; }
.dice.rolling .die:nth-child(2) { animation-direction: reverse; }
@keyframes tumble {
  0% { transform: rotate(0) translateY(0); }
  50% { transform: rotate(180deg) translateY(-6px); }
  100% { transform: rotate(360deg) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .dice.rolling .die { animation: none; opacity: 0.5; }
}

/* Bets On/Off: white means Place bets count on the next roll, black means they don't. */
.puck-btn {
  /* One line at a fixed height: if a browser's font is wider, the label can't wrap and make
     one button taller than the other (which would knock them out of line). */
  height: 36px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1.5px solid var(--line);
  /* The same width on both sides of the bubble, so the two buttons match. */
  width: 96px;
}
.puck-btn.on { background: #fff; color: #111; }
.puck-btn.off { background: #111; color: #fff; }

/* ---- Number bar ---- */
.number-bar {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 3px;
}
.number-bar li {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 0;
  border-radius: 5px;
  background: #ffffff10;
  color: var(--text-dim);
}
.number-bar li.win { background: var(--win-number); color: #fff; }

/* ---- Felt ---- */
.felt {
  background: var(--felt);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.spot {
  position: relative;
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  min-height: 64px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.spot:active:not(:disabled) { background: #ffffff18; }
/* Not usable yet (Odds before there's a point): the whole spot fades, as in the mobile app. */
.spot.dimmed { opacity: 0.55; }
/* Closed to new bets (Pass Line once there's a point), but its chip stays in full color. */
/* Closed to new bets (Pass Line once there's a point): gray, as in the mobile app. Its chip
   stays in full color. */
.spot.closed { border-color: #8a8a8a; background: rgba(60, 60, 60, 0.45); }
.spot.closed .label, .spot.closed .sublabel { color: #9a9a9a; }
.label { font-weight: 800; font-size: 15px; letter-spacing: 0.06em; }
.sublabel { font-size: 11px; color: var(--text-dim); }

/* Number boxes, as in the mobile app: a heavy 20px number, a thin border, 4px apart. A fixed
   height with room for a chip, so placing a bet never makes the row jump. */
.numbers-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.number { height: 68px; border-width: 1.5px; padding: 6px 4px; gap: 4px; }
.number .label { font-size: 20px; font-weight: 900; letter-spacing: 0.5px; }
/* The point's box turns solid yellow with a white border and dark number, as in the mobile app. */
.number.point { background: var(--point); border: 2px solid #fff; }
.number.point .label { color: #1b1b1b; }
/* The ON puck sits on the point's box. */
/* The box the last roll landed on fills blue (the winning-numbers blue) until the next roll,
   fading in quickly. On the point's box it's a blue ring instead, so the yellow still shows. */
.number { transition: background-color 150ms ease-out, box-shadow 150ms ease-out; }
.number.just-rolled { background: rgba(33, 150, 255, 0.75); }
.number.point.just-rolled { background: var(--point); box-shadow: inset 0 0 0 4px var(--win-number); }

/* ---- Field (as in the mobile app's FieldBox) ---- */
/* A fixed height, with room under the arc for a chip, so betting never makes the box grow. */
.spot.field { position: relative; height: 118px; justify-content: flex-start; padding-top: 8px; }
.field-row { display: flex; align-items: center; align-self: stretch; padding: 0 8px; margin-top: 2px; }
/* 2 and 12: red circles with a gold rim, bigger for the bigger payout (2x: 52px, 3x: 62px),
   raised into the space beside the FIELD title. */
.bonus {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid var(--line);
  transform: translateY(-10px);
}
.bonus.two { width: 52px; height: 52px; }
.bonus.twelve { width: 62px; height: 62px; }
.bonus-number { color: #fff; font-weight: 900; line-height: 1; transform: translateY(-2px); }
/* Big enough to fill most of the circle. */
.bonus.two .bonus-number { font-size: 28px; }
.bonus.twelve .bonus-number { font-size: 31px; letter-spacing: -1px; }
/* The payout tag hangs just below the circle, over its rim only. */
.bonus small {
  position: absolute;
  bottom: -11px;
  padding: 1px 8px;
  border-radius: 8px;
  background: var(--line);
  color: #1b1b1b;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}
/* The middle numbers on an arc: the center one highest, the ends dipping and tilting to
   follow the curve (--t is -1 at the left end, 0 in the middle, 1 at the right end). */
.field-arc { flex: 1; display: flex; justify-content: space-evenly; align-items: center; margin: 0 4px; }
.field-arc span {
  --lift: -16px;
  min-width: 24px;
  text-align: center;
  font-size: 23px;
  font-weight: 900;
  transform: translateY(calc(var(--lift) + 9px * var(--t) * var(--t))) rotate(calc(10deg * var(--t)));
}
/* The chip floats under the middle of the arc. */
.chip-slot.field-chip { position: absolute; left: 0; right: 0; bottom: 9px; display: flex; justify-content: center; pointer-events: none; }
.chip-slot.field-chip .chip { pointer-events: auto; }

/* Odds and the Pass Line, as in the mobile app: Odds narrower (1.3 to 3) on darker felt. */
.pass-row { display: grid; grid-template-columns: 1.3fr 3fr; gap: 6px; }
.pass-row .spot { min-height: 48px; padding: 6px 4px; gap: 2px; }
.pass-row .label { font-size: 14px; letter-spacing: 1px; }
.pass-row .sublabel { font-size: 10px; }
.spot.odds { background: var(--felt-dark); }

/* ---- Chips ---- */
.chip-slot:empty { display: none; }
/* Chips, as in the mobile app (Chip.tsx): a dashed light edge, the amount at 32% of the chip's
   size, and a soft shadow. Each chip's color is set by app.js. */
.chip {
  --size: 34px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: calc(var(--size) * 0.32);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  border: 2px dashed #ffffffcc;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  font-variant-numeric: tabular-nums;
}
/* The white $1 chip gets a blue edge and dark text so it shows on the felt. */
.chip.light { color: #1b1b1b; border-color: #3949ab; }
/* Off: a bet that isn't working this roll, or a rack chip you can't afford. Solid gray, which
   has to win over the chip's own color (set on the element by app.js). */
.chip.off {
  background: #6b6b6b !important;
  border-color: #a8a8a8;
  color: #d6d6d6;
  opacity: 0.7;
  box-shadow: none;
}
.number .chip { --size: 26px; }

/* ---- Controls ---- */
.controls { display: flex; flex-direction: column; gap: 10px; }
/* ---- Roll strip, as in the mobile app (RollHistory.tsx) ---- */
.roll-bar {
  display: flex;
  align-items: center;
  height: 46px;
  padding-left: 6px;
  border-radius: 8px;
  background: #ffffff10;
  border: 1px solid #ffffff22;
  overflow: hidden;
}
.roll-bar-title { flex: none; margin-right: 4px; color: var(--text-dim); font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.roll-bar-empty { display: none; }

/* Narrow screens: a strip above the table, full width, hidden until the first roll. */
.table-center > .roll-bar { order: -2; flex: 0 1 var(--table-width); }
.table-center > .roll-bar.empty { display: none; }

/* Wide screens: a rail along the table's right edge, as tall as the table, newest roll on top.
   It's always there (saying "No rolls yet" at first), so the table doesn't shift when the
   first roll arrives, and it adds no height to the page. */
@media (min-width: 536px) {
  .table-center > .roll-bar,
  .table-center > .roll-bar.empty {
    order: 0;
    flex: 0 0 48px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: stretch;
    height: auto;
    padding: 8px 0 0;
  }
  .table-center > .roll-bar .roll-bar-title { margin: 0 0 6px; }
  /* The list is positioned out of the flow, so 100 rolls scroll inside the rail rather than
     making the rail (and the table row) taller. */
  .table-center > .roll-bar .history {
    position: absolute;
    top: 24px;
    bottom: 4px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .table-center > .roll-bar.empty .roll-bar-empty {
    display: block;
    writing-mode: vertical-rl;
    color: var(--text-dim);
    font-size: 11px;
    font-style: italic;
  }
  /* With nothing on the table's left, shift the row so the table itself stays centered under
     the dice, with the rail beside it. */
  .table-row:not(:has(.section:not([hidden]))) { padding-left: 58px; }
}
.history {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;   /* scrolls by swipe, wheel, or trackpad, without a scroll bar */
}
.history::-webkit-scrollbar { display: none; }
/* One roll: the total in bold over the dice in small type. */
.history li {
  flex: none;
  width: 34px;
  height: 38px;
  border-radius: 5px;
  background: #ffffff14;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.roll-total { font-size: 15px; font-weight: 900; line-height: 17px; }
.roll-dice { font-size: 9px; font-weight: 700; line-height: 11px; color: var(--text-dim); }
.history li.newest { border-color: var(--line); }
.history li.seven { background: var(--red); }
.history li.seven .roll-dice { color: #fff; }
.history li.point { background: var(--point); }
.history li.point .roll-total, .history li.point .roll-dice { color: #1b1b1b; }

.chip-rack { display: flex; justify-content: space-between; gap: 4px; }
/* The chip rack, as in the mobile app: the chosen chip gets a gold ring and grows a little. */
.rack-chip {
  background: none;
  border: 2px solid transparent;
  border-radius: 50%;
  padding: 2px;
  transition: transform 120ms ease-out, border-color 120ms ease-out;
}
.rack-chip .chip { --size: 34px; }
.rack-chip[aria-checked="true"] { border-color: var(--line); transform: scale(1.08); }
/* A chip you can't afford stays gray, but don't fade the whole button on top of that. */
.rack-chip:disabled { opacity: 1; }

.actions { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 8px; }
/* Buttons have a thin 1.5px border (the mobile app's width for its spots). */
.side-btn, .roll-btn {
  border-radius: 10px;
  padding: 14px 8px;
  font-weight: 700;
  border: 1.5px solid var(--line);
}
.side-btn { background: var(--felt-dark); }
.roll-btn { background: var(--red); font-size: 20px; letter-spacing: 0.1em; border-color: #fff; }
.actions.out-of-money { grid-template-columns: 1fr; }
/* The three buttons under the chips are compact, so the pinned bottom area stays short.
   (Dialog buttons share these classes but keep their size.) */
.actions .side-btn, .actions .roll-btn { padding: 7px 8px; font-size: 15px; }
.actions .roll-btn { font-size: 17px; }


/* ---- Wins, losses, and messages ---- */
/* Floats just under More Bets, so a win or loss appearing doesn't push the button up. */
.win-overlay {
  position: absolute;
  top: calc(50% + 21px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}
.win-amount {
  /* Small enough that a win and a loss stacked together still clear the number bar. */
  font-size: 20px;
  line-height: 1.1;
  font-weight: 900;
  text-shadow: 0 2px 6px #000;
  animation: float-up 1.8s ease-out forwards;
}
.win-amount.win { color: var(--win); }
.win-amount.loss { color: var(--lose); }
@keyframes float-up {
  0% { opacity: 0; transform: translateY(10px); }
  15% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-24px); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(440px, 92vw);
  background: #111;
  border: 1px solid var(--notice);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 4px 16px #000a;
  font-size: 14px;
}

dialog {
  background: var(--felt-dark);
  color: var(--text);
  border: 2px solid var(--line);
  border-radius: 14px;
  max-width: 360px;
}
dialog::backdrop { background: #000a; }
dialog h2 { margin-top: 0; }
dialog label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
dialog input { font: inherit; font-size: 18px; padding: 8px; border-radius: 8px; border: 1px solid var(--line); }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
/* Dialog buttons (Done, Start, Cancel) are shorter than the table's Roll button. */
dialog menu .roll-btn, dialog menu .side-btn { padding: 7px 18px; font-size: 16px; }
/* Pages opened from the Menu go back to it with a plain text link, as in the mobile app. */
dialog menu.back-menu { justify-content: center; }
.back-link {
  background: none;
  border: none;
  padding: 8px 16px;
  color: var(--line);
  font-size: 17px;
  font-weight: 800;
}
.back-link:hover { opacity: 0.7; }

/* ---- More Bets ---- */
.more-bets { background: #ffffff14; color: var(--text-dim); border-color: #ffffff40; }
.more-bets.on { background: var(--notice); color: #111; border-color: var(--notice); }

.section { margin-top: 2px; }
.section-title { margin: 0; font-size: 13px; letter-spacing: 0.1em; text-align: center; color: var(--line); }
.section-note { margin: 0; font-size: 12px; color: var(--text-dim); text-align: center; }
.numbers-row.small .number { height: 56px; }
.numbers-row.small .label { font-size: 16px; }
.numbers-row.small .chip { --size: 26px; }

.switches { display: flex; flex-direction: column; gap: 12px; }
.switch { display: flex; flex-direction: row; gap: 10px; align-items: flex-start; cursor: pointer; }
/* Drawn by hand: the browser's unchecked box is nearly invisible on the dark felt. */
.switch input {
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.switch input:checked {
  border-color: var(--notice);
  background: var(--notice) center / 14px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 8.5l4 4 8-9' fill='none' stroke='%23111' stroke-width='2.6'/%3E%3C/svg%3E");
}
.switch input:focus-visible { outline: 3px solid var(--notice); outline-offset: 2px; }
.switch span { display: flex; flex-direction: column; gap: 2px; }
.switch small { color: var(--text-dim); }

/* Keep the chips and Roll button in reach while the extra sections scroll by. */
.controls {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 0 0 4px;
  box-shadow: 0 -8px 12px var(--bg);
}
.sublabel:empty { display: none; }

/* ---- Advanced table ---- */
.number-column { display: flex; flex-direction: column; gap: 4px; }
/* Grow into spare room if there is any, but never below the box's own fixed height. */
.number-column .number { flex: 1 0 auto; }
.strip { min-height: 34px; padding: 3px 2px; gap: 2px; }
.strip .label { font-size: 10px; letter-spacing: 0.08em; }
.strip .chip { --size: 22px; }
/* A strip with a chip on it shows just the chip. */
.strip:has(.chip) .label { display: none; }
.come { min-height: 44px; }
.come-badge { position: absolute; left: 3px; bottom: 3px; }
.come-badge .chip { --size: 22px; }
.come-badge .chip::after {
  content: "C";
  position: absolute;
  margin: -16px 0 0 18px;
  font-size: 9px;
  background: #fff;
  color: #111;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  display: grid;
  place-items: center;
}

/* ---- Prop sections (Hardways, Horn, Hop, one-roll) ---- */
.prop-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.prop { min-height: 70px; gap: 3px; }
.prop .label { font-size: 13px; letter-spacing: 0; }
.prop .chip { --size: 26px; }
.dice-pair { display: flex; gap: 3px; }
.die.mini { width: 20px; height: 20px; padding: 2px; box-shadow: none; }
.die.mini .pip { width: 4px; height: 4px; }
.prop-row.two { grid-template-columns: 1fr 1fr; }
.any7 .label { color: var(--lose); }
.hops { display: flex; flex-direction: column; gap: 5px; }
.hop-row { display: grid; grid-template-columns: 22px repeat(3, 1fr); gap: 5px; align-items: stretch; }
.hop-total { align-self: center; text-align: center; font-weight: 800; color: var(--line); }
.prop.hop { min-height: 0; height: 36px; padding: 4px; flex-direction: row; gap: 6px; }

/* ---- Lucky Roller and Lucky Shooter: deep purple with gold ----
   A high-contrast scheme (all text 7:1 or better) that stands apart from the green felt, the red
   dice, and the blue highlight. Purple is the $500 chip's family; gold matches the table's lines
   and the point. Unlit numbers are quiet translucent purple; rolled ones turn solid gold. */
.lucky-band {
  --lucky-band: #241645;
  --lucky-card: #33215e;
  --lucky-gold: #ffd166;      /* titles, card names, the band's edge */
  --lucky-lit: #f7c948;       /* a rolled number, a reached payout */
  --lucky-cream: #fff3d6;     /* payouts */
  --lucky-dim: #d9ccff;       /* unlit numbers and labels */
  --lucky-line: #ffffff33;    /* unlit edges */
  --lucky-unlit: #ffffff14;   /* unlit fill */
  background: var(--lucky-band);
  border: 2px solid var(--lucky-gold);
  border-radius: 14px;
  box-shadow: 0 0 14px #7c4dff55;
  padding: 6px 6px 8px;
  display: flex;
  flex-direction: column;
  /* Room above each row of cards for the chips on their corners. */
  gap: 10px;
  color: var(--lucky-cream);
}
/* Titles: "★ LUCKY ROLLER ★", heavy and letter-spaced, in gold. */
.lucky-title { margin: 0; color: var(--lucky-gold); font-size: 12px; font-weight: 900; letter-spacing: 2px; text-align: center; }

/* Lucky Roller cards: a bold name and payout, and for SMALL and TALL their numbers as circles. */
.lucky-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 6px; }
.lucky-card {
  position: relative;
  min-height: 0;
  background: var(--lucky-card);
  border: 1.5px solid var(--lucky-line);
  border-radius: 10px;
  padding: 6px;
  gap: 6px;
  color: var(--lucky-gold);
}
.lucky-card.all { grid-column: span 2; padding: 7px 6px; }
.lucky-card .label { font-size: 12px; font-weight: 900; letter-spacing: 1px; color: var(--lucky-gold); }
.lucky-pays { color: var(--lucky-cream); font-weight: 800; letter-spacing: 0.5px; }
/* A chip sits on the card's corner, so betting doesn't change the band's size. */
.lucky-card .chip-slot { position: absolute; top: -10px; right: -4px; z-index: 1; }
.lucky-card .chip { --size: 22px; }

.lucky-circles { display: flex; justify-content: space-between; align-self: stretch; }
.lucky-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--lucky-line);
  background: var(--lucky-unlit);
  color: var(--lucky-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
/* Rolled (or, for Lucky Shooter, made): solid gold with a glow. */
.lucky-circle.hit { background: var(--lucky-lit); border-color: var(--lucky-cream); color: #1b1b1b; box-shadow: 0 0 8px #f7c94899; }

/* Lucky Shooter: the whole band is the betting spot. */
.shooter-band { padding: 0; }
.shooter-spot {
  min-height: 0;
  border: none;
  background: transparent;
  align-items: stretch;
  gap: 8px;
  padding: 7px 10px 9px;
  color: var(--lucky-cream);
}
.shooter-spot:active:not(:disabled) { background: #ffffff10; }
.shooter-circles .lucky-circle { width: 34px; height: 34px; font-size: 13px; }
/* The point being worked on now, not made yet: a gold outline. */
.shooter-circles .lucky-circle.current { border: 2.5px solid var(--lucky-gold); background: #ffffff1f; color: var(--lucky-gold); }
.shooter-steps { display: flex; gap: 6px; }
.shooter-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 4px;
  border-radius: 6px;
  border: 1.5px solid var(--lucky-line);
  background: var(--lucky-unlit);
}
.step-pts { color: var(--lucky-dim); font-size: 10px; font-weight: 800; letter-spacing: 0.5px; }
.step-pays { color: var(--lucky-cream); font-size: 12px; font-weight: 900; }
.shooter-step.reached { background: var(--lucky-lit); border-color: var(--lucky-cream); box-shadow: 0 0 8px #f7c94899; }
.shooter-step.reached .step-pts, .shooter-step.reached .step-pays { color: #1b1b1b; }
.shooter-spot .chip-slot { position: absolute; top: 4px; right: 6px; z-index: 1; }
.shooter-spot .chip { --size: 22px; }
/* Faded while it can't be bet (a point is on and there's no bet), but still readable. */
.shooter-band.closed { opacity: 0.55; }

/* ---- Crapless ---- */
.numbers-row.crapless { grid-template-columns: repeat(5, 1fr); }
.tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--point);
  color: #111;
}
.switch.unavailable { opacity: 0.45; cursor: default; }
/* Either/or sections (Lucky Roller or Lucky Shooter): radio buttons with a None choice. */
.radio-group {
  margin: 0;
  padding: 8px 10px 10px;
  border: 1px solid #ffffff30;
  border-radius: 10px;
  background: #ffffff0a;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.radio-group legend { padding: 0 4px; font-weight: 700; }
.radio-group legend small { color: var(--text-dim); font-weight: 400; }
dialog .radio-group .switch { margin-top: 0; }
.switch.radio input { border-radius: 50%; }
.switch.radio input:checked {
  border-color: var(--notice);
  background: radial-gradient(circle, var(--notice) 0 5px, transparent 5.5px);
}
dialog .switch { margin-top: 12px; }

/* ---- Menu, History, How to Play ---- */
.menu-list { display: flex; flex-direction: column; gap: 8px; min-width: 260px; }
.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ffffff30;
  background: #ffffff10;
}
.menu-item small { color: var(--text-dim); }
.menu-item:hover { background: #ffffff1c; }

.page-dialog { width: min(440px, 94vw); max-height: 88vh; }
.page-dialog form { display: flex; flex-direction: column; gap: 12px; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tabs button { background: transparent; border: none; padding: 8px; font-weight: 700; }
.tabs button[aria-selected="true"] { background: var(--line); color: #111; }

.history-body { display: flex; flex-direction: column; gap: 10px; }
.summary { margin: 0; color: var(--text-dim); font-size: 12px; text-align: center; }
.empty { margin: 0; color: var(--text-dim); font-size: 12px; text-align: center; }

/* Totals: eleven columns, bars growing up from a shared baseline. */
.totals-chart { display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px; align-items: end; height: 170px; }
.totals-chart .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 100%; }
.totals-chart .count { font-size: 10px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.totals-chart .bar { width: 80%; background: var(--line); border-radius: 3px 3px 0 0; }
.totals-chart .seven .bar { background: var(--red); }
.totals-chart .total { font-size: 12px; font-weight: 800; background: #ffffff14; border-radius: 4px; width: 100%; text-align: center; padding: 2px 0; }

/* Pairs: a sideways bar per pair, grouped by total. Doubles are yellow. */
.pairs-chart { display: flex; flex-direction: column; gap: 6px; }
.pair-group { display: flex; flex-direction: column; gap: 2px; }
.pair-row { display: grid; grid-template-columns: 26px 48px 1fr 32px; gap: 6px; align-items: center; font-size: 12px; }
.pair-row .total { font-weight: 800; text-align: center; background: #ffffff14; border-radius: 4px; }
.pair-row .dice-pair { justify-content: center; }
.pair-row .track { height: 10px; background: #ffffff10; border-radius: 5px; overflow: hidden; }
.pair-row .bar { height: 100%; background: var(--line); }
.pair-row.double .bar { background: var(--point); }
.pair-row .count { text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.money-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.money-table th { font-size: 11px; color: var(--text-dim); letter-spacing: 0.08em; text-align: right; padding: 4px 6px; }
.money-table td { text-align: right; padding: 6px; border-top: 1px solid #ffffff14; }
.money-table tr.current td { font-weight: 700; }
.money-table .up { color: var(--win); }
.money-table .down { color: var(--lose); }
.money-table .c { color: var(--point); font-size: 11px; font-weight: 800; }
.link-btn { align-self: center; background: none; border: none; color: var(--lose); text-decoration: underline; padding: 6px; }

.how-to-play { display: flex; flex-direction: column; gap: 6px; }
.how-to-play details { border: 1px solid #ffffff26; border-radius: 10px; padding: 8px 12px; background: #ffffff08; }
.how-to-play summary { cursor: pointer; font-weight: 800; color: var(--line); }
.how-to-play p { margin: 8px 0 0; font-size: 14px; line-height: 1.45; }
.how-to-play .more { font-size: 11px; color: var(--text-dim); font-weight: 400; margin-left: 6px; }

/* ---- Drag and drop ---- */
/* Chips that can be dragged mustn't scroll the page when a finger moves on them. */
.rack-chip, .spot .chip-slot .chip { touch-action: none; cursor: grab; }
.drag-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 6px 14px #000a;
  --size: 40px;
}
body.dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.spot.drop-target { box-shadow: inset 0 0 0 3px var(--notice); background: #ffd16622; }

/* Hardways, Horn, and Hop boxes are compact, fixed-height boxes, so a chip on one sits as a small
   badge on its corner instead of making the box taller or wider. */
:is([data-section="Hardways"], [data-section="Horn"]) .prop { min-height: 0; height: 46px; padding: 4px; gap: 2px; }
.prop.hop, :is([data-section="Hardways"], [data-section="Horn"]) .prop { position: relative; }
.prop.hop .chip-slot, :is([data-section="Hardways"], [data-section="Horn"]) .prop .chip-slot { position: absolute; top: -12px; right: -10px; z-index: 1; }
.prop.hop .chip, :is([data-section="Hardways"], [data-section="Horn"]) .prop .chip { --size: 22px; }
