:root {
  --bg: #0d0f13;
  --bg-2: #14171d;
  --panel: #1a1e26;
  --panel-2: #20242c;
  --ink: #fff;
  --muted: #9aa3ad;
  --green: var(--jn-green, #a0e747);
  --green-dim: rgba(160,231,71,0.14);
  --orange: #ff9d4d;
  --orange-dim: rgba(255,157,77,0.14);
  --red: #ff6b6b;
  --juniora-h: 38px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg); color: var(--ink); font-family: var(--jn-font);
  overflow-x: hidden; height: 100%;
}
body {
  min-height: 100dvh;
  padding-bottom: var(--juniora-h);
  display: flex; flex-direction: column;
  position: relative;
}
button { cursor: pointer; border: none; font-family: var(--jn-font); }
a { color: inherit; text-decoration: none; }

/* ============ BACKGROUND BLOBS ============ */
.blob { position: fixed; border-radius: 50%; filter: blur(80px); opacity: 0.26; z-index: 0; animation: floatBlob 11s ease-in-out infinite; pointer-events: none; }
.blob-1 { width: 340px; height: 340px; background: var(--orange); top: -100px; right: -80px; }
.blob-2 { width: 280px; height: 280px; background: var(--green); bottom: -80px; left: -60px; animation-delay: -4s; }
@keyframes floatBlob { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(16px,-18px) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .blob { animation: none !important; } }

/* ============ SHARED PRIMARY BUTTON ============ */
.btn-primary {
  background: var(--green); color: #10231f; font-weight: 900; font-size: 14.5px;
  padding: 14px 26px; border-radius: 14px; box-shadow: 0 10px 24px rgba(160,231,71,0.26);
  transition: transform .18s ease, box-shadow .18s ease;
}
.btn-primary:hover { transform: translateY(-2px) scale(1.02); }
.btn-primary:active { transform: translateY(0) scale(0.96); }
.btn-primary.full { width: 100%; }
.highlight { color: var(--orange); }
.hero-badge { display: inline-block; background: rgba(255,157,77,0.16); color: var(--orange); font-size: 12.5px; font-weight: 800; padding: 6px 14px; border-radius: 999px; margin-bottom: 14px; }

/* ============ SCREENS ============ */
.screen {
  position: relative; z-index: 2; flex: 1;
  min-height: 100dvh;
  display: none; align-items: center; justify-content: center;
  padding: 90px 18px 40px;
}
.screen.active { display: flex; }

/* ============ INTRO ============ */
.intro-card { max-width: 440px; text-align: center; }
.intro-icons { position: relative; height: 64px; margin-bottom: 6px; }
.ii { position: absolute; font-size: 30px; animation: iiFloat 3.4s ease-in-out infinite; }
.ii.i1 { left: calc(50% - 78px); top: 10px; animation-delay: 0s; }
.ii.i2 { left: calc(50% - 26px); top: -6px; animation-delay: .5s; }
.ii.i3 { left: calc(50% + 26px); top: 6px; animation-delay: 1s; }
.ii.i4 { left: calc(50% + 76px); top: -4px; animation-delay: 1.5s; }
@keyframes iiFloat { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .ii { animation: none !important; } }

.intro-card h1 { font-size: clamp(26px, 6vw, 36px); line-height: 1.4; margin-bottom: 14px; }
.intro-sub { color: var(--muted); font-size: 14.5px; line-height: 2; margin-bottom: 16px; }
.intro-example { font-size: 13.5px; margin-bottom: 26px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ex-need { background: var(--green-dim); color: var(--green); padding: 5px 11px; border-radius: 999px; font-weight: 700; }
.ex-want { background: var(--orange-dim); color: var(--orange); padding: 5px 11px; border-radius: 999px; font-weight: 700; }

.intro-howto { background: var(--panel); border: 1px solid rgba(255,255,255,0.07); border-radius: 16px; padding: 14px 16px; margin-bottom: 24px; text-align: right; }
.howto-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); padding: 5px 0; }
.howto-row span:first-child { font-size: 16px; }

