/* BFFCheck — Gen-Z Dopamine Pop / Sticker-Book / Tactile Arcade Design System */

:root,
html[data-theme="peach"] {
  --bg-1: #fff5ec;
  --bg-2: #ffe1ec;
  --blob-1: rgba(255, 77, 141, 0.22);
  --blob-2: rgba(255, 184, 0, 0.25);
  --accent: #ff4d8d;
  --accent-dark: #e03172;
  --accent-2: #ffb800;
  --accent-soft: #fff0f5;
  --pill-bg: #fff3c4;
  --pill-ink: #8a3800;
}

html[data-theme="matcha"] {
  --bg-1: #f2fcf5;
  --bg-2: #d8f8e5;
  --blob-1: rgba(0, 200, 150, 0.22);
  --blob-2: rgba(255, 225, 77, 0.30);
  --accent: #00b884;
  --accent-dark: #00946a;
  --accent-2: #ffe14d;
  --accent-soft: #e6fbf3;
  --pill-bg: #fef08a;
  --pill-ink: #14532d;
}

html[data-theme="berry"] {
  --bg-1: #faf2ff;
  --bg-2: #ffe3f5;
  --blob-1: rgba(139, 92, 246, 0.24);
  --blob-2: rgba(255, 62, 165, 0.22);
  --accent: #8b5cf6;
  --accent-dark: #703be7;
  --accent-2: #ff3ea5;
  --accent-soft: #f3ecff;
  --pill-bg: #ffd6ee;
  --pill-ink: #581c87;
}

html[data-theme="sunbeam"] {
  --bg-1: #fffbeb;
  --bg-2: #ffecc2;
  --blob-1: rgba(255, 87, 34, 0.20);
  --blob-2: rgba(255, 214, 10, 0.30);
  --accent: #ff5722;
  --accent-dark: #dc3f0e;
  --accent-2: #ffd60a;
  --accent-soft: #fff1eb;
  --pill-bg: #fef08a;
  --pill-ink: #7c2d12;
}

:root {
  --surface: #ffffff;
  --ink: #181512;
  --ink-muted: #524b45;
  --ink-subtle: #78716c;
  --border: #181512;
  --border-soft: rgba(24, 21, 18, 0.14);
  --sage: #00b884;
  --sage-soft: #e6fbf3;
  --danger: #e11d48;
  --danger-soft: #ffe4e6;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 15px;
  --shadow-toy: 0 6px 0 #181512;
  --shadow-toy-sm: 0 4px 0 #181512;
  --font-display: ui-rounded, 'SF Pro Rounded', 'Hiragino Maru Gothic ProN', 'Quicksand', system-ui, sans-serif;
  --font-sans: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  scroll-behavior: smooth;
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 88% 8%, var(--blob-1), transparent 34%),
    radial-gradient(circle at 12% 28%, var(--blob-2), transparent 36%),
    linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  transition: background 0.35s ease;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }

.container {
  width: min(100% - 1.75rem, 960px);
  margin-inline: auto;
}

.hidden { display: none !important; }

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Confetti overlay */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99;
}

