/* ==========================================================================
   67 Speed Clone — Front-end only
   Dark theme + vibrant gradient (orange → pink → indigo)
   ========================================================================== */

:root {
  --bg: #0a0a0c;
  --bg-2: #111114;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #ececec;
  --text-dim: #9a9aa2;
  --text-faint: #6a6a72;

  --accent-1: #fe7b02;
  --accent-2: #fe3f21;
  --accent-3: #f858bc;
  --accent-4: #575ecf;
  --gradient: linear-gradient(
    135deg,
    var(--accent-1) 0%,
    var(--accent-2) 28%,
    var(--accent-3) 62%,
    var(--accent-4) 100%
  );

  --radius: 14px;
  --radius-lg: 20px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans,
    Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--text);
  background: radial-gradient(
      ellipse at 20% -10%,
      rgba(254, 63, 33, 0.18),
      transparent 55%
    ),
    radial-gradient(
      ellipse at 90% 110%,
      rgba(87, 94, 207, 0.22),
      transparent 55%
    ),
    var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

code {
  font-family: var(--mono);
  background: var(--panel);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

/* ---------- Screen plumbing ---------- */

.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
}

.screen[data-active="true"] {
  display: flex;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.logo-num {
  font-family: var(--mono);
  font-size: 28px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-word {
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 3px;
}

.logo.small .logo-num {
  font-size: 22px;
}

.topnav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.topnav a:hover {
  color: var(--text);
  background: var(--panel);
}

.btn-back {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Hero ---------- */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 80px;
  text-align: center;
  gap: 28px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--text-dim);
}

.headline {
  font-size: clamp(40px, 7vw, 84px);
  font-weight: 800;
  line-height: 1.02;
  max-width: 960px;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub {
  color: var(--text-dim);
  max-width: 560px;
  font-size: 17px;
  line-height: 1.5;
}

.hero-feats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  color: var(--text-dim);
  font-size: 14px;
}

.hero-feats li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gradient);
}

.foot {
  padding: 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
}

/* ---------- Buttons ---------- */

.btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 12px;
  transition: transform 0.1s ease, filter 0.2s, background 0.2s;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 10px 30px -12px rgba(254, 63, 33, 0.6);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-ghost {
  background: var(--panel);
  border: 1px solid var(--panel-border);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

.btn.copied,
.btn.copied:hover:not(:disabled) {
  background: linear-gradient(135deg, #27d97b 0%, #16b366 100%) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 10px 30px -12px rgba(39, 217, 123, 0.6);
  filter: none !important;
  animation: copiedPop 0.3s ease;
}

@keyframes copiedPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.btn-xl {
  padding: 18px 34px;
  font-size: 17px;
  border-radius: 14px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

/* ---------- Card pages (How / Setup / Result) ---------- */

.card-page {
  flex: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-page h2 {
  font-size: clamp(24px, 5.5vw, 32px);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.card-page h3 {
  margin-top: 10px;
  font-size: 16px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.card-page p,
.card-page li {
  color: var(--text);
  line-height: 1.55;
}

.muted {
  color: var(--text-dim) !important;
}

.tiny {
  color: var(--text-faint);
  font-size: 12px;
}

.how-list,
.tips {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tips {
  color: var(--text-dim);
}

.status-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  font-size: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f5a524;
  box-shadow: 0 0 0 4px rgba(245, 165, 36, 0.15);
}

.status-box[data-state="ok"] .status-dot {
  background: #27d97b;
  box-shadow: 0 0 0 4px rgba(39, 217, 123, 0.15);
}

.status-box[data-state="err"] .status-dot {
  background: #ff4d6d;
  box-shadow: 0 0 0 4px rgba(255, 77, 109, 0.15);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* ---------- Result ---------- */

.result {
  align-items: center;
  text-align: center;
}

.big-score {
  font-family: var(--mono);
  font-size: clamp(80px, 18vw, 180px);
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin: 12px 0 6px;
}

.stat-grid > div {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-faint);
}

.stat-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
}

.verdict {
  margin-top: 6px;
  font-size: 16px;
  color: var(--text-dim);
}

/* ---------- Game screen (full-bleed video) ---------- */

.screen-game[data-active="true"] {
  display: block;
}

.stage {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
}

#video,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror for natural feel */
}

#overlay {
  pointer-events: none;
}

/* ---- HUD ---- */

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

.hud-top,
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.hud-bottom {
  align-items: flex-end;
}

.hud-chip {
  pointer-events: auto;
  background: rgba(10, 10, 12, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
}

.hud-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-faint);
  text-transform: uppercase;
}

.hud-value {
  font-family: var(--mono);
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  transition: transform 0.08s ease;
  transform-origin: left center;
}

.hud-score .hud-value {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hud-timer[data-warn="true"] .hud-value {
  color: #ff4d6d;
  animation: pulse 0.6s ease infinite alternate;
}

@keyframes pulse {
  from {
    opacity: 0.75;
  }
  to {
    opacity: 1;
  }
}

#btn-quit {
  pointer-events: auto;
}

/* ---- Arm indicators ---- */

.arm-indicator {
  pointer-events: auto;
  display: flex;
  gap: 10px;
}

.arm {
  background: rgba(10, 10, 12, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 54px;
  transition: border-color 0.15s, background 0.15s;
}

.arm-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-faint);
}

.arm-state {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
}

.arm[data-state="UP"] {
  border-color: rgba(254, 123, 2, 0.8);
  background: rgba(254, 123, 2, 0.22);
}

.arm[data-state="DOWN"] {
  border-color: rgba(87, 94, 207, 0.7);
  background: rgba(87, 94, 207, 0.18);
}

/* ---- Countdown overlay ---- */

.countdown {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: auto;
}

.countdown[hidden],
.coach[hidden] {
  display: none !important;
}

.countdown-label {
  font-size: 18px;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.countdown-num {
  font-family: var(--mono);
  font-size: clamp(120px, 22vw, 260px);
  font-weight: 800;
  line-height: 1;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: popin 0.5s ease;
}

@keyframes popin {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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

.coach {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 22px;
  background: rgba(10, 10, 12, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text);
  pointer-events: none;
  max-width: 80%;
  text-align: center;
}

/* ---- Embed mode (loaded inside <iframe> on the marketing site) ---- */

html[data-embed] body {
  background: #000;
}
html[data-embed] .topnav,
html[data-embed] .btn-back,
html[data-embed] .foot,
html[data-embed] [data-goto="screen-home"] {
  display: none !important;
}
html[data-embed] .topbar {
  padding: 14px 20px;
}
html[data-embed] .card-page {
  padding: 18px 20px 28px;
}
html[data-embed] .card-page h2 {
  font-size: 26px;
}
html[data-embed] .big-score {
  font-size: clamp(64px, 14vw, 140px);
}

/* ==========================================================================
   Responsive breakpoints
   Desktop (default)  >1024px
   Tablet             ≤1024px
   Phone              ≤640px
   Small phone        ≤400px
   Landscape phone    max-height ≤500px + landscape
   Touch (no hover)   hover:none + pointer:coarse
   ========================================================================== */

/* ---- Tablet (≤1024px) ---- */
@media (max-width: 1024px) {
  .topbar {
    padding: 16px 22px;
  }
  .hero {
    padding: 32px 24px 60px;
    gap: 22px;
  }
  .sub {
    font-size: 16px;
  }
  .card-page {
    padding: 20px 24px 48px;
  }
  .hud {
    padding: 20px;
  }
  .hud-chip {
    min-width: 110px;
  }
  .hud-value {
    font-size: 34px;
  }
}

/* ---- Phone (≤640px) ---- */
@media (max-width: 640px) {
  .topbar {
    padding: 14px 16px;
  }
  .logo-num {
    font-size: 24px;
  }
  .logo-word {
    font-size: 12px;
    letter-spacing: 2px;
  }
  .hero {
    padding: 20px 18px 48px;
    gap: 18px;
  }
  .hero-feats {
    gap: 12px;
    font-size: 13px;
  }
  .sub {
    font-size: 15px;
  }
  .btn-xl {
    padding: 16px 28px;
    font-size: 16px;
    width: 100%;
    max-width: 320px;
  }
  .card-page {
    padding: 12px 18px 48px;
    gap: 14px;
  }
  .card-page h3 {
    font-size: 13px;
    letter-spacing: 1.5px;
  }
  .actions {
    flex-direction: column;
    gap: 10px;
  }
  .actions .btn {
    width: 100%;
  }
  .hud {
    padding: 14px;
  }
  .hud-top,
  .hud-bottom {
    gap: 8px;
  }
  .hud-chip {
    min-width: 92px;
    padding: 8px 12px;
  }
  .hud-label {
    font-size: 9px;
    letter-spacing: 2px;
  }
  .hud-value {
    font-size: 28px;
  }
  .arm-indicator {
    gap: 6px;
  }
  .arm {
    min-width: 46px;
    padding: 6px 10px;
  }
  .arm-label {
    font-size: 9px;
    letter-spacing: 2px;
  }
  .arm-state {
    font-size: 14px;
  }
  .countdown-label {
    font-size: 14px;
    letter-spacing: 4px;
  }
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .stat-grid > div {
    padding: 10px 6px;
  }
  .stat-label {
    font-size: 10px;
    letter-spacing: 1.5px;
  }
  .stat-value {
    font-size: 17px;
  }
  .coach {
    font-size: 13px;
    padding: 10px 16px;
    max-width: 90%;
  }
}

/* ---- Small phone (≤400px) ---- */
@media (max-width: 400px) {
  .topbar {
    padding: 12px 14px;
  }
  .logo-num {
    font-size: 22px;
  }
  .hero {
    padding: 16px 16px 40px;
  }
  .card-page {
    padding: 10px 14px 40px;
  }
  .hud {
    padding: 10px;
  }
  .hud-chip {
    min-width: 84px;
    padding: 6px 10px;
  }
  .hud-value {
    font-size: 24px;
  }
  .arm {
    min-width: 42px;
    padding: 5px 8px;
  }
  .arm-state {
    font-size: 13px;
  }
  #btn-quit {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* ---- Landscape phone (short height, avoids cramped portrait-only logic) ---- */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 16px 24px 24px;
    gap: 14px;
  }
  .headline {
    font-size: clamp(28px, 5vw, 48px);
  }
  .sub {
    font-size: 14px;
  }
  .hero-feats {
    gap: 10px;
    font-size: 12px;
  }
  .card-page {
    padding: 10px 18px 24px;
    gap: 10px;
  }
  .hud {
    padding: 12px 18px;
  }
  .hud-chip {
    padding: 6px 12px;
    min-width: 92px;
  }
  .hud-value {
    font-size: 24px;
  }
  .countdown-num {
    font-size: clamp(80px, 14vh, 160px);
  }
}

/* ---- Touch devices: bigger hit targets, remove hover-only effects ---- */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
  }
  .btn-sm {
    min-height: 36px;
  }
  .btn-back {
    width: 44px;
    height: 44px;
  }
  .btn-primary:hover:not(:disabled),
  .btn-ghost:hover:not(:disabled),
  .btn-back:hover,
  .topnav a:hover {
    filter: none;
    background: var(--panel);
  }
}
