/* Phone-first, one thumb, in a dark room, on a screen someone else is also
 * looking at. Big targets, high contrast, nothing that needs precision.
 * Colours match ShowPalette.cs — a player picks a colour, not a position, so
 * these four must agree with the game and the podiums. */

:root {
  --bg: #0a0d16;
  --panel: #141a2a;
  --ink: #f2f5ff;
  --muted: #93a0c0;
  --blue: #2970f2;
  --orange: #f27a17;
  --green: #26b347;
  --yellow: #f5cc21;
  --danger: #ff6b6b;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior: none;
}

#app {
  height: 100%;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
}

.screen {
  display: none;
  height: 100%;
  flex-direction: column;
  gap: 16px;
}

.screen.active {
  display: flex;
}

.hidden {
  display: none !important;
}

h1 {
  margin: 8px 0 0;
  font-size: 2rem;
  letter-spacing: 0.14em;
  text-align: center;
}

h2 {
  margin: 0;
  text-align: center;
  font-size: 1.5rem;
}

.hint {
  margin: 0;
  text-align: center;
  color: var(--muted);
}

.error {
  min-height: 1.4em;
  margin: 0;
  text-align: center;
  color: var(--danger);
}

/* -- join -------------------------------------------------------------- */

form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
}

input {
  width: 100%;
  padding: 18px;
  font-size: 1.25rem;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid #26304a;
  border-radius: 14px;
}

input:focus {
  outline: none;
  border-color: var(--blue);
}

#code {
  text-align: center;
  letter-spacing: 0.5em;
  text-indent: 0.5em; /* re-centres text that letter-spacing pushes left */
  font-size: 2rem;
  font-weight: 700;
}

button {
  font-family: inherit;
  font-weight: 700;
  color: var(--ink);
  background: var(--blue);
  border: none;
  border-radius: 14px;
  padding: 18px;
  font-size: 1.1rem;
}

button:disabled {
  opacity: 0.45;
}

#join-form button {
  margin-bottom: auto;
}

/* -- lobby ------------------------------------------------------------- */

.spinner {
  width: 42px;
  height: 42px;
  margin: auto;
  border: 4px solid #26304a;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

/* -- play -------------------------------------------------------------- */

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--muted);
}

#play-score {
  color: var(--ink);
  font-size: 1.3rem;
}

.prompt {
  margin: 0;
  text-align: center;
  font-size: 1.1rem;
  color: var(--muted);
  min-height: 1.4em;
}

.buzz {
  flex: 1 1 40%;
  min-height: 120px;
  border-radius: 999px;
  background: var(--danger);
  font-size: 2rem;
  letter-spacing: 0.2em;
}

.buzz:active:not(:disabled) {
  transform: scale(0.97);
}

.answers {
  flex: 1 1 55%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
}

.answer {
  min-height: 72px;
  font-size: 1rem;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
}

.answer:active:not(:disabled) {
  transform: scale(0.97);
}

.answer.a { background: var(--blue); }
.answer.b { background: var(--orange); }
.answer.c { background: var(--green); }
.answer.d { background: var(--yellow); color: #241d00; }

.verdict {
  margin: 0;
  min-height: 1.6em;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
}

/* -- lost -------------------------------------------------------------- */

#lost {
  justify-content: center;
}

#retry {
  margin-top: 8px;
}