/* Compact playful single-row navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 2px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  border: 2px solid var(--border);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  box-shadow: 0 2px 0 var(--border);
  transform: rotate(-5deg);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  padding: 0.38rem 0.76rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink-muted);
  white-space: nowrap;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}

.nav-links a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
}

.nav-links a[aria-current="page"] {
  background: var(--pill-bg);
  color: var(--ink);
  border-color: var(--border);
  box-shadow: 0 2px 0 var(--border);
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--pill-bg);
  color: var(--ink);
  font-weight: 900;
  font-size: 0.86rem;
  box-shadow: 0 2px 0 var(--border);
  cursor: pointer;
}

.mobile-nav-popover {
  margin: 0;
  padding: 0.85rem;
  border: 2.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-toy);
  width: min(calc(100vw - 2rem), 300px);
  position: fixed;
  inset: 66px 1rem auto auto;
}

.mobile-nav-popover::backdrop {
  background: rgba(24, 21, 18, 0.25);
  backdrop-filter: blur(2px);
}

.mobile-nav-list {
  display: grid;
  gap: 0.45rem;
}

.mobile-nav-list a {
  display: block;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  font-weight: 800;
  font-size: 0.95rem;
}

.mobile-nav-list a:hover,
.mobile-nav-list a[aria-current="page"] {
  background: var(--pill-bg);
  border-color: var(--border);
}

@supports not selector(:popover-open) {
  .mobile-nav-popover:not(.is-open) { display: none; }
}

@media (max-width: 680px) {
  .site-header { position: static; }
  .nav-inner { min-height: 48px; }
  .nav-links { display: none; }
  .mobile-menu-btn { display: inline-flex; padding: 0.3rem 0.72rem; font-size: 0.82rem; }
  .mobile-nav-popover { inset: 56px 0.85rem auto auto; }
}

main {
  flex: 1;
  padding: 1.35rem 0 3.5rem;
  position: relative;
}

/* Floating ambient stickers (pure CSS, gentle bob) */
.stage-wrap {
  position: relative;
  max-width: 580px;
  margin: 0 auto;
}

.float-sticker {
  position: absolute;
  font-size: 1.85rem;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 4px 0 rgba(24, 21, 18, 0.14));
  z-index: 0;
  will-change: transform;
}
.float-sticker.s1 { top: -6px; left: -34px; animation: gentleFloatA 8.5s ease-in-out infinite; }
.float-sticker.s2 { top: 48px; right: -32px; animation: gentleFloatB 9.8s ease-in-out infinite; }
.float-sticker.s3 { bottom: 36px; left: -28px; animation: gentleFloatC 10.6s ease-in-out infinite; }

@media (max-width: 680px) {
  .float-sticker { display: none; }
}

@keyframes gentleFloatA {
  0%, 100% { transform: translateY(0px) rotate(-11deg); }
  50% { transform: translateY(-7px) rotate(-8deg); }
}
@keyframes gentleFloatB {
  0%, 100% { transform: translateY(0px) rotate(13deg); }
  50% { transform: translateY(-6px) rotate(10deg); }
}
@keyframes gentleFloatC {
  0%, 100% { transform: translateY(0px) rotate(7deg); }
  50% { transform: translateY(-7px) rotate(10deg); }
}
@keyframes softBreath {
  0%, 100% { transform: translateY(0px) rotate(-2deg); }
  50% { transform: translateY(-4px) rotate(1deg); }
}

@keyframes cardPop {
  0% { opacity: 0; transform: translateY(14px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes avatarPop {
  0% { transform: scale(0.75) rotate(-10deg); }
  60% { transform: scale(1.14) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* Compact Hero Headline */
.hero-mini {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 1.1rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.26rem 0.85rem;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-ink);
  border: 2px solid var(--border);
  box-shadow: 0 2px 0 var(--border);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  margin-bottom: 0.6rem;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.55rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
}

.lead {
  color: var(--ink-muted);
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0 auto;
  max-width: 46ch;
}

/* Tactile Toy Cards */
.card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 2.5px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-toy);
  padding: 1.5rem;
  animation: cardPop 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-soft {
  background: var(--accent-soft);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.05rem;
}

/* Live Persona Preview Banner inside Start Card */
.persona-banner {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1.05rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: linear-gradient(135deg, var(--accent-soft), var(--pill-bg));
  margin-bottom: 1.15rem;
}

.persona-avatar {
  flex: 0 0 60px;
  height: 60px;
  border-radius: 18px;
  border: 2.5px solid var(--border);
  background: #fff;
  box-shadow: 0 3px 0 var(--border);
  display: grid;
  place-items: center;
  font-size: 2rem;
  animation: softBreath 5.5s ease-in-out infinite;
}

.persona-avatar.pop { animation: avatarPop 0.32s ease, softBreath 5.5s ease-in-out 0.35s infinite; }

.persona-meta { min-width: 0; flex: 1; }
.persona-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.persona-tag {
  display: inline-block;
  margin-top: 0.22rem;
  padding: 0.14rem 0.6rem;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--border);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
}

/* Avatar Strip */
.picker-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-bottom: 0.45rem;
}

.avatar-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.4rem;
  margin-bottom: 1rem;
}
@media (max-width: 460px) {
  .avatar-strip { grid-template-columns: repeat(4, 1fr); }
}