/* ============ TOP BAR ============ */
.topbar[hidden] { display: none; }
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 300; padding-top: env(safe-area-inset-top, 0px); background: rgba(13,15,19,0.85); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,255,255,0.06); }
.topbar-inner { max-width: 480px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.mute-btn { background: var(--panel); width: 36px; height: 36px; border-radius: 10px; font-size: 15px; flex-shrink: 0; }
.progress-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.progress-track { height: 7px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--green), var(--orange)); border-radius: 999px; transition: width .35s cubic-bezier(.2,.8,.2,1); }
.progress-text { font-size: 10.5px; color: var(--muted); }
.score-chip { display: flex; align-items: center; gap: 5px; background: var(--panel); padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; flex-shrink: 0; }

/* ============ GAME SCREEN ============ */
.game-screen { flex-direction: column; gap: 16px; padding-top: 84px; }
.zones { width: 100%; max-width: 420px; display: flex; gap: 10px; }
.zone { flex: 1; border-radius: 16px; padding: 12px 8px; text-align: center; border: 2px dashed rgba(255,255,255,0.12); transition: all .18s ease; }
.zone-emoji { display: block; font-size: 18px; margin-bottom: 2px; }
.zone-label { font-size: 12px; font-weight: 800; color: var(--muted); }
.zone-need { border-color: rgba(160,231,71,0.25); }
.zone-want { border-color: rgba(255,157,77,0.25); }
.zone-need.zone-active { background: var(--green-dim); border-color: var(--green); transform: scale(1.04); }
.zone-need.zone-active .zone-label { color: var(--green); }
.zone-want.zone-active { background: var(--orange-dim); border-color: var(--orange); transform: scale(1.04); }
.zone-want.zone-active .zone-label { color: var(--orange); }
.zone-need.zone-flash-good { animation: flashGood .5s ease; }
.zone-want.zone-flash-good { animation: flashGood .5s ease; }
.zone-flash-bad { animation: flashBad .5s ease; }
@keyframes flashGood { 0% { box-shadow: 0 0 0 0 rgba(160,231,71,0.5); } 100% { box-shadow: 0 0 0 14px rgba(160,231,71,0); } }
@keyframes flashBad { 0%,100% { border-color: var(--red); } }

.stack { position: relative; width: 100%; max-width: 300px; height: 320px; touch-action: none; flex-shrink: 0; }
.card {
  position: absolute; inset: 0; margin: auto; width: 260px; height: 320px;
  background: linear-gradient(160deg, var(--panel), var(--bg-2));
  border: 1px solid rgba(255,255,255,0.08); border-radius: 26px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 20px; text-align: center;
  box-shadow: 0 20px 44px rgba(0,0,0,0.4);
  user-select: none; -webkit-user-select: none;
}
.card.pos-0 { z-index: 30; cursor: grab; }
.card.pos-0:active { cursor: grabbing; }
.card.pos-1 { z-index: 20; transform: translateY(14px) scale(0.94); opacity: 0.75; }
.card.pos-2 { z-index: 10; transform: translateY(26px) scale(0.88); opacity: 0.5; }
.card.entering { animation: cardIn .3s cubic-bezier(.2,.8,.2,1.1); }
@keyframes cardIn { from { transform: translateY(14px) scale(0.9); opacity: 0; } }

.card-emoji { font-size: 66px; line-height: 1; filter: drop-shadow(0 8px 16px rgba(0,0,0,0.35)); }
.card-label { font-size: 16.5px; font-weight: 800; line-height: 1.6; }
.card-stamp {
  position: absolute; top: 24px; font-size: 16px; font-weight: 900; padding: 6px 14px;
  border-radius: 10px; border: 3px solid; opacity: 0; transform: scale(0.7) rotate(-10deg);
  transition: opacity .12s ease;
}
.card-stamp.need-stamp { right: 18px; color: var(--green); border-color: var(--green); }
.card-stamp.want-stamp { left: 18px; color: var(--orange); border-color: var(--orange); }

