/* ═══════════════════════════════════════════════════════════
   VOLLEY — Spin Page Styles  (spin.css)
   FIXES: vertical centering · badge position · hyphenation
          scroll indicator · button hierarchy · left panel align
   ═══════════════════════════════════════════════════════════ */

/* ── Page layout ─────────────────────────────────────────── */
.page-spin {
  min-height: 100vh;
  padding-top: var(--nav-height);
  display: flex;
  position: relative;
}

/* Ambient background glow for spin page */
.page-spin::before {
  content: '';
  position: fixed;
  top: -10%; left: 35%;
  transform: translateX(-50%);
  width: 900px; height: 900px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 241, 53, 0.07) 0%, rgba(200,241,53,0.02) 45%, transparent 70%);
  animation: float 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

/* ── LEFT PANEL ──────────────────────────────────────────── */
/* FIX #2: True vertical centering aligned with reel midpoint */
.panel-left {
  width: var(--panel-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 44px 0 52px;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  /* Constrain height so flex centering works against viewport */
  height: calc(100vh - var(--nav-height));
  position: sticky;
  top: var(--nav-height);
}

/* Ambient lime orb */
.panel-left::before {
  content: '';
  position: absolute;
  bottom: -80px; left: -80px;
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(200,241,53,0.055) 0%, transparent 66%);
  pointer-events: none;
}

/* Lime accent line right edge */
.panel-left::after {
  content: '';
  position: absolute;
  top: 50%; right: 0;
  transform: translateY(-50%);
  width: 1px; height: 84px;
  background: linear-gradient(to bottom, transparent, var(--lime), transparent);
  opacity: 0.38;
}

/* FIX #9: PNG brand logo in left panel */
.brand-mark-wrap {
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeInUp 0.7s 0.1s both;
}
.brand-logo-img {
  width: 110px;
  height: auto;
  display: block;
  object-fit: contain;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 84px; font-weight: 900;
  text-transform: lowercase; letter-spacing: 0.03em;
  line-height: 0.86; color: var(--ghost);
  margin-bottom: 10px;
  opacity: 0; animation: fadeInUp 0.7s 0.2s both;
}

.brand-sub {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 0.20em; text-transform: uppercase;
  color: var(--grey); margin-bottom: 44px;
  opacity: 0; animation: fadeInUp 0.7s 0.3s both;
}

.steps {
  display: flex; flex-direction: column; gap: 18px;
  opacity: 0; animation: fadeInUp 0.7s 0.4s both;
}

.step { display: flex; align-items: flex-start; gap: 13px; }

.step-badge {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--lime); color: var(--lime);
  font-family: var(--font-display); font-size: 11px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px; letter-spacing: 0;
}

.step-label { font-size: var(--text-base); color: var(--ghost-2); line-height: 1.45; font-weight: 300; }
.step-label strong { color: var(--ghost); font-weight: 600; }

.panel-ecg {
  margin-top: 48px;
  opacity: 0; animation: fadeIn 0.9s 0.85s both;
  overflow: visible;
}

/* ── RIGHT PANEL ─────────────────────────────────────────── */
/* FIX #1: True vertical centering, no dead space */
.panel-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 40px 40px;
  position: relative;
  /* Match left panel height so both align */
  min-height: calc(100vh - var(--nav-height));
}

/* Tight wrapper — keeps filter+reel+buttons as one unified block */
.reel-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 580px;
  gap: 0;
  /* CRITICAL: must not clip dropdown menus */
  overflow: visible;
}

/* ── FILTER ROW ──────────────────────────────────────────── */
/* FIX #8: Consistent spacing — filter is part of the reel block */
.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  animation: fadeInUp 0.6s 0.45s both;
  align-self: flex-start; /* left-align with reel edge */
  /* CRITICAL: must not clip dropdown menus */
  overflow: visible;
  position: relative;
  z-index: 50;
}

.fpill { position: relative; overflow: visible; }

.fpill-trigger {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--ghost); font-family: var(--font-body);
  font-size: var(--text-sm); font-weight: 500;
  cursor: pointer; white-space: nowrap;
  user-select: none; -webkit-user-select: none;
  transition: border-color 0.2s, background 0.2s;
}
.fpill-trigger:hover { background: var(--surface-3); border-color: var(--lime-border); }