.avatar-btn {
  height: 46px;
  border-radius: 14px;
  border: 2px solid var(--border-soft);
  background: #fff;
  font-size: 1.45rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.avatar-btn:hover { transform: translateY(-2px); border-color: var(--border); }
.avatar-btn.active {
  border-color: var(--border);
  background: var(--pill-bg);
  box-shadow: 0 3px 0 var(--border);
  transform: translateY(-2px) scale(1.04);
}

/* Theme Swatches — 4-col on desktop, 2x2 crisp grid on iPhone SE / narrow phones */
.theme-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.5rem 0.5rem;
  border-radius: 999px;
  border: 2px solid var(--border-soft);
  background: #fff;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.12s ease;
}

.draft-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--pill-bg);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 800;
}
.draft-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.theme-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
}
.theme-btn:hover { border-color: var(--border); }
.theme-btn.active {
  border-color: var(--border);
  background: var(--accent-soft);
  box-shadow: 0 3px 0 var(--border);
  transform: translateY(-1px);
}

/* Vibe Tag Chips */
.vibe-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.vibe-chip {
  padding: 0.35rem 0.72rem;
  border-radius: 999px;
  border: 1.5px solid var(--border-soft);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}
.vibe-chip:hover { border-color: var(--border); }
.vibe-chip.active {
  border-color: var(--border);
  background: var(--ink);
  color: #fff;
}

/* Inputs */
.field { margin-bottom: 0.95rem; }
.field label { display: block; font-weight: 800; font-size: 0.9rem; margin-bottom: 0.25rem; }
.hint { display: block; color: var(--ink-subtle); font-size: 0.82rem; margin-bottom: 0.3rem; }

.input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 2.5px solid var(--border);
  background: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  transition: box-shadow 0.14s ease, transform 0.14s ease;
}
.input:focus {
  outline: none;
  box-shadow: 0 4px 0 var(--accent);
}
.input:user-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.error-msg { display: none; color: var(--danger); font-size: 0.84rem; font-weight: 700; margin-top: 0.3rem; }
.input:user-invalid + .error-msg { display: block; }

/* Chunky 3D Toy Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  border: 2.5px solid var(--border);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-toy-sm);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--border); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-outline { background: #fff; color: var(--ink); }
.btn-sage { background: var(--sage); color: #fff; }
.btn-sm { padding: 0.48rem 0.9rem; font-size: 0.85rem; box-shadow: 0 3px 0 var(--border); }

/* IG Story Segmented Progress Bar */
.story-bars {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  margin-bottom: 1rem;
}

.story-seg {
  height: 7px;
  border-radius: 999px;
  background: rgba(24, 21, 18, 0.12);
  overflow: hidden;
  transition: background 0.2s ease, transform 0.2s ease;
}
.story-seg.done { background: var(--accent); }
.story-seg.current { background: var(--accent-2); transform: scaleY(1.25); }

/* Deck Top Bar */
.deck-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.95rem;
  flex-wrap: wrap;
}

