:root {
  --bg: #071124;
  --surface: #0e1d38;
  --surface-2: #15284b;
  --border: rgba(0, 243, 255, 0.22);
  --cyan: #00f3ff;
  --green: #00e676;
  --gold: #ffd700;
  --red: #ff3b6b;
  --ink: #f4f8ff;
  --muted: #9bb1d4;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 10%, #102a52 0%, #071124 70%);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 48px;
  padding: 20px 16px;
  padding-top: calc(56px + env(safe-area-inset-top, 0px));
  color: var(--ink);
}

/* Fixed Rotating Header Ad Banner (Zero Popups) */
#fixed-header-ad-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: calc(44px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 22, 42, 0.96);
  border-bottom: 1px solid rgba(0, 243, 255, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
  padding-left: 14px;
  padding-right: 14px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.header-ad-slide {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease-in-out, visibility 0.6s ease-in-out;
  pointer-events: none;
  padding: 0 14px;
  color: #f4f8ff;
}

.header-ad-slide.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ad-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 5px;
  flex-shrink: 0;
}
.ad-badge.sponsor { background: rgba(0, 230, 118, 0.18); color: #00e676; border: 1px solid rgba(0, 230, 118, 0.45); }
.ad-badge.featured { background: rgba(0, 243, 255, 0.18); color: #00f3ff; border: 1px solid rgba(0, 243, 255, 0.45); }
.ad-badge.bonus { background: rgba(255, 215, 0, 0.18); color: #ffd700; border: 1px solid rgba(255, 215, 0, 0.45); }
.ad-badge.event { background: rgba(255, 59, 107, 0.2); color: #ff6b8f; border: 1px solid rgba(255, 59, 107, 0.45); }

.ad-icon { font-size: 15px; line-height: 1; flex-shrink: 0; }
.ad-text { font-size: 12.5px; font-weight: 500; color: #e2ecff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-cta {
  font-size: 12px;
  font-weight: 700;
  color: #00f3ff;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(0, 243, 255, 0.12);
  border: 1px solid rgba(0, 243, 255, 0.35);
}

@media (max-width: 480px) {
  body { padding-top: calc(50px + env(safe-area-inset-top, 0px)); }
  #fixed-header-ad-bar { height: calc(38px + env(safe-area-inset-top, 0px)); padding: 0 8px; }
  .header-ad-slide { gap: 5px; padding: 0 8px; }
  .ad-badge { font-size: 9.5px; padding: 1.5px 5px; }
  .ad-text { font-size: 11px; }
  .ad-cta { font-size: 10.5px; padding: 2px 5px; }
}

@media (max-height: 450px) and (orientation: landscape) {
  body { padding-top: calc(40px + env(safe-area-inset-top, 0px)); }
  #fixed-header-ad-bar { height: calc(32px + env(safe-area-inset-top, 0px)); }
}

/* Desktop Sidebar Intro */
.intro {
  width: 310px;
  padding-top: 12px;
}
.intro .mark { font-size: 54px; line-height: 1; }
.intro h1 { font-size: 40px; line-height: 1.08; margin: 16px 0; color: #fff; }
.intro h1 span { color: var(--cyan); }
.intro > p { color: var(--muted); font-size: 16px; line-height: 1.55; }
.rule { display: flex; gap: 14px; align-items: center; margin: 18px 0; }
.rule > span {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--cyan); color: var(--cyan);
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.rule p { margin: 0; font-size: 14px; line-height: 1.45; }
.rule strong { color: var(--muted); font-weight: 400; font-size: 13px; display: block; }

@media (max-width: 900px) {
  .intro { display: none; }
}

/* Main Mini App Card */
.app {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.brand img {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid rgba(0, 243, 255, 0.4);
  object-fit: cover;
}
.brand small {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--cyan);
}
.brand .player-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
}
.brand .player-avatar,
.brand .player-avatar-fallback {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 243, 255, 0.65);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.18);
}
.brand .player-avatar { object-fit: cover; }
.brand .player-avatar-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(0, 243, 255, 0.32), rgba(0, 230, 118, 0.28));
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
}
.brand .player-avatar[hidden],
.brand .player-avatar-fallback[hidden] { display: none; }
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink);
  font-weight: 700; cursor: pointer; display: grid; place-items: center;
}

/* Nav Tabs */
nav {
  display: flex;
  gap: 6px;
  margin: 14px 0;
  background: rgba(7, 17, 36, 0.65);
  padding: 4px;
  border-radius: 12px;
}
.tab {
  flex: 1; padding: 9px 6px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font-weight: 700; font-size: 12.5px; cursor: pointer;
}
.tab.selected {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.22), rgba(0, 230, 118, 0.2));
  color: #fff;
  border: 1px solid rgba(0, 243, 255, 0.4);
}

