:root {
  --bg: #14161c;
  --panel: #1f232c;
  --ink: #f1f3f7;
  --muted: #8b93a5;
  --accent: #e5383b;
  --accent-dark: #a4161a;
  --good: #2ec27e;
  --line: #2e3440;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

.screen {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

h1 { font-size: 2.5rem; margin: 10vh 0 8px; letter-spacing: -0.03em; }

header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-weight: 600;
}

.card { width: 100%; display: flex; flex-direction: column; gap: 10px; }

input, button {
  font: inherit;
  font-size: 1.1rem;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
input { background: var(--panel); color: var(--ink); }
#codeInput { text-transform: uppercase; letter-spacing: 0.2em; }

button {
  cursor: pointer;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
button.secondary { background: var(--panel); border-color: var(--line); color: var(--ink); }
button.link { background: none; border: none; padding: 4px; color: var(--muted); font-size: 0.95rem; }
#hostBtn { width: 100%; }

.or, .muted { color: var(--muted); margin: 0; text-align: center; }
.error { color: #ff6b6b; min-height: 1.2em; margin: 0; }

/* ---- The button ---- */
.buzz {
  margin-top: 4vh;
  width: min(78vw, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 2.6rem;
  letter-spacing: 0.05em;
  border: none;
  background: radial-gradient(circle at 35% 30%, #ff6b6b, var(--accent) 55%, var(--accent-dark));
  box-shadow: 0 12px 0 #6a040f, 0 18px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.06s, box-shadow 0.06s;
  touch-action: manipulation;
  user-select: none;
}
.buzz:active:not(:disabled) { transform: translateY(10px); box-shadow: 0 2px 0 #6a040f, 0 6px 16px rgba(0, 0, 0, 0.5); }
.buzz:disabled { cursor: default; filter: grayscale(0.85) brightness(0.6); }
.buzz.first { background: radial-gradient(circle at 35% 30%, #7ee2a8, var(--good) 55%, #1a7f50); box-shadow: 0 2px 0 #0f5132; transform: translateY(10px); filter: none; }

.status { font-size: 1.3rem; font-weight: 700; margin: 0; min-height: 1.5em; text-align: center; }

/* ---- Buzz order ---- */
.order { width: 100%; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.order li {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--panel);
}
.order li:first-child { background: var(--good); color: #06281a; font-weight: 700; }
.order li .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.order li:first-child .t { color: inherit; }
.order.big li { font-size: 1.4rem; padding: 14px 18px; }
.order.big:empty::before { content: "Waiting for a buzz…"; color: var(--muted); text-align: center; padding: 20px; }

.code-label { margin: 2vh 0 0; color: var(--muted); text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.1em; }
.code { margin: 0; font-size: 4rem; font-weight: 800; letter-spacing: 0.15em; }
.controls { width: 100%; display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