.mini-who {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1.5px solid var(--border);
  font-weight: 800;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pill-select {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.icon-btn {
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.12s ease;
}
.icon-btn:hover { background: var(--pill-bg); transform: translateY(-1px); }

/* Single Question Deck Stage */
.deck-card-inner {
  text-align: center;
  animation: cardPop 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.q-emoji-badge {
  display: inline-grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 22px;
  border: 2.5px solid var(--border);
  background: var(--pill-bg);
  box-shadow: 0 4px 0 var(--border);
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
  animation: softBreath 5.2s ease-in-out infinite;
}

.deck-q-title {
  font-family: var(--font-display);
  font-size: clamp(1.28rem, 3.8vw, 1.62rem);
  font-weight: 900;
  line-height: 1.22;
  margin: 0 0 1.15rem;
  letter-spacing: -0.02em;
}

.opt-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  text-align: left;
}

.opt-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  padding: 0.88rem 1rem;
  border-radius: var(--radius-md);
  border: 2.5px solid var(--border);
  background: #fff;
  box-shadow: 0 4px 0 var(--border);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.98rem;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.14s ease;
}
.opt-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.opt-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--border);
}
.opt-btn.selected {
  background: var(--accent);
  color: #fff;
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--border);
}

.opt-letter {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: var(--pill-bg);
  color: var(--ink);
  border: 2px solid var(--border);
  font-size: 0.82rem;
  font-weight: 900;
}
.opt-btn.selected .opt-letter {
  background: #fff;
  color: var(--accent);
}

.deck-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.05rem;
  gap: 0.5rem;
}

/* Inline prompt editor box */
.edit-drawer {
  margin-bottom: 0.9rem;
  padding: 0.8rem;
  border-radius: var(--radius-md);
  border: 2px dashed var(--border);
  background: var(--accent-soft);
  text-align: left;
}

/* Share Ready & Result */
.share-box { display: grid; gap: 1rem; text-align: center; }
.url-copy-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.url-copy-row input { flex: 1 1 220px; font-size: 0.95rem; }
.share-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.55rem; }

.play-shell { max-width: 580px; margin: 0 auto; }

.banter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  margin-top: 0.7rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  font-weight: 800;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.banter-banner.is-idle {
  opacity: 0;
  pointer-events: none;
  border-color: transparent;
  background: transparent;
}
.banter-banner.good {
  opacity: 1;
  background: var(--pill-bg);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--border);
}
.banter-skip {
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--ink-muted);
  white-space: nowrap;
}

.score-hero {
  text-align: center;
  padding: 1.45rem 1rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--accent-soft), var(--pill-bg));
  border: 2.5px solid var(--border);
  box-shadow: 0 4px 0 var(--border);
  margin-bottom: 1.2rem;
}
.score-big {
  font-family: var(--font-display);
  font-size: clamp(3.3rem, 12vw, 4.8rem);
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  text-shadow: 3px 3px 0 var(--border);
  margin: 0.35rem 0 0.5rem;
}
.badge-pill {
  display: inline-block;
  padding: 0.38rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  font-size: 0.95rem;
}

.leaderboard { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.55rem; }
.leaderboard li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.72rem 0.95rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: #fff;
  box-shadow: 0 3px 0 rgba(24, 21, 18, 0.12);
}
.leaderboard li.highlight {
  background: var(--accent-soft);
  box-shadow: 0 3px 0 var(--accent);
}
.lb-rank { font-weight: 900; color: var(--accent); min-width: 2rem; font-size: 1.02rem; flex: 0 0 auto; }
.lb-main { flex: 1 1 0; min-width: 0; }
.lb-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-note { font-size: 0.85rem; color: var(--ink-muted); margin-top: 0.15rem; overflow-wrap: anywhere; }
.lb-score { font-weight: 900; font-size: 1.04rem; white-space: nowrap; flex: 0 0 auto; }

/* Questions Library */
.qbank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 0.85rem; margin-top: 1rem; }
.qbank-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: #fff;
  box-shadow: 0 4px 0 rgba(24, 21, 18, 0.12);
}
.qbank-item.picked { background: var(--sage-soft); box-shadow: 0 4px 0 var(--sage); }

