:root {
  --bg: #0b0b0d;
  --ink: #ffffff;
  --dim: rgba(255, 255, 255, 0.6);
  --accent: #e8ff2b;
  --hot: #ff3b5c;
  --display: "Archivo Black", "Space Grotesk", sans-serif;
  --body: "Space Grotesk", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

main { height: 100%; }

.screen {
  position: fixed;
  inset: 0;
  display: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---------- shared bits ---------- */

.logo {
  font-family: var(--display);
  font-size: clamp(56px, 16vw, 96px);
  line-height: 0.9;
  letter-spacing: -0.02em;
}
.logo span { display: block; color: var(--accent); }
.logo.small { font-size: clamp(36px, 10vw, 56px); }

.tag {
  margin: 22px 0 8px;
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
}
.tag strong { color: var(--accent); }
.slim-tag { margin: 0; color: var(--dim); text-transform: uppercase; letter-spacing: 0.14em; font-size: 14px; }

.hint { margin-top: 16px; font-size: 13px; color: var(--dim); }

.mega {
  font-family: var(--display);
  font-size: 30px;
  padding: 20px 56px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #0b0b0d;
  cursor: pointer;
  margin-top: 26px;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 0 rgba(232, 255, 43, 0.25);
}
.mega:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(232, 255, 43, 0.25); }
.mega:disabled { opacity: 0.35; box-shadow: none; }
.mega.slim { font-size: 20px; padding: 14px 36px; margin-top: 14px; }

.link-btn { display: inline-block; text-decoration: none; text-align: center; }

.ghost {
  font-family: var(--body);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 18px;
  background: transparent;
  color: var(--dim);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  cursor: pointer;
}

.row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; justify-content: center; }

/* ---------- home ---------- */

.home-inner { text-align: center; padding: 24px; max-width: 420px; }

#revenge-banner {
  margin: 18px auto 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 59, 92, 0.15);
  border: 1.5px solid var(--hot);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.pack-row { display: flex; gap: 8px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.chip {
  font-family: var(--body);
  font-weight: 700;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
}
.chip.on { background: var(--ink); color: #0b0b0d; border-color: var(--ink); }

/* ---------- setup ---------- */

.cam-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.setup-ui {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  width: 100%;
  padding: 24px;
  background: linear-gradient(to top, rgba(11, 11, 13, 0.9) 0%, transparent 45%);
}

.frame-hint {
  background: rgba(11, 11, 13, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.45;
  max-width: 380px;
  text-align: center;
}
.frame-hint strong { color: var(--accent); }

.perm-error {
  margin-top: 14px;
  background: rgba(255, 59, 92, 0.15);
  border: 1.5px solid var(--hot);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 14px;
  max-width: 380px;
  text-align: center;
}

.setup-actions { display: flex; flex-direction: column; align-items: center; padding-bottom: 18px; }

/* ---------- recording ---------- */

#screen-rec { background: #000; }

.stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.word-wrap {
  position: absolute;
  top: 40%;
  left: 0;
  right: 0;
  text-align: center;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
  z-index: 2;
}
.word-wrap.show { opacity: 1; transform: scale(1); }

.word-label {
  font-family: var(--body);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
  margin-bottom: 8px;
}

.word-layer {
  font-family: var(--display);
  font-size: clamp(44px, 13vw, 92px);
  line-height: 1.02;
  padding: 0 16px;
  color: var(--accent);
  text-transform: uppercase;
  -webkit-text-stroke: 2px rgba(0, 0, 0, 0.8);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.9);
}

.abort {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 14px);
  right: 14px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
}

/* ---------- preview ---------- */

#screen-preview { background: #000; }

.playback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-ui {
  position: relative;
  z-index: 1;
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  background: linear-gradient(to top, rgba(11, 11, 13, 0.95) 20%, transparent);
}

.webm-warning {
  font-size: 13px;
  color: var(--hot);
  background: rgba(255, 59, 92, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  max-width: 380px;
  text-align: center;
}

.share-note { margin-top: 12px; font-size: 13px; color: var(--accent); text-align: center; min-height: 18px; }

/* ---------- guess page ---------- */

.guess-page .screen.active { justify-content: center; }
.guess-inner { width: 100%; max-width: 420px; padding: 24px; text-align: center; }

.guess-bar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-bottom: 28px;
}
.guess-bar-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transform-origin: left center;
}
.guess-bar-fill.low { background: var(--hot); }

.round-label { font-family: var(--display); font-size: 40px; margin-bottom: 22px; }

.guess-form { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.guess-form input {
  width: 100%;
  font-family: var(--body);
  font-weight: 700;
  font-size: 22px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  text-align: center;
  outline: none;
}
.guess-form input:focus { border-color: var(--accent); }

.reveal { margin-top: 10px; }
.reveal-verdict { font-family: var(--display); font-size: 44px; }
.reveal.hit .reveal-verdict { color: var(--accent); }
.reveal.miss .reveal-verdict { color: var(--hot); }
.reveal-word { margin-top: 10px; font-size: 26px; font-weight: 700; text-transform: uppercase; }

.score-big { font-family: var(--display); font-size: 120px; color: var(--accent); line-height: 1.1; }
.score-line { font-size: 17px; color: var(--ink); margin-bottom: 18px; }

.score-list { list-style: none; margin-bottom: 8px; }
.score-list li { font-size: 17px; font-weight: 700; padding: 5px 0; text-transform: uppercase; }
.score-list li.hit { color: var(--ink); }
.score-list li.miss { color: var(--dim); text-decoration: line-through; }

.revenge { background: var(--hot); box-shadow: 0 10px 0 rgba(255, 59, 92, 0.25); font-size: 24px; padding: 18px 40px; }
.revenge span { display: block; font-family: var(--body); font-weight: 700; font-size: 13px; margin-top: 4px; text-transform: none; }

/* ---------- rotate blocker (mobile only) ---------- */

.rotate-blocker {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  font-size: 28px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
@media (orientation: landscape) and (pointer: coarse) {
  .rotate-blocker { display: flex; }
}
