:root {
  --felt: #0f5c47;
  --felt-deep: #08382b;
  --felt-light: #1a7a5f;
  --ink: #1d1410;
  --paper: #f6ecd4;
  --paper-shade: #e7d7ae;
  --text: #f6ecd4;
  --text-muted: #6d5a41;
  --red: #d8402f;
  --gold: #f2b632;
  --error: #a3200f;
  --display: Rockwell, 'Roboto Slab', 'Courier New', Georgia, serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  color: var(--text);
  font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  font-size: 17px;
}

body {
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    repeating-linear-gradient(
      45deg,
      rgb(255 255 255 / 3%) 0 2px,
      transparent 2px 7px
    ),
    radial-gradient(
      ellipse at 50% 30%,
      var(--felt-light),
      var(--felt) 45%,
      var(--felt-deep)
    );
  background-attachment: fixed;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 3px dashed rgb(246 236 212 / 35%);
}

header .muted {
  color: var(--paper-shade);
  font-style: italic;
}

h1,
h2 {
  margin: 0;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  font-size: 1.5rem;
  text-shadow: 3px 3px 0 var(--ink);
}

h2 {
  font-size: 1.15rem;
}

.panel {
  width: min(440px, 100% - 32px);
  margin: 48px auto;
  padding: 28px 24px;
  color: var(--ink);
  background:
    linear-gradient(rgb(255 255 255 / 35%), transparent 40%),
    var(--paper);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow:
    8px 8px 0 var(--ink),
    inset 0 0 0 6px var(--paper),
    inset 0 0 0 8px var(--red);
  rotate: -0.6deg;
  position: relative;
  display: grid;
  gap: 16px;
  align-content: start;
}

.menu {
  position: absolute;
  top: 16px;
  right: 16px;
}

.menu summary {
  list-style: none;
  min-width: 40px;
  padding: 2px 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-shade);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  cursor: pointer;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu-items {
  position: absolute;
  z-index: 1;
  top: 34px;
  right: 0;
  width: max-content;
  max-width: 240px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--ink);
}

.menu-items button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.75rem;
  box-shadow: 0 3px 0 var(--ink);
}

.panel h1 {
  color: var(--red);
  text-shadow: 2px 2px 0 var(--gold);
}

.panel form {
  display: grid;
  gap: 10px;
}

.starters {
  width: 100%;
  display: grid;
  gap: 20px;
}

#quick {
  min-height: 54px;
  font-size: 1.05rem;
}

.group {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 2px dashed rgb(29 20 16 / 30%);
}

.group:has(ul:empty) {
  display: none;
}

.group h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.group li:first-child {
  border-top: 0;
  padding-top: 0;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pair button {
  padding: 0 8px;
  font-size: 0.8rem;
}

.inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.inline label {
  font-family: inherit;
  font-size: 0.85rem;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  text-align: left;
}

.inline input {
  min-width: 0;
  flex: 1;
}

#tip {
  flex: 0 0 84px;
}

#code {
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.center {
  text-align: center;
  justify-items: center;
}

.muted {
  color: var(--text-muted);
  font-style: italic;
}

.error {
  color: var(--error);
  font-weight: 700;
}

p {
  margin: 0;
}

#activity {
  padding: 8px 22px;
  color: var(--paper-shade);
  text-align: center;
}

label {
  font-family: var(--display);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input {
  min-height: 44px;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  border-radius: 4px;
  background: #fffaf0;
  color: var(--ink);
  font: inherit;
  box-shadow: inset 3px 3px 0 rgb(29 20 16 / 12%);
}

button {
  min-height: 46px;
  padding: 0 22px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--red);
  color: var(--paper);
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
  transition:
    translate 80ms ease-out,
    box-shadow 80ms ease-out;
}

button small {
  display: block;
  font-family: Georgia, serif;
  font-size: 0.8em;
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.pair button {
  min-height: 58px;
}

button.quiet {
  background: var(--paper-shade);
  color: var(--ink);
}

[data-el='rematch'],
[data-el='roll'] {
  background: var(--gold);
  color: var(--ink);
}

header button.quiet {
  min-height: 38px;
  padding: 0 16px;
  font-size: 0.8rem;
}

button:hover,
button:focus-visible {
  translate: 0 -2px;
  box-shadow: 0 7px 0 var(--ink);
}

button:active {
  translate: 0 4px;
  box-shadow: 0 1px 0 var(--ink);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  translate: 0 4px;
  box-shadow: 0 1px 0 var(--ink);
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

ul {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 2px dashed rgb(29 20 16 / 30%);
  text-align: left;
}

li button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.75rem;
  box-shadow: 0 3px 0 var(--ink);
}

.dice {
  display: flex;
  gap: 32px;
  justify-content: center;
}

.dice div {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.dice .muted {
  font-family: var(--display);
  font-size: 0.75rem;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.absent {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.seat {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
}

.seat[data-left] {
  color: var(--error);
  font-weight: 700;
}

.dice strong {
  display: flex;
  gap: 10px;
}

.die {
  width: 58px;
  height: 58px;
  padding: 8px;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  place-items: center;
  background: linear-gradient(135deg, #fffdf6, #efe2c2);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  animation: tumble 320ms ease-out;
}

.die:nth-child(odd) {
  rotate: -5deg;
}

.die:nth-child(even) {
  rotate: 4deg;
}

.die:empty {
  background: transparent;
  border-style: dashed;
  box-shadow: none;
  animation: none;
}

.die i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
}

.die[data-value='1'] i {
  width: 14px;
  height: 14px;
  background: var(--red);
  grid-area: 2 / 2;
}

.die[data-value='2'] i:nth-child(1),
.die[data-value='3'] i:nth-child(1),
.die[data-value='4'] i:nth-child(1),
.die[data-value='5'] i:nth-child(1),
.die[data-value='6'] i:nth-child(1) {
  grid-area: 1 / 1;
}

.die[data-value='2'] i:nth-child(2),
.die[data-value='3'] i:nth-child(3),
.die[data-value='4'] i:nth-child(4),
.die[data-value='5'] i:nth-child(4),
.die[data-value='6'] i:nth-child(6) {
  grid-area: 3 / 3;
}

.die[data-value='3'] i:nth-child(2),
.die[data-value='5'] i:nth-child(5) {
  grid-area: 2 / 2;
}

.die[data-value='4'] i:nth-child(2),
.die[data-value='5'] i:nth-child(2),
.die[data-value='6'] i:nth-child(2) {
  grid-area: 1 / 3;
}

.die[data-value='4'] i:nth-child(3),
.die[data-value='5'] i:nth-child(3),
.die[data-value='6'] i:nth-child(5) {
  grid-area: 3 / 1;
}

.die[data-value='6'] i:nth-child(3) {
  grid-area: 2 / 1;
}

.die[data-value='6'] i:nth-child(4) {
  grid-area: 2 / 3;
}

@keyframes tumble {
  from {
    rotate: -160deg;
    scale: 0.4;
    opacity: 0;
  }
}

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

  button {
    transition: none;
  }
}

[hidden] {
  display: none !important;
}