.floating-tray {
  position: sticky;
  bottom: 1rem;
  z-index: 15;
  margin-top: 1.5rem;
  padding: 0.85rem 1.15rem;
  border-radius: 999px;
  border: 2.5px solid var(--border);
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 10px 26px rgba(24, 21, 18, 0.25);
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1.2rem; }
.stat-card {
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: #fff;
  box-shadow: 0 4px 0 var(--border);
  text-align: center;
}
.stat-card strong { display: block; font-family: var(--font-display); font-size: 1.85rem; font-weight: 900; line-height: 1.1; }
.stat-card span { font-size: 0.82rem; color: var(--ink-muted); font-weight: 800; }

.bar-row { margin-bottom: 0.75rem; }
.bar-meta { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.88rem; font-weight: 700; margin-bottom: 0.25rem; }
.bar-bg { height: 10px; border-radius: 999px; background: rgba(24, 21, 18, 0.1); overflow: hidden; border: 1.5px solid var(--border); }
.bar-fill { height: 100%; background: var(--accent); }

/* Collapsed quiet secondary SEO & FAQ below the playground */
.seo-section {
  max-width: 720px;
  margin: 3rem auto 0;
  display: grid;
  gap: 0.75rem;
}

details.faq {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  padding: 0.82rem 1.05rem;
}
details.faq summary { cursor: pointer; font-weight: 800; font-size: 0.94rem; }
details.faq p { margin: 0.55rem 0 0; color: var(--ink-muted); font-size: 0.9rem; }

.status-banner { margin-top: 0.75rem; padding: 0.7rem 0.95rem; border-radius: var(--radius-md); border: 2px solid var(--border); font-size: 0.9rem; font-weight: 800; }
.status-banner.ok { background: var(--sage-soft); color: #065f46; }
.status-banner.err { background: var(--danger-soft); color: #9f1239; }

.saved-list { display: grid; gap: 0.5rem; margin-top: 0.6rem; }
.saved-item {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.6rem 0.78rem;
  border-radius: var(--radius-md);
  background: #fff;
  border: 2px solid var(--border);
  font-size: 0.88rem;
}
.saved-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 0;
  min-width: 0;
}
.saved-avatar {
  flex: 0 0 auto;
  font-size: 1.25rem;
  line-height: 1;
}
.saved-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.saved-name {
  font-size: 0.94rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-sub {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-subtle);
  margin-top: 0.1rem;
}
.saved-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}
.saved-actions .btn-sm {
  white-space: nowrap;
  padding: 0.38rem 0.72rem;
}

.site-footer {
  border-top: 2px solid var(--border);
  background: rgba(255, 255, 255, 0.68);
  padding: 1.35rem 0;
  font-size: 0.84rem;
  color: var(--ink-muted);
  font-weight: 600;
}
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

/* Hide marketing hero during active deck & share-ready stages */
body.hide-hero .hero-mini {
  display: none !important;
}

/* Focused 10-Tap Deck Mode: hides non-essential chrome so 1 full question fits inside 1 mobile screen */
body.focus-mode .hero-mini,
body.focus-mode .seo-section,
body.focus-mode #my-saved-quizzes {
  display: none !important;
}

body.focus-mode main {
  padding-top: 1rem;
  padding-bottom: 1.5rem;
}

@media (max-width: 680px) {
  main {
    padding: 0.65rem 0 1.75rem;
  }
  .hero-mini {
    margin-bottom: 0.75rem;
  }
  body.focus-mode .site-header,
  body.focus-mode .site-footer {
    display: none !important;
  }
  body.focus-mode main {
    padding: 0.55rem 0 0.85rem;
  }
  body.focus-mode .card {
    padding: 0.9rem 0.9rem 0.85rem;
  }
  body.focus-mode .story-bars {
    margin-bottom: 0.65rem;
  }
  body.focus-mode .deck-top {
    margin-bottom: 0.6rem;
  }
  body.focus-mode .q-emoji-badge {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    font-size: 1.6rem;
    margin-bottom: 0.45rem;
  }
  body.focus-mode .deck-q-title {
    font-size: 1.15rem;
    margin-bottom: 0.8rem;
  }
  body.focus-mode .opt-grid {
    gap: 0.48rem;
  }
  body.focus-mode .opt-btn {
    padding: 0.7rem 0.85rem;
    font-size: 0.92rem;
    box-shadow: 0 3px 0 var(--border);
  }
  body.focus-mode .deck-foot {
    margin-top: 0.75rem;
  }
}