/* Top Stats & Mission Bar */
.scoreline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.label { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); }
.scoreline strong { font-size: 28px; color: var(--gold); font-variant-numeric: tabular-nums; }
.best { text-align: right; }
.best strong { font-size: 20px; color: var(--cyan); }

.mission-bar {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0, 243, 255, 0.09);
  border: 1px solid rgba(0, 243, 255, 0.25);
  border-radius: 12px;
  padding: 9px 12px;
  margin-bottom: 14px;
  font-size: 12px;
}
.mission-bar .m-title { flex: 1; font-weight: 600; color: #e2f6ff; }
.mission-bar .m-prog { font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }

/* Setup / Lobby Card */
.card-box {
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px;
}
.field-label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--cyan); margin-bottom: 6px; letter-spacing: 0.04em;
}
.pill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.pill-grid.diff { grid-template-columns: repeat(4, 1fr); }
.pill-btn {
  padding: 9px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(7, 17, 36, 0.55);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.pill-btn.active {
  border-color: var(--cyan);
  background: rgba(0, 243, 255, 0.16);
  color: #fff;
}

.primary-btn {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, #00e676, #00f3ff);
  color: #04121f;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.secondary-btn {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(7, 17, 36, 0.7);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

/* Active Quiz UI (Timer + Question + Options) */
.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.q-meta { font-size: 12px; font-weight: 700; color: var(--cyan); }
.streak-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255, 215, 0, 0.18);
  color: var(--gold);
  font-size: 11px;
}

/* Circular SVG Timer (inspired by Video Quiz Maker Theme) */
.qm-timer { position: relative; width: 48px; height: 48px; flex: 0 0 auto; }
.qm-timer svg { width: 48px; height: 48px; transform: rotate(-90deg); }
.qm-timer circle.track { fill: none; stroke: rgba(255, 255, 255, 0.12); stroke-width: 5; }
.qm-timer circle.ring { fill: none; stroke: var(--cyan); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear, stroke 0.2s; }
.qm-timer b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 800; color: #fff; }

.question-text {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  margin: 4px 0 14px;
  color: #fff;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.opt-btn {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(7, 17, 36, 0.72);
  color: #f4f8ff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.opt-btn:hover:not(:disabled) { border-color: var(--cyan); background: rgba(0, 243, 255, 0.1); }
.opt-btn.correct { background: rgba(0, 230, 118, 0.25); border-color: var(--green); color: #fff; }
.opt-btn.wrong { background: rgba(255, 59, 107, 0.25); border-color: var(--red); color: #fff; }
.opt-btn.eliminated { opacity: 0.28; pointer-events: none; text-decoration: line-through; }

.booster-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.booster-row button {
  flex: 1;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 0, 0.35);
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.booster-row button:disabled { opacity: 0.4; cursor: default; }

.exp-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 243, 255, 0.1);
  border-left: 3px solid var(--cyan);
  font-size: 12px;
  line-height: 1.45;
  color: #dbeeff;
}

/* Armory / Records / Result Cards */
.product-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.product-row:last-child { border-bottom: 0; }
.product-row h4 { margin: 0 0 3px; font-size: 14px; color: #fff; }
.product-row p { margin: 0; font-size: 11.5px; color: var(--muted); }
.buy-btn {
  padding: 8px 12px; border-radius: 9px; border: 0;
  background: var(--cyan); color: #04121f;
  font-weight: 800; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.buy-btn.gold { background: var(--gold); }

.record-row {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08); font-size: 13px;
}
.record-row strong { color: var(--cyan); }

/* Dialog Modal */
dialog {
  border: 1px solid var(--cyan);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  max-width: 420px;
  width: calc(100% - 24px);
  padding: 20px;
  margin-top: calc(54px + env(safe-area-inset-top, 0px));
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
}
dialog::backdrop { background: rgba(4, 9, 20, 0.78); backdrop-filter: blur(4px); }
.close-dlg { float: right; background: transparent; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }

/* Non-blocking In-Flow Toast Banner */
.toast-banner {
  margin-bottom: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(0, 243, 255, 0.14);
  border: 1px solid var(--cyan);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.35;
}
.toast-banner.warn {
  background: rgba(255, 215, 0, 0.14);
  border-color: var(--gold);
  color: var(--gold);
}

.full-btn {
  width: 100%;
  padding: 12px 14px;
  font-size: 13.5px;
  border-radius: 12px;
  white-space: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  align-items: stretch;
}
.buy-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* 7-Day Login Streak Card */
.streak-card {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(7, 17, 36, 0.58);
  border: 1px solid rgba(255, 215, 0, 0.28);
}
.streak-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.04em;
}
.streak-head strong {
  color: var(--cyan);
  font-size: 11px;
}
.streak-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.streak-day {
  padding: 6px 2px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 29, 56, 0.72);
  text-align: center;
  font-size: 9.5px;
  line-height: 1.25;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
}
.streak-day b {
  display: block;
  font-size: 10px;
  color: var(--ink);
  margin-bottom: 2px;
}
.streak-day.claimed {
  border-color: var(--green);
  background: rgba(0, 230, 118, 0.16);
  color: var(--green);
}
.streak-day.today {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.16);
  color: var(--gold);
}
.streak-day.missed {
  border-color: var(--red);
  background: rgba(255, 59, 107, 0.16);
  color: var(--red);
}
.streak-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.streak-actions .buy-btn {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  padding: 8px 10px;
  font-size: 11.5px;
}