.fpill-trigger .arrow {
  font-size: 7px; color: var(--grey); display: inline-block;
  transition: transform 0.22s var(--ease-out);
}
.fpill.open .fpill-trigger { background: var(--surface-3); border-color: var(--lime-border); }
.fpill.open .arrow { transform: rotate(180deg); }

.fpill-menu {
  position: absolute;
  top: calc(100% + 7px); left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 195px;
  background: var(--surface-2); border: 1px solid var(--surface-4);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 6px; opacity: 0; visibility: hidden; z-index: 200; overflow: hidden;
  transition: opacity 0.18s, transform 0.22s var(--ease-out), visibility 0.18s;
}
.fpill.open .fpill-menu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.fpill-option {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 12px;
  background: none; border: none; border-radius: var(--r-sm);
  color: var(--ghost-2); font-family: var(--font-body);
  font-size: var(--text-sm); font-weight: 400;
  cursor: pointer; text-align: left;
  transition: background 0.15s, color 0.15s;
}
.fpill-option:hover  { background: var(--surface-hover); color: var(--ghost); }
.fpill-option.active { color: var(--lime); }
.fpill-option .tick  { margin-left: auto; font-size: 9px; color: var(--lime); opacity: 0; }
.fpill-option.active .tick { opacity: 1; }

/* ── REEL ASSEMBLY ───────────────────────────────────────── */
.reel-outer {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  opacity: 0;
  animation: fadeInUp 0.7s 0.55s both;
}

.reel-main { flex: 1; display: flex; flex-direction: column; align-items: center; }

/* ── Reel viewport ───────────────────────────────────────── */
.reel-window {
  position: relative;
  width: 100%; height: 370px;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);

  /* FIX #3: More aggressive mask — text fully hidden before it's readable */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 8%,
    rgba(0,0,0,0.2) 16%,
    black 28%,
    black 72%,
    rgba(0,0,0,0.2) 84%,
    transparent 92%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 8%,
    rgba(0,0,0,0.2) 16%,
    black 28%,
    black 72%,
    rgba(0,0,0,0.2) 84%,
    transparent 92%,
    transparent 100%
  );
}

/* Lime selection lines */
.reel-window::before,
.reel-window::after {
  content: '';
  position: absolute;
  left: 16px; right: 16px; height: 1px;
  background: linear-gradient(to right, transparent, rgba(200,241,53,0.20), transparent);
  z-index: 3; pointer-events: none;
}
.reel-window::before { top: calc(50% - 62px); }
.reel-window::after  { top: calc(50% + 62px); }

/* FIX #4: Category badge moved OUTSIDE reel window — no collision */
.cat-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px;
  background: var(--lime-muted); border: 1px solid var(--lime-border);
  border-radius: var(--r-pill); color: var(--lime);
  font-size: var(--text-xs); font-weight: 700;
  letter-spacing: 0.13em; text-transform: uppercase;
  white-space: nowrap; opacity: 0;
  transition: opacity 0.35s;
  /* Sits above reel in the reel-block flow, not inside the window */
  align-self: center;
  margin-bottom: 8px;
  order: -1; /* visually before reel-outer */
}

/* Difficulty pips still inside reel at bottom — safe zone below mask */
.diff-pips {
  position: absolute;
  bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px; z-index: 5;
  opacity: 0; transition: opacity 0.35s;
}
.pip {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--surface-4); transition: background 0.3s, box-shadow 0.3s;
}
.pip.lit { background: var(--lime); box-shadow: 0 0 6px rgba(200,241,53,0.65); }

/* Scrolling strip */
.reel-strip { position: absolute; left: 0; top: 0; width: 100%; will-change: transform; }

/* Individual topic item */
/* FIX #5: No hyphens — use soft wrap only as last resort */
.reel-item {
  width: 100%; height: 124px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 0 32px;
  font-family: var(--font-reel); font-size: 2.2rem; line-height: 1.22;
  color: var(--ghost); user-select: none;
  word-wrap: break-word; overflow-wrap: break-word;
  hyphens: none;        /* FIX #5: disabled — no more "citi-zens" */
  word-break: normal;
}