/* Single-screen mobile layout optimization (iPhone SE 375x667 and standard phones) */
@media (max-width: 540px) {
  .container { width: min(100% - 1rem, 960px); }
  main { padding: 0.5rem 0 1.5rem; }
  .hero-mini { margin-bottom: 0.55rem; }
  .eyebrow { font-size: 0.72rem; padding: 0.2rem 0.62rem; margin-bottom: 0.35rem; }
  .hero-mini h1 { font-size: 1.38rem; line-height: 1.14; margin-bottom: 0.25rem; }
  .hero-mini .lead { display: none; }
  .card { padding: 0.9rem; border-radius: 20px; }
  .draft-banner { padding: 0.5rem 0.7rem; margin-bottom: 0.6rem; font-size: 0.8rem; }
  .persona-banner { padding: 0.55rem 0.72rem; gap: 0.65rem; margin-bottom: 0.7rem; }
  .persona-avatar { flex: 0 0 44px; height: 44px; border-radius: 14px; font-size: 1.5rem; }
  .persona-title { font-size: 1.04rem; }
  .persona-tag { font-size: 0.72rem; padding: 0.1rem 0.5rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .field { margin-bottom: 0.6rem; }
  .field label { font-size: 0.84rem; margin-bottom: 0.2rem; }
  .input { padding: 0.62rem 0.85rem; font-size: 0.96rem; }
  .picker-label { font-size: 0.72rem; margin-bottom: 0.28rem; }
  .avatar-strip { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0.24rem; margin-bottom: 0.62rem; }
  .avatar-btn { height: 38px; border-radius: 10px; font-size: 1.12rem; }
  .theme-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.36rem; margin-bottom: 0.62rem; }
  .theme-btn { padding: 0.38rem 0.45rem; font-size: 0.8rem; }
  .vibe-strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 0.35rem; margin-bottom: 0.75rem; padding-bottom: 2px; }
  .vibe-strip::-webkit-scrollbar { display: none; }
  .vibe-chip { flex: 0 0 auto; white-space: nowrap; padding: 0.3rem 0.65rem; font-size: 0.78rem; }
  .btn { padding: 0.72rem 1.1rem; font-size: 0.94rem; }
  .btn-sm { padding: 0.42rem 0.78rem; font-size: 0.82rem; }
  .deck-top { gap: 0.4rem; }
  .deck-tools { width: 100%; }
  .pill-select { max-width: 100%; }
  .url-copy-row { flex-direction: column; gap: 0.4rem; }
  .url-copy-row input,
  .url-copy-row button { width: 100%; flex: none; }
  .share-box { gap: 0.6rem; }
  .share-box h2 { font-size: 1.32rem !important; }
  .share-actions { gap: 0.4rem; }
  #play-intro .q-emoji-badge { width: 52px; height: 52px; font-size: 1.7rem; margin-bottom: 0.45rem !important; }
  #play-quiz-title { font-size: 1.55rem !important; margin-bottom: 0.2rem !important; }
  .score-hero { padding: 0.85rem 0.75rem; margin-bottom: 0.65rem; }
  #res-avatar { font-size: 1.9rem !important; margin-bottom: 0.15rem !important; }
  .score-big { font-size: clamp(2.55rem, 10.5vw, 3.8rem); margin: 0.2rem 0 0.3rem; }
  .badge-pill { padding: 0.28rem 0.85rem; font-size: 0.86rem; }
  #res-roast { margin-top: 0.45rem !important; font-size: 0.88rem; }
  #play-result .share-actions { margin-bottom: 0.75rem !important; }
  .leaderboard { gap: 0.4rem; margin-top: 0.45rem; }
  .leaderboard li { padding: 0.55rem 0.8rem; font-size: 0.9rem; }
  .qbank-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
