/* Dice Fight: tokens, typography, buttons, forms. */

:root {
  --ink: #0a0a18;
  --navy: #0b0f3a;
  --indigo: #1d1f6e;
  --violet: #3a1a8a;
  --magenta: #ff2d95;
  --cyan: #22e4ff;
  --yellow: #ffd60a;
  --orange: #ff8a00;
  --cream: #fff4dc;
  --white: #ffffff;
  --red: #ff3b3b;
  --green: #2ee88a;
  --muted: #9aa0d8;

  --radius: 14px;
  --stroke: 3px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  /* Google Fonts (linked in index.html), with system fallbacks while they load or offline. */
  --font-display: "Bangers", "Impact", "Arial Black", system-ui, sans-serif;
  --font-body: "Michroma", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* Global text scale. Almost every size is in rem, so this one value scales text (and
   rem-based spacing) everywhere. 80% keeps form inputs (1.25rem) at 16px, so iOS won't zoom. */
html { font-size: 80%; }

body {
  background:
    radial-gradient(120% 80% at 50% 0%, var(--violet) 0%, transparent 60%),
    radial-gradient(100% 60% at 50% 100%, #12195a 0%, transparent 70%),
    var(--navy);
  background-attachment: fixed;
}

#app { min-height: 100%; }

[hidden] { display: none !important; }

/* Form controls don't inherit fonts by default. */
input, button, select, textarea { font-family: inherit; }

h1, h2, h3, .display {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  font-weight: 900;
  margin: 0;
}

.muted { color: var(--muted); font-weight: 400; }
.eyebrow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--muted); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  border: var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.8rem 1.2rem;
  min-height: 52px;
  font-family: var(--font-display);
  font-size: 1.69rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--white);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 80ms ease, box-shadow 80ms ease, filter 120ms;
}
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { filter: grayscale(0.9) brightness(0.6); cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.btn-yellow { background: var(--yellow); }
.btn-magenta { background: var(--magenta); color: var(--white); text-shadow: 2px 2px 0 var(--ink); }
.btn-cyan { background: var(--cyan); }
.btn-ghost {
  background: transparent; color: var(--muted); border-color: var(--muted);
  box-shadow: none; font-family: var(--font-body); font-weight: 600; text-transform: none; font-size: 1rem;
}
.btn-small { min-height: 40px; padding: 0.4rem 0.9rem; font-size: 1.25rem; }
.btn-huge { font-size: 2.5rem; min-height: 70px; width: 100%; }
.btn-ghost.btn-small { font-size: 1rem; }   /* body-font buttons (Leave, Forget it) keep their size */

/* ---------- cards & forms ---------- */

.card {
  background: rgba(10, 10, 40, 0.72);
  border: 2px solid rgba(34, 228, 255, 0.35);
  border-radius: 18px;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.63rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem;
  color: var(--yellow);
}

.field { display: block; margin-bottom: 0.9rem; }
.field > span {
  display: block; margin-bottom: 0.3rem;
  font-family: var(--font-display); font-size: 1.38rem; text-transform: uppercase; color: var(--cyan);
}
.field input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-size: 1.25rem; /* ≥16px stops iOS zooming */
  font-weight: 700;
  color: var(--ink);
  background: var(--cream);
  border: var(--stroke);
  border-radius: 12px;
  outline: none;
}
.field input:focus { box-shadow: 0 0 0 3px var(--cyan); }
.code-input { text-transform: uppercase; letter-spacing: 0.4em; font-family: var(--font-display) !important; }

.form-error { color: var(--magenta); font-weight: 700; min-height: 1.4em; margin: 0.6rem 0 0; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(110px + var(--safe-bottom));
  transform: translateX(-50%);
  max-width: min(92vw, 420px);
  background: var(--ink); color: var(--white);
  border: 2px solid var(--yellow); border-radius: 12px;
  padding: 0.7rem 1rem; font-weight: 700; text-align: center;
  z-index: 100;
  animation: toast-in 180ms ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
