/* Felt, paper dice, and score rows adapted from the Apache-2.0 table
   front end described in vendor/dice-rules-engine/NOTICE. The remote
   suit font is not used. Layout below is built for a phone. */

:root {
  --felt: #1f5c49;
  --felt-deep: #174838;
  --card: #f7f3e8;
  --ink: #1c1915;
  --gold: #e2b33c;
  --muted: rgba(247, 243, 232, 0.72);
  --die: clamp(3.25rem, 17vw, 4.4rem);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font: 16px/1.45 "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  color: #f4efe4;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.05), transparent 28rem),
    var(--felt);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

header, footer, main { width: min(40rem, 100%); margin: 0 auto; }

header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.8rem + env(safe-area-inset-top)) 1rem 0.4rem;
}

.eyebrow {
  margin: 0;
  font-family: system-ui, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

h1 { margin: 0; font-size: 1.7rem; font-weight: 650; letter-spacing: -0.02em; }

.chip {
  margin: 0;
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(226, 179, 60, 0.7);
  color: var(--gold);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  white-space: nowrap;
}

main { flex: 1; padding: 0.4rem 1rem 1.2rem; }

footer {
  padding: 0.4rem 1rem calc(0.8rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
}

footer p { margin: 0; }

.panel, .scorecard, .results {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  padding: 0.9rem;
}

.panel h2, .results h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }

.lede { margin: 0 0 0.9rem; color: var(--muted); }

form { display: grid; gap: 0.75rem; }

label { display: grid; gap: 0.3rem; font-family: system-ui, sans-serif; font-size: 0.85rem; }

input, select, button { font: inherit; }

input, select {
  font-family: system-ui, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--card);
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
}

.stepper { display: flex; align-items: center; gap: 0.5rem; }
.stepper strong { min-width: 1.2rem; text-align: center; font-size: 1.2rem; }

button {
  border: 0;
  border-radius: 10px;
  background: var(--gold);
  color: #2a220c;
  padding: 0.75rem 0.9rem;
  font-family: system-ui, sans-serif;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

button.quiet, button.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

button:disabled { opacity: 0.45; cursor: default; }
button:active:not(:disabled) { transform: translateY(1px); }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.choice button[aria-pressed="true"] { outline: 2px solid var(--gold); background: rgba(226, 179, 60, 0.2); color: var(--card); }

.alert {
  background: #6e2b2b;
  color: #fff8f4;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin: 0 0 0.7rem;
}

.share {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.share code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
  font-size: 0.8rem;
}

.seats { list-style: none; margin: 0.8rem 0 0; padding: 0; display: grid; gap: 0.35rem; }
.seats li {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.play { display: grid; gap: 0.85rem; }

.dice {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  min-height: calc(var(--die) + 0.8rem);
  padding: 0.35rem 0 0.2rem;
}

.die {
  width: var(--die);
  height: var(--die);
  background: var(--card);
  color: var(--ink);
  border: 0;
  border-radius: 0.7rem;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 0.42rem;
  flex: none;
}

button.die {
  padding: 0.42rem;
  color: var(--ink);
  font-weight: 500;
}
.die > span {
  display: flex;
  align-items: center;
  justify-content: center;
}
.die .pip {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ink);
}

button.die { cursor: pointer; }
button.die.held {
  outline: 3px solid var(--gold);
  transform: translateY(0.35rem);
  box-shadow: none;
}
.die.slot {
  background: transparent;
  border: 2px dashed rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.dice.tumbling .die:not(.held):not(.slot) {
  animation: tumble 0.42s linear infinite;
}

@keyframes tumble {
  0% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-12px) rotate(7deg); }
  100% { transform: translateY(0) rotate(-8deg); }
}

@media (prefers-reduced-motion: reduce) {
  .dice.tumbling .die { animation: none; }
}

.rollbar {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 0.35rem;
  padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom));
  background: var(--felt);
}
.rollbar .meta {
  display: flex;
  justify-content: space-between;
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
}
.rollbar button { font-size: 1.05rem; }

.who { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.2rem; }
.who button { white-space: nowrap; padding: 0.45rem 0.7rem; }
.who button.on { background: var(--card); color: var(--ink); }

.scorecard { padding: 0.55rem 0.45rem 0.7rem; }
.cardname {
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0.2rem 0.55rem 0.35rem;
}
.srow {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
  min-height: 44px;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.srow .hint { display: block; color: var(--muted); font-family: system-ui, sans-serif; font-size: 0.72rem; }
.srow .pot { opacity: 0.6; }
.srow .val { font-weight: 700; }
button.srow {
  width: 100%;
  background: transparent;
  color: inherit;
  font-weight: 500;
  text-align: left;
  border-radius: 8px;
}
button.srow:hover, button.srow:focus-visible { background: rgba(226, 179, 60, 0.22); }
.srow.rule {
  min-height: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 0.25rem;
  padding-top: 0.45rem;
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
}
.srow.grand { color: #fff; font-size: 1.05rem; font-weight: 700; }

.showcase {
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
  color: var(--muted);
}

.results {
  background: var(--card);
  color: var(--ink);
}
.results ol { list-style: none; margin: 0.6rem 0; padding: 0; display: grid; gap: 0.45rem; }
.results li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid rgba(28, 25, 21, 0.12);
}
.results .place {
  font-family: system-ui, sans-serif;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--felt);
  color: var(--card);
  font-size: 0.8rem;
}
.results .pts { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.25rem; }
.results .sub { display: block; font-family: system-ui, sans-serif; font-size: 0.75rem; color: #5c564c; }
.results .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.results .actions button.ghost { color: var(--ink); border-color: rgba(28, 25, 21, 0.3); }

.log { margin-top: 0.4rem; }
.log summary { cursor: pointer; font-family: system-ui, sans-serif; color: var(--muted); }
.log div { padding: 0.15rem 0; font-size: 0.88rem; }

.rules { margin-top: 0.8rem; color: var(--muted); font-size: 0.92rem; }
.rules summary { cursor: pointer; }

@media (min-width: 52rem) {
  .play { grid-template-columns: 18rem 1fr; align-items: start; }
  .rollbar { position: static; background: transparent; }
  .who, .scorecard, .showcase { grid-column: 1; }
  .dice, .rollbar { grid-column: 2; }
}
