/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Palette ── */
:root {
  --bg:      #f7f4ef;   /* warm cream */
  --surface: #ffffff;
  --surface2:#f0ece5;   /* tinted card bg */
  --text:    #28292a;
  --muted:   #6b7280;
  --border:  #e5e7eb;
  --accent:  #ff6183;   /* tavus pink */
  --accent-lt: rgba(255,97,131,.08);
  --green:   #22c55e;   /* correct answer only */
  --dark:    #140206;   /* code box / share card */
}

/* ── Body / Layout ── */
body {
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  direction: rtl;
}
#app { width: 100%; max-width: 480px; }
.view { display: none; }

/* ── Card ── */
.card {
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 4px 24px rgba(20,2,6,.10);
}

/* ── Home screen ── */
.game-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
}
.subtitle { color: var(--text); opacity: .7; text-align: center; margin-bottom: 24px; font-size: 1.1rem; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.home-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  font-size: .95rem;
  transition: all .2s;
}
.home-card:hover { border-color: var(--accent); background: var(--accent-lt); transform: translateY(-2px); }
.home-card.home-card-full { grid-column: 1 / -1; }
.icon { font-size: 2.5rem; margin-bottom: 8px; }

/* ── Typography helpers ── */
h2 { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: 20px; }
.hint { color: var(--muted); font-size: .9rem; margin-bottom: 16px; line-height: 1.6; }
.label-sm { color: var(--text); font-weight: 600; font-size: .9rem; margin-bottom: 6px; display: block; }
.section-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.sep { height: 1px; background: var(--border); margin: 16px 0; }
.msg-box { text-align: center; }
.emoji-big { font-size: 4rem; margin-bottom: 12px; display: block; }

/* ── Form elements ── */
.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 600; color: var(--text); margin-bottom: 6px; font-size: .95rem; }
input[type="text"], textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  direction: rtl;
  transition: border-color .2s;
  background: var(--surface);
  color: var(--text);
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
.code-input { text-align: center; letter-spacing: 6px; font-size: 1.5rem; font-weight: 700; text-transform: uppercase; }

/* ── Radio buttons ── */
.radio-group { display: flex; gap: 12px; }
.radio-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all .2s;
  color: var(--text);
}
.radio-option:has(input:checked) { border-color: var(--accent); background: var(--accent-lt); }
.radio-option input { display: none; }

/* ── Role grid (family mode — 10 roles, 5×2) ── */
.radio-group-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.radio-group-grid .radio-option {
  flex-direction: column;
  gap: 4px;
  padding: 10px 4px;
  font-size: 0.82rem;
  border-radius: 10px;
  line-height: 1.2;
}