/* Cross-App Promotion Strip (In-Flow, Zero Fixed Overlays) */
.cross-promo-strip {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}
.cross-promo-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}
.cross-promo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.promo-link {
  display: block;
  text-decoration: none;
  text-align: center;
  font-size: 11.5px;
  padding: 9px 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Daily Missions & Theme Selector in Armory */
.sub-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.sub-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--cyan);
  letter-spacing: 0.04em;
}
.daily-missions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.daily-mission-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(7, 17, 36, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
}
.daily-mission-item.done {
  border-color: rgba(0, 230, 118, 0.45);
  background: rgba(0, 230, 118, 0.1);
}
.daily-mission-item small {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
}
.daily-mission-prog {
  font-weight: 800;
  color: var(--gold);
  white-space: nowrap;
}
.daily-mission-item.done .daily-mission-prog {
  color: var(--green);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.theme-card {
  padding: 10px 8px;
  border-radius: 10px;
  background: rgba(7, 17, 36, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.theme-card.active {
  border-color: var(--cyan);
  background: rgba(0, 243, 255, 0.12);
}
.theme-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.theme-card-meta {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.3;
}
.theme-btn {
  width: 100%;
  padding: 7px 6px;
  font-size: 11px;
  white-space: normal;
}

/* Unlockable / 24h Ad-Trial Pitch & Jersey Themes */
body[data-theme="emerald_pitch"] {
  --bg: #041c13;
  --surface: #0a2b1e;
  --surface-2: #103a2a;
  --border: rgba(0, 230, 118, 0.28);
  --cyan: #2cf59b;
  background: repeating-linear-gradient(
      90deg,
      rgba(0, 230, 118, 0.04) 0px,
      rgba(0, 230, 118, 0.04) 24px,
      transparent 24px,
      transparent 48px
    ),
    radial-gradient(circle at 50% 10%, #114732 0%, #041c13 70%);
}
body[data-theme="gold_trophy"] {
  --bg: #171206;
  --surface: #251d0b;
  --surface-2: #33280f;
  --border: rgba(255, 215, 0, 0.32);
  --cyan: #ffd700;
  background: radial-gradient(circle at 50% 10%, #443310 0%, #171206 70%);
}
body[data-theme="crimson_derby"] {
  --bg: #1c0810;
  --surface: #2b0f1b;
  --surface-2: #3b1526;
  --border: rgba(255, 77, 121, 0.32);
  --cyan: #ff6b9d;
  background: radial-gradient(circle at 50% 10%, #4b152b 0%, #1c0810 70%);
}

@media (max-width: 360px) {
  .app { padding: 14px; }
  .card-box { padding: 11px; }
  .streak-day { font-size: 8.5px; padding: 5px 1px; }
  .streak-day b { font-size: 9px; }
}
.friend-challenge {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 5px 12px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: rgba(255, 215, 0, .1);
  color: var(--gold);
  font-size: .85rem;
}

.friend-challenge[hidden],
.challenge-copy-link[hidden] {
  display: none;
}

.match-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 8px;
}

.match-actions button {
  min-width: 0;
  min-height: 52px;
  padding-inline: 7px;
}

.match-actions small {
  display: block;
  margin-top: 3px;
  font-size: .72rem;
  font-weight: 600;
}

.challenge-result {
  color: var(--gold);
}

#btn-copy-challenge,
.challenge-copy-link {
  width: 100%;
  margin-top: 8px;
}

.challenge-share-panel {
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid rgba(0, 243, 255, 0.24);
  border-radius: 14px;
  background: linear-gradient(125deg, rgba(8, 24, 49, 0.96), rgba(17, 39, 70, 0.9));
  text-align: center;
}

.challenge-share-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.challenge-share-heading span:first-child,
.challenge-share-heading span:last-child { color: var(--cyan); }

.challenge-share-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.challenge-share-btn,
.challenge-copy-btn {
  min-width: 0;
  min-height: 40px;
  padding: 7px 4px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.challenge-share-btn--whatsapp { background: #168d52; }
.challenge-share-btn--telegram { background: #147ead; }
.challenge-share-btn--x { background: #111827; border: 1px solid #52617a; }

.challenge-copy-btn {
  margin: 6px auto 0;
  padding-inline: 16px;
  background: linear-gradient(110deg, #08a7c6, #d92e73);
}

#btn-copy-challenge {
  width: auto;
  margin: 6px auto 0;
}

.challenge-share-feedback {
  min-height: 0;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.challenge-share-feedback:empty { display: none; }
.stats-share-panel { margin-top: 16px; }

.challenge-copy-link {
  padding: 8px;
  border: 1px solid var(--cyan);
  border-radius: 8px;
  background: #0a1529;
  color: #fff;
}

/* Match-day UI refresh: clearer hierarchy, calmer surfaces, and stronger touch targets. */
.app {
  background: linear-gradient(155deg, rgba(17, 36, 68, 0.98), rgba(9, 20, 40, 0.98));
  border-color: rgba(79, 214, 255, 0.32);
}

.brand img {
  box-shadow: 0 0 18px rgba(0, 243, 255, 0.16);
}

.tab,
.icon-btn,
.pill-btn,
.primary-btn,
.secondary-btn,
.opt-btn,
.booster-row button,
.buy-btn {
  transition: transform 140ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.tab { min-height: 42px; }

.tab:hover,
.icon-btn:hover,
.pill-btn:hover,
.secondary-btn:hover,
.opt-btn:hover:not(:disabled),
.booster-row button:hover:not(:disabled) {
  border-color: rgba(0, 243, 255, 0.72);
  box-shadow: 0 5px 16px rgba(0, 243, 255, 0.11);
}

.scoreline {
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: linear-gradient(115deg, rgba(7, 17, 36, 0.82), rgba(14, 38, 65, 0.72));
}

.mission-bar {
  border-color: rgba(0, 243, 255, 0.3);
  background: linear-gradient(100deg, rgba(0, 243, 255, 0.1), rgba(0, 230, 118, 0.06));
}

#lobby-panel,
#quiz-panel,
#result-panel {
  border-color: rgba(120, 190, 255, 0.16);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
}

.pill-btn {
  min-height: 44px;
  border-radius: 12px;
  background: rgba(7, 17, 36, 0.72);
}

.pill-btn.active {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(0, 230, 118, 0.13));
  box-shadow: inset 0 0 0 1px rgba(0, 243, 255, 0.12), 0 0 14px rgba(0, 243, 255, 0.08);
}

.match-actions button { min-height: 56px; }

#btn-start-quiz {
  box-shadow: 0 7px 18px rgba(0, 230, 118, 0.18);
}

#btn-invite-friend {
  min-height: 44px;
  background: rgba(0, 230, 118, 0.08);
}

.streak-card {
  border-color: rgba(255, 215, 0, 0.22);
  background: linear-gradient(135deg, rgba(7, 17, 36, 0.68), rgba(40, 34, 17, 0.28));
}

.opt-btn { min-height: 48px; }

.app :where(button, a):focus-visible {
  outline: 3px solid rgba(0, 243, 255, 0.9);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  body {
    padding: calc(50px + env(safe-area-inset-top, 0px)) 0 calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .app {
    width: min(100%, 520px);
    min-height: calc(100dvh - 50px - env(safe-area-inset-top, 0px));
    padding: 14px clamp(12px, 4vw, 18px) calc(16px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
  }

  header {
    padding: 2px 2px 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .brand { font-size: clamp(16px, 4.5vw, 19px); }

  nav {
    position: sticky;
    top: calc(38px + env(safe-area-inset-top, 0px));
    z-index: 20;
    margin: 9px 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
  }

  .scoreline { margin-bottom: 9px; }
  .mission-bar { margin-bottom: 10px; }
  .card-box { padding: 12px; }
  .pill-grid { gap: 7px; margin-bottom: 11px; }
  .pill-grid.diff { gap: 5px; }
  .pill-grid.diff .pill-btn { min-height: 42px; padding-inline: 4px; }
  .match-actions { gap: 7px; }
  .match-actions button { min-height: 54px; font-size: 13px; }
  .match-actions small { font-size: 0.68rem; }
  .streak-grid { gap: 5px; }
  .cross-promo-strip { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .tab,
  .icon-btn,
  .pill-btn,
  .primary-btn,
  .secondary-btn,
  .opt-btn,
  .booster-row button,
  .buy-btn {
    transition: none;
  }
}