.reel-strip.settled .reel-item {
  opacity: 0.18;
  transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out);
}
.reel-strip.settled .reel-item.landed {
  opacity: 1; transform: scale(1.12);
  position: relative; z-index: 2;
  transition: opacity 0.45s var(--ease-out), transform 0.5s var(--ease-spring);
}

/* FIX #7: Scroll indicator — clean, no artifact line */
.scroll-indicator {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 10px; padding: 56px 0; flex-shrink: 0;
}
.scroll-track {
  width: 2px; flex: 1;
  background: var(--surface-3); border-radius: 2px;
  position: relative; overflow: hidden;
  /* Remove any inherited border/outline that caused the artifact */
  border: none; outline: none;
}
.scroll-thumb-inner {
  position: absolute; top: 0; left: 0; right: 0;
  height: 28%;
  background: linear-gradient(to bottom, var(--lime), rgba(200,241,53,0.4));
  border-radius: 2px; opacity: 0.6;
  transition: top 0.1s linear;
}

/* ── BUTTON ROW ──────────────────────────────────────────── */
/* FIX #6: Clear hierarchy — Spin is dominant, Timer is secondary */
.spin-btn-row {
  display: flex; gap: 10px;
  margin-top: 18px;
  justify-content: center; flex-wrap: wrap;
  opacity: 0; animation: fadeInUp 0.6s 0.7s both;
}

/* Spin button — larger, lime, full presence */
.btn-spin {
  padding: 14px 44px;
  background: var(--lime); color: var(--obsidian);
  border: none; border-radius: var(--r-pill);
  font-family: var(--font-body); font-size: var(--text-lg); font-weight: 800;
  letter-spacing: 0.02em; cursor: pointer;
  box-shadow: 0 0 28px rgba(200,241,53,0.32);
  transition: transform 0.18s var(--ease-spring), box-shadow 0.22s, background 0.15s;
  min-width: 120px;
}
.btn-spin:hover  { background: var(--lime-bright); transform: scale(1.06); box-shadow: 0 0 44px rgba(200,241,53,0.48); }
.btn-spin:active { transform: scale(0.97); }
.btn-spin:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

/* Timer button — ghost, clearly secondary */
.btn-to-timer {
  padding: 13px 24px;
  background: transparent; color: var(--ghost-3);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: var(--r-pill);
  font-family: var(--font-body); font-size: var(--text-base); font-weight: 500;
  cursor: pointer; letter-spacing: 0.01em;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.18s var(--ease-spring);
}
.btn-to-timer:hover {
  border-color: var(--lime-border); color: var(--lime);
  background: var(--lime-muted); transform: scale(1.03);
}

/* Keyboard hint */
.kbd-hint {
  margin-top: 12px; font-size: var(--text-xs); color: var(--grey);
  font-weight: 400; letter-spacing: 0.04em;
  opacity: 0; animation: fadeIn 0.6s 1.2s both; text-align: center;
}
.kbd {
  display: inline-block; padding: 2px 7px;
  background: var(--surface-3); border: 1px solid var(--surface-4);
  border-radius: var(--r-xs); font-size: 10px;
  font-family: var(--font-display); font-weight: 700;
  color: var(--ghost-2); letter-spacing: 0.06em; vertical-align: middle;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .page-spin        { flex-direction: column; }
  .panel-left       {
    width: 100%; height: auto; position: static;
    padding: 32px 28px 24px;
    border-right: none; border-bottom: 1px solid var(--border);
    align-items: center; text-align: center;
  }
  .panel-left::after { display: none; }
  .panel-ecg         { display: none; }
  .scroll-indicator  { display: none; }
  .panel-right       { padding: 28px 20px 48px; min-height: auto; }
  .filter-row        { align-self: center; }
  .reel-window       { height: 340px; }
  .reel-item         { height: 113px; }
}

@media (max-width: 480px) {
  .brand-name    { font-size: 64px; }
  .panel-left    { padding: 24px 16px 20px; }
  .reel-window   { border-radius: var(--r-md); height: 300px; }
  .reel-item     { font-size: 1.72rem; height: 100px; padding: 0 16px; }
  .filter-row    { gap: 6px; }
  .fpill-trigger { padding: 7px 12px; font-size: 11px; }
  .btn-spin      { padding: 13px 36px; font-size: var(--text-base); }
}