.card-explain { font-size: 11.5px; color: var(--muted); line-height: 1.8; min-height: 34px; }

.feedback-toast {
  position: relative; width: 100%; max-width: 320px; min-height: 42px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--panel-2); border: 1px solid rgba(255,255,255,0.1); padding: 8px 16px; border-radius: 14px;
  font-size: 12.5px; font-weight: 800; line-height: 1.7; pointer-events: none;
  opacity: 0; transform: scale(0.94); transition: opacity .2s ease, transform .2s ease;
}
.feedback-toast.show { opacity: 1; transform: scale(1); }
.feedback-toast.good { color: var(--green); border-color: rgba(160,231,71,0.4); }
.feedback-toast.bad { color: var(--orange); border-color: rgba(255,157,77,0.4); }

.action-row { display: flex; gap: 12px; width: 100%; max-width: 340px; }
.act-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 14px 10px; border-radius: 16px; font-size: 14px; font-weight: 800;
  background: var(--panel); border: 1px solid rgba(255,255,255,0.08); color: var(--ink);
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.act-btn:active { transform: scale(0.95); }
.act-need { border-color: rgba(160,231,71,0.28); }
.act-need:hover { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.act-want { border-color: rgba(255,157,77,0.28); }
.act-want:hover { border-color: var(--orange); color: var(--orange); background: var(--orange-dim); }
.act-icon { font-size: 16px; }

/* particle burst */
.particle { position: absolute; width: 7px; height: 7px; border-radius: 50%; pointer-events: none; z-index: 60; animation: particleBurst .6s ease-out forwards; }
@keyframes particleBurst {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--px), var(--py)) scale(0.3); opacity: 0; }
}

/* ============ RESULT SCREEN ============ */
.result-card { max-width: 420px; width: 100%; text-align: center; }
.result-emoji { font-size: 58px; margin-bottom: 6px; animation: successPop .5s cubic-bezier(.2,.8,.3,1.4); }
@keyframes successPop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.result-card h2 { font-size: 22px; margin-bottom: 6px; }
.result-score { color: var(--green); font-weight: 900; font-size: 16px; margin-bottom: 10px; }
.result-msg { color: var(--muted); font-size: 13.5px; line-height: 1.9; margin-bottom: 20px; }

.tip-box { background: var(--panel); border: 1px solid rgba(160,231,71,0.2); border-radius: 16px; padding: 16px; text-align: right; margin-bottom: 18px; }
.tip-title { display: block; font-weight: 800; font-size: 13px; margin-bottom: 8px; color: var(--green); }
.tip-box p { font-size: 12.5px; color: var(--muted); line-height: 1.95; }

.review-toggle-btn { background: none; color: var(--muted); font-size: 12.5px; font-weight: 700; padding: 8px; margin-bottom: 6px; }
.review-list[hidden] { display: none; }
.review-list { max-height: 220px; overflow-y: auto; margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; text-align: right; }
.review-item { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 12px; padding: 8px 12px; font-size: 12.5px; }
.review-item .ri-emoji { font-size: 18px; }
.review-item .ri-label { flex: 1; }
.review-item .ri-mark { font-size: 14px; }
.review-item.wrong { border: 1px solid rgba(255,107,107,0.3); }

@media (max-width: 380px) {
  .card { width: 230px; height: 300px; }
  .stack { height: 320px; }
}

/* ============ BRAND BAR ============ */
.juniora-overlay {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center;
  padding: 8px 14px; background: rgba(13, 15, 19, 0.92); backdrop-filter: blur(6px);
  border-top: 1px solid rgba(255, 255, 255, 0.06); z-index: 1000;
}
.juniora-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: #9aa3ad; font-family: var(--jn-font); font-size: 10.5px; font-weight: 600; line-height: 1; opacity: 0.85; }
.juniora-link:hover { opacity: 1; }
.juniora-logo { width: 13px; height: auto; display: block; flex-shrink: 0; }