/* ── Emoji picker ── */
.emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.emoji-opt {
  font-size: 1.5rem;
  width: 42px;
  height: 42px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.emoji-opt:hover { border-color: var(--accent); background: var(--accent-lt); }
.emoji-opt.selected { border-color: var(--accent); background: var(--accent-lt); box-shadow: 0 0 0 2px rgba(255,97,131,0.2); }

/* ── Buttons ── */
.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  margin-top: 8px;
  display: block;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 20px rgba(255,97,131,.35); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { background: #ffb3c1; box-shadow: none; cursor: not-allowed; filter: none; }
.consent-label { display: flex; align-items: flex-start; gap: 10px; font-size: 0.88rem; color: var(--muted); margin: 12px 0 8px; line-height: 1.5; cursor: pointer; }
.consent-label input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.btn-green { background: var(--accent); color: #fff; box-shadow: 0 4px 20px rgba(255,97,131,.3); font-weight: 800; }
.btn-green:hover { filter: brightness(1.05); }
.btn-share { background: var(--accent); color: #fff; box-shadow: 0 4px 20px rgba(255,97,131,.35); }

/* ── Code display ── */
.code-display {
  background: var(--dark);
  border: 3px solid var(--accent);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin: 12px 0;
}
.code { font-size: 2.5rem; font-weight: 900; color: var(--accent); letter-spacing: 6px; display: block; }
.code-display p { color: rgba(255,255,255,.7); font-size: .85rem; margin-top: 4px; }

/* ── Link / info boxes ── */
.link-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 4px; }
.link-row .link-box { flex: 1; margin-bottom: 0; }
.link-box {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: monospace;
  font-size: .8rem;
  word-break: break-all;
  color: var(--muted);
  margin-bottom: 4px;
}
.btn-copy {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
  font-family: inherit;
}
.btn-copy:hover { background: var(--border); }
.btn-copy:active { transform: scale(.92); }

/* ── Invite preview ── */
.invite-preview {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-line;
  text-align: right;
  margin: 8px 0 4px;
  word-break: break-word;
}
.btn-copy-invite {
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--accent-lt);
  color: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.btn-copy-invite:active { transform: scale(.95); }

/* ── Alerts ── */
.alert-error { background: rgba(234,66,47,.1); color: #b91c1c; padding: 12px; border-radius: 10px; margin-top: 12px; font-size: .9rem; display: none; }
.status-box { padding: 10px 14px; border-radius: 10px; font-weight: 600; text-align: center; margin-bottom: 16px; }
.status-active { background: rgba(34,197,94,.12); color: #166534; }
.status-inactive { background: #fef3c7; color: #92400e; }

/* ── Member chips ── */
.member-chips-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; margin-bottom: 4px; justify-content: center; }
.member-chips-label { font-size: .8rem; color: var(--muted); font-weight: 600; flex-basis: 100%; text-align: center; margin-bottom: 2px; }
.member-chip { display: inline-flex; align-items: center; background: rgba(255,97,131,.12); color: #9f1239; border-radius: 20px; padding: 3px 10px; font-size: .85rem; font-weight: 600; }

/* ── Profile list ── */
.empty-state { text-align: center; color: var(--muted); padding: 24px; }

/* ── Name picker ── */
.name-search {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 1.1rem;
  font-family: inherit;
  direction: rtl;
  text-align: right;
  margin-top: 12px;
  transition: border-color .2s;
  background: var(--surface);
  color: var(--text);
}
.name-search:focus { outline: none; border-color: var(--accent); }
.name-picker-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; text-align: right; max-height: 320px; overflow-y: auto; }
.name-btn {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  background: var(--surface2);
  color: var(--text);
  text-align: right;
}
.name-btn:hover { border-color: var(--accent); background: var(--accent-lt); transform: translateX(-4px); }
.name-btn:active { transform: scale(.97); }
.name-btn-missing {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
}

/* ── Game: score bar ── */
.score-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 14px;
  background: var(--accent-lt);
  border-radius: 12px;
}
.running-score-wrap { display: flex; align-items: center; gap: 6px; }
.score-label { font-size: 1.1rem; }
.running-score-num {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
  display: inline-block;
}
.streak-fire { font-size: 1.2rem; min-width: 40px; text-align: left; }

@keyframes scoreBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.5); color: var(--green); }
  100% { transform: scale(1); }
}
.score-bump { animation: scoreBump 0.35s ease-out; }

/* ── Game: badges ── */
.q-badges { text-align: center; margin-bottom: 8px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.double-badge {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 5px 14px;
  border-radius: 999px;
  animation: pulse 1s ease-in-out infinite;
}
.last-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 5px 14px;
  border-radius: 999px;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ── Game: progress ── */
.progress-wrap { background: var(--border); border-radius: 999px; height: 8px; margin-bottom: 20px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); border-radius: 999px; transition: width .5s; }
.q-counter { font-size: .85rem; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.q-text { font-size: 1.3rem; font-weight: 700; color: var(--text); margin-bottom: 24px; line-height: 1.5; text-align: center; }

/* ── Game: answer buttons ── */
.answers { display: flex; flex-direction: column; gap: 12px; }
.answer-btn {
  width: 100%;
  padding: 16px 20px;
  border: 3px solid transparent;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-align: right;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.answer-btn:not(:disabled):hover { transform: translateX(-4px); }
.letter {
  background: rgba(0,0,0,.08);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}
.ans-a { background: var(--accent-lt); }
.ans-b { background: rgba(34,197,94,.07); }
.ans-c { background: var(--surface2); }
.ans-correct { background: rgba(34,197,94,.15) !important; border-color: var(--green) !important; }
.ans-wrong   { background: rgba(234,66,47,.1) !important; border-color: #ea4343 !important; }

/* ── Game: feedback ── */
.feedback { text-align: center; font-size: 1.3rem; font-weight: 800; margin-top: 16px; padding: 12px; border-radius: 12px; display: none; }
.feedback-correct { color: #166534; background: rgba(34,197,94,.15); }
.feedback-wrong   { color: #b91c1c; background: rgba(234,66,47,.1); }
.bonus-pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.bonus-pill {
  background: rgba(34,197,94,.15);
  color: #166534;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

/* ── Game: last question ── */
.last-question-card {
  border: 3px solid var(--accent);
  box-shadow: 0 0 24px rgba(255,97,131,0.2);
}

/* ── Lucky wheel overlay ── */
.wheel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 2, 6, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.wheel-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}
.wheel-number {
  font-size: 4.5rem;
  font-weight: 900;
  color: var(--accent);
  margin: 16px 0;
  line-height: 1;
}

/* ── Results ── */
.score-big { text-align: center; font-weight: 900; color: var(--accent); margin: 12px 0; font-size: 4rem; }
.score-unit { font-size: 1.3rem; font-weight: 700; color: var(--muted); }
.stars { text-align: center; font-size: 2.2rem; margin: 8px 0; }
.result-class-info { text-align: center; font-weight: 700; color: var(--text); font-size: 1rem; margin-bottom: 12px; }

/* ── Result title ── */
.result-title-box {
  text-align: center;
  margin: 4px 0 12px;
  padding: 10px 16px;
  background: var(--accent-lt);
  border: 1.5px solid rgba(255,97,131,.25);
  border-radius: 14px;
}
.result-title-emoji { font-size: 1.8rem; display: block; margin-bottom: 4px; }
.result-title-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  display: block;
}

/* ── Social fact ── */
.social-fact {
  background: rgba(34,197,94,.08);
  border: 1.5px solid rgba(34,197,94,.35);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 0.92rem;
  color: #166534;
  text-align: center;
  margin: 4px 0 16px;
  line-height: 1.55;
  font-weight: 600;
  display: none;
}

/* ── Share card ── */
.share-card {
  background: var(--dark);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin: 16px 0;
}
.share-card .btn-share { box-shadow: 0 4px 20px rgba(255,97,131,.3); }
.share-feedback { font-size: .85rem; color: var(--green); margin-top: 8px; font-weight: 600; min-height: 1.2em; }
.parent-share-link { display: block; margin-top: 12px; font-size: .85rem; color: rgba(255,255,255,.6); text-decoration: underline; cursor: pointer; }
.parent-share-link:hover { color: #fff; }

/* ── Leaderboard ── */
.leaderboard-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; margin-bottom: 8px; background: var(--surface2); font-weight: 600; }
.leaderboard-item:nth-child(1) { background: rgba(34,197,94,.15); }
.leaderboard-item:nth-child(2) { background: var(--surface2); }
.leaderboard-item:nth-child(3) { background: var(--accent-lt); }
.rank { font-size: 1.3rem; min-width: 32px; }
.lb-name { flex: 1; }
.lb-score { color: var(--accent); font-weight: 700; }

/* ── Credit ── */
.credit { text-align: center; font-size: .6rem; color: rgba(40,41,42,.38); margin-top: 24px; }
.credit a { color: rgba(40,41,42,.5); text-decoration: underline; }

.influencer-badge {
  background: var(--green);
  color: #fff;
  font-size: .7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  margin-right: 6px;
  display: inline-block;
}

/* ── How-to explainer ── */
.howto-box {
  background: var(--dark);
  border: 1.5px solid rgba(255,97,131,.2);
  border-radius: 14px;
  padding: 16px 18px;
  text-align: right;
}
.howto-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 12px;
  text-align: center;
}
.howto-steps { display: flex; flex-direction: column; gap: 10px; }
.howto-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: rgba(255,255,255,.85);
  line-height: 1.5;
}
.step-num {
  background: var(--accent);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ── Bonus question (Stage 1: full screen) ── */
.bonus-q-card { background: var(--accent-lt); border: 1.5px solid rgba(255,97,131,.3); text-align: center; }
.bonus-q-header { font-size: 1.1rem; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.bonus-q-prompt { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: 4px; line-height: 1.5; }
.bonus-q-subtitle { font-size: 0.82rem; color: var(--muted); margin: 0 0 14px; line-height: 1.4; }
.bonus-q-input { width: 100%; padding: 12px 14px; border: 1.5px solid rgba(255,97,131,.35); border-radius: 10px; font-size: 1rem; font-family: inherit; text-align: right; margin-bottom: 10px; box-sizing: border-box; background: var(--surface); color: var(--text); }
.bonus-q-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,97,131,0.15); }
.bonus-q-btn { width: 100%; }
.bonus-skip { display: block; margin: 12px auto 0; color: var(--muted); font-size: 0.85rem; background: none; border: none; cursor: pointer; text-decoration: underline; font-family: inherit; }

/* ── Bonus question (Stage 2: mini card in results) ── */
.bonus-q-card-mini { background: var(--accent-lt); border: 1.5px solid rgba(255,97,131,.3); border-radius: 14px; padding: 14px; text-align: center; margin: 8px 0 12px; }
.bonus-mini-header { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.bonus-q-prompt-sm { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.bonus-q-done { font-size: 0.92rem; font-weight: 600; color: var(--text); padding: 8px; }
