@font-face {
  font-family: "Press Start 2P";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/press-start-2p-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --ink: #1b1b1b;
  --paper: #d7d7d7;
  --stone: #8d8d8d;
  --stone-hi: #ffffff;
  --stone-mid: #c6c6c6;
  --stone-shade: #555555;
  --stone-low: #373737;
  --dirt: #6b4423;
}

* { box-sizing: border-box; }

html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--paper);
  font-family: "Press Start 2P", monospace;
  line-height: 1.6;
  background-color: var(--dirt);
  background-image:
    linear-gradient(#5a381c 50%, transparent 50%),
    linear-gradient(90deg, #7a4f2a 50%, #5a381c 50%);
  background-size: 16px 16px;
  background-position: 0 0, 0 0;
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
}

button, input { font: inherit; }

button, input, .code { border-radius: 0; }

.panel {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 16px 14px 18px;
  background: #6f6f6f;
  color: var(--ink);
  box-shadow:
    inset 4px 4px 0 #cfcfcf,
    inset -4px -4px 0 #2c2c2c,
    inset 8px 8px 0 #9a9a9a,
    inset -8px -8px 0 #4a4a4a;
}

h1, h2, p { margin: 0; }

h1 {
  text-align: center;
  font-size: 22px;
  line-height: 1.4;
  color: #f7f7f7;
  text-shadow: 4px 4px 0 #3a2912;
}

h2 {
  margin-top: 14px;
  font-size: 12px;
  color: #f0f0f0;
  text-shadow: 2px 2px 0 #2a2a2a;
}

.tag, .split, .label, .round, .hint, .roster {
  font-size: 10px;
  line-height: 1.7;
}

.tag {
  margin: 8px 0 14px;
  text-align: center;
  color: #efe6c8;
  text-shadow: 2px 2px 0 #3a2912;
}

.split {
  margin: 16px 0 10px;
  text-align: center;
  color: #efe6c8;
  text-shadow: 2px 2px 0 #3a2912;
}

.label {
  display: block;
  margin: 12px 0 6px;
  color: #f4f4f4;
  text-shadow: 2px 2px 0 #2a2a2a;
}

.code {
  margin: 0;
  color: #fff8dc;
  font-size: 22px;
  letter-spacing: 0.18em;
  text-shadow: 3px 3px 0 #3a2912;
  user-select: text;
}

.code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.roster, .round, .hint {
  margin-top: 8px;
  color: #efe6c8;
  text-shadow: 2px 2px 0 #2a2114;
  word-break: break-word;
}

.hint { min-height: 1.7em; }

input {
  display: block;
  width: 100%;
  margin: 0 0 4px;
  padding: 12px;
  font-size: 16px;
  color: #f4f4f4;
  background: #2a2a2a;
  border: 0;
  box-shadow:
    inset 3px 3px 0 #111111,
    inset -3px -3px 0 #6d6d6d;
}

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

.btn {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 14px 10px;
  color: var(--ink);
  text-align: center;
  background: var(--stone);
  border: 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-shadow: 2px 2px 0 #d8d8d8;
  box-shadow:
    inset 4px 4px 0 var(--stone-hi),
    inset -4px -4px 0 var(--stone-low),
    inset 6px 6px 0 var(--stone-mid),
    inset -6px -6px 0 var(--stone-shade);
}

.btn.block { display: block; width: 100%; margin-top: 10px; }

.btn.small { padding: 10px 8px; font-size: 8px; min-width: 72px; }

.btn.ghost { font-size: 10px; }

.btn.pressed,
.btn:active:not(:disabled) {
  transform: translateY(2px);
  text-shadow: -1px -1px 0 #d8d8d8;
  box-shadow:
    inset -4px -4px 0 var(--stone-hi),
    inset 4px 4px 0 var(--stone-low),
    inset -6px -6px 0 var(--stone-mid),
    inset 6px 6px 0 var(--stone-shade);
}

.btn:disabled {
  color: #5c5c5c;
  background: #7a7a7a;
  text-shadow: none;
  cursor: default;
}

.btn:focus-visible {
  outline: 3px solid #fff8dc;
  outline-offset: 2px;
}

.buzz {
  display: block;
  width: 100%;
  min-height: 148px;
  margin-top: 12px;
  font-size: 20px;
  letter-spacing: 0.08em;
}

.buzz.live:not(:disabled) {
  color: #fff5f5;
  background: #b02020;
  text-shadow: 3px 3px 0 #4a0000;
  box-shadow:
    inset 4px 4px 0 #ff8d8d,
    inset -4px -4px 0 #4a0000,
    inset 6px 6px 0 #d24a4a,
    inset -6px -6px 0 #6e1010;
  animation: lamp 0.7s steps(2, end) infinite;
}

.buzz.live.pressed,
.buzz.live:active:not(:disabled) {
  text-shadow: -2px -2px 0 #4a0000;
  box-shadow:
    inset -4px -4px 0 #ff8d8d,
    inset 4px 4px 0 #4a0000,
    inset -6px -6px 0 #d24a4a,
    inset 6px 6px 0 #6e1010;
}

@keyframes lamp {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.28); }
}

@media (prefers-reduced-motion: reduce) {
  .buzz.live:not(:disabled) { animation: none; }
}

.banner {
  margin-top: 10px;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  background: #3a3428;
  color: #f0e2b6;
  box-shadow:
    inset 3px 3px 0 #111111,
    inset -3px -3px 0 #7a705c;
}

.banner.live { background: #7a1d1d; color: #ffe1e1; }
.banner.closed { background: #2e2e2e; color: #bdbdbd; }
.banner.waiting { background: #3a3428; color: #f0e2b6; }

.order {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.order li {
  margin-top: 6px;
  padding: 8px;
  background: #c6c6c6;
  color: #1b1b1b;
  font-size: 11px;
  box-shadow:
    inset 3px 3px 0 #f4f4f4,
    inset -3px -3px 0 #555555;
}

.order li.place-1 {
  background: #b02020;
  color: #fff5f5;
  box-shadow:
    inset 3px 3px 0 #ff9a9a,
    inset -3px -3px 0 #4a0000;
}

.order li.empty {
  background: transparent;
  color: #efe6c8;
  text-shadow: 2px 2px 0 #2a2114;
  box-shadow: none;
}

.error {
  min-height: 1.6em;
  margin-top: 10px;
  color: #ffd0d0;
  font-size: 10px;
  text-shadow: 2px 2px 0 #4a0000;
}

[hidden] { display: none !important; }
