:root {
  /* Palette from logo: navy rope rings, gold border, ocean, sun, IBIZA gradient */
  --navy-0: #06122e;
  --navy-1: #0a1838;
  --navy-2: #0f2a5c;
  --navy-deep: #08142f;
  --gold: #e8b84a;
  --gold-bright: #f6d06a;
  --gold-dark: #c4892e;
  --ocean: #1ea7d6;
  --ocean-deep: #0c5484;
  --sun: #ffcc3d;
  --sun-hot: #ff9f1a;
  --purple: #9b5cff;
  --magenta: #c44dff;
  --cyan: #3ecbff;

  --bg0: var(--navy-0);
  --bg1: var(--navy-2);
  --card: rgba(12, 36, 84, 0.55);
  --card-border: rgba(232, 184, 74, 0.28);
  --text: #f4f7ff;
  --muted: #a8bfe0;
  --accent: var(--ocean);
  --accent2: var(--purple);
  --good: #3ddc97;
  --bad: #ff6b7a;
  --warn: var(--sun);
  --shadow: 0 16px 40px rgba(2, 10, 30, 0.45);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, sans-serif;
  --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --pad-x: max(1rem, var(--safe-left), var(--safe-right));
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
}
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 520px at 50% -12%, rgba(255, 204, 61, 0.16), transparent 55%),
    radial-gradient(700px 420px at 0% 20%, rgba(30, 167, 214, 0.18), transparent 55%),
    radial-gradient(650px 400px at 100% 10%, rgba(155, 92, 255, 0.14), transparent 50%),
    linear-gradient(168deg, var(--navy-0) 0%, var(--navy-1) 42%, #0c3a6e 78%, #0a2f58 100%);
  background-attachment: fixed;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* Prevent iOS zoom on focus (needs >= 16px) */
button, input, select, textarea {
  font: inherit;
  font-size: 16px;
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 14px;
  min-height: var(--tap);
  padding: 0.85rem 1.15rem;
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 45%, var(--gold-dark) 100%);
  color: #1a1204;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 20px rgba(196, 137, 46, 0.28);
  transition: transform .12s ease, filter .12s ease, opacity .12s ease;
  -webkit-user-select: none;
  user-select: none;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
button.ghost {
  background: rgba(12, 36, 84, 0.45);
  color: var(--text);
  border: 1px solid rgba(232, 184, 74, 0.35);
  box-shadow: none;
  font-weight: 700;
}
button.secondary {
  background: linear-gradient(135deg, rgba(30, 167, 214, 0.25), rgba(12, 84, 132, 0.45));
  color: var(--text);
  border: 1px solid rgba(62, 203, 255, 0.35);
  box-shadow: none;
}
button.btn-block {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}
button.btn-lg {
  min-height: 54px;
  font-size: 1.05rem;
  border-radius: 16px;
}

.app-shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding:
    calc(0.85rem + var(--safe-top))
    var(--pad-x)
    calc(1.5rem + var(--safe-bottom));
  min-height: 100dvh;
  min-height: 100svh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  margin-bottom: 0.9rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 12px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.brand:hover .brand-logo,
.brand:focus-visible .brand-logo {
  transform: scale(1.04);
  filter: drop-shadow(0 4px 12px rgba(232, 184, 74, 0.35));
}
.brand:focus-visible {
  box-shadow: 0 0 0 2px rgba(232, 184, 74, 0.55);
}
.brand-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
  transition: transform .15s ease, filter .15s ease;
}
.brand-text { min-width: 0; }
.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: .01em;
  white-space: nowrap;
  background: linear-gradient(90deg, var(--cyan), #6a8cff 40%, var(--purple) 75%, var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}
.brand p {
  margin: .1rem 0 0;
  color: var(--muted);
  font-size: .75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}
.hero-logo-wrap {
  display: grid;
  place-items: center;
  margin: 0.1rem 0 0.85rem;
}
.hero-logo {
  width: min(180px, 46vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.4));
}
.top-actions {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-shrink: 0;
}
.lang-select, .field select, .field input {
  background: rgba(6, 18, 46, 0.55);
  border: 1px solid rgba(232, 184, 74, 0.28);
  color: var(--text);
  border-radius: 12px;
  padding: .75rem .85rem;
  min-height: var(--tap);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}
.lang-select {
  width: auto;
  min-width: 4.6rem;
  padding: .55rem .55rem;
  min-height: 40px;
  font-size: .9rem;
  font-weight: 700;
  border-color: rgba(232, 184, 74, 0.4);
}

.card {
  background:
    linear-gradient(160deg, rgba(15, 42, 92, 0.72), rgba(8, 24, 56, 0.78));
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 1.1rem 1.05rem;
}

.hero {
  display: grid;
  gap: 0.85rem;
}
.hero h2 {
  margin: 0 0 .45rem;
  font-size: clamp(1.35rem, 5.5vw, 1.85rem);
  line-height: 1.18;
}
.hero .lead {
  color: var(--muted);
  margin: 0 0 .85rem;
  line-height: 1.5;
  font-size: .95rem;
}
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
}
.stat {
  background: rgba(6, 18, 46, 0.45);
  border: 1px solid rgba(232, 184, 74, 0.2);
  border-radius: 14px;
  padding: .7rem .65rem;
  min-height: 64px;
}
.stat b {
  display: block;
  font-size: 1.15rem;
  line-height: 1.2;
  color: var(--gold-bright);
}
.stat span {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.25;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  margin-bottom: .85rem;
}
.auth-tabs button {
  background: rgba(6, 18, 46, 0.4);
  color: var(--muted);
  border: 1px solid transparent;
  min-height: 44px;
  box-shadow: none;
  font-weight: 700;
}
.auth-tabs button.active {
  color: #1a1204;
  border-color: rgba(232, 184, 74, 0.55);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
}

.field { display: grid; gap: .3rem; margin-bottom: .7rem; }
.field label { font-size: .8rem; color: var(--muted); }
.form-actions {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-top: .55rem;
}
.error {
  background: rgba(255,107,122,.12);
  border: 1px solid rgba(255,107,122,.35);
  color: #ffd0d5;
  padding: .75rem .85rem;
  border-radius: 12px;
  margin-bottom: .7rem;
  font-size: .9rem;
}

.panel-grid {
  display: grid;
  gap: .85rem;
  margin-top: .85rem;
}

/* Compact data cards instead of cramped tables on phones */
.list-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -.15rem;
}
.leaderboard, .history {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
  min-width: 0;
}
.leaderboard th, .history th,
.leaderboard td, .history td {
  text-align: left;
  padding: .6rem .3rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  vertical-align: top;
}
.leaderboard th, .history th {
  color: var(--muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.leaderboard td:first-child,
.history td:first-child { white-space: nowrap; }
.time-cell {
  font-variant-numeric: tabular-nums;
  color: var(--gold-bright);
  font-weight: 600;
  white-space: nowrap;
}

/* Quiz */
.quiz-card {
  margin-top: .85rem;
  padding-bottom: calc(1rem + var(--safe-bottom));
}
.quiz-top {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-bottom: .75rem;
}
.quiz-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  font-size: .82rem;
  flex-wrap: wrap;
}
.timer-pills {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .6rem;
  border-radius: 999px;
  background: rgba(6, 18, 46, 0.5);
  border: 1px solid rgba(232, 184, 74, 0.25);
  color: var(--text);
  font-size: .8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-height: 34px;
}
.timer-pill.live {
  border-color: rgba(30, 167, 214, 0.5);
  background: rgba(30, 167, 214, 0.14);
  color: #b8ecff;
}
.timer-pill.total {
  border-color: rgba(232, 184, 74, 0.45);
  background: rgba(232, 184, 74, 0.12);
  color: #ffe7a8;
}
.timer-pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 0 rgba(255, 204, 61, 0.6);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 204, 61, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(255, 204, 61, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 204, 61, 0); }
}

.bar {
  height: 8px;
  background: rgba(6, 18, 46, 0.55);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: .9rem;
  border: 1px solid rgba(232, 184, 74, 0.15);
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ocean), var(--cyan) 40%, var(--gold) 100%);
  transition: width .25s ease;
}

.q-cat {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--gold-bright);
  font-size: .8rem;
  margin-bottom: .45rem;
  text-transform: capitalize;
}
.q-text {
  font-size: clamp(1.12rem, 4.6vw, 1.35rem);
  margin: 0 0 1rem;
  line-height: 1.35;
  font-weight: 700;
}
.options { display: grid; gap: .55rem; }
.option {
  text-align: left;
  background: rgba(6, 18, 46, 0.5);
  color: var(--text);
  border: 1px solid rgba(232, 184, 74, 0.22);
  padding: .9rem .85rem;
  border-radius: 14px;
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  min-height: 56px;
  width: 100%;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: none;
}
.option:active {
  border-color: rgba(30, 167, 214, 0.55);
  background: rgba(30, 167, 214, 0.12);
}
.option .key {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(232, 184, 74, 0.35), rgba(30, 167, 214, 0.25));
  color: var(--gold-bright);
  font-weight: 800;
  flex: 0 0 auto;
  font-size: .9rem;
}
.option .opt-text {
  flex: 1;
  padding-top: .15rem;
  font-size: .98rem;
}
.option.correct {
  border-color: rgba(61,220,151,.55);
  background: rgba(61,220,151,.14);
}
.option.wrong {
  border-color: rgba(255,107,122,.55);
  background: rgba(255,107,122,.14);
}
.option:disabled { transform: none; opacity: 1; }

.answer-feedback {
  margin-top: .75rem;
  padding: .7rem .8rem;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 600;
  display: none;
}
.answer-feedback.show { display: block; }
.answer-feedback.ok {
  background: rgba(61,220,151,.12);
  border: 1px solid rgba(61,220,151,.35);
  color: #c8ffe6;
}
.answer-feedback.bad {
  background: rgba(255,107,122,.12);
  border: 1px solid rgba(255,107,122,.35);
  color: #ffd0d5;
}

.quiz-actions {
  position: sticky;
  bottom: calc(0.5rem + var(--safe-bottom));
  margin-top: 1rem;
  padding-top: .35rem;
  z-index: 5;
}
.quiz-actions button {
  width: 100%;
  min-height: 52px;
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
}

/* Result */
.result-card { margin-top: .85rem; text-align: center; }
.result-score {
  font-size: clamp(2.6rem, 12vw, 3.4rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold-bright), var(--sun) 40%, var(--cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: .15rem 0;
  line-height: 1.1;
}
.result-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  margin: 1rem 0 1.15rem;
  text-align: left;
}
.result-metrics .stat b { font-variant-numeric: tabular-nums; }

/* Ibiza rank system */
.ibiza-rank {
  margin: 1rem 0 0.25rem;
  text-align: left;
}
.ibiza-rank-kicker {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: .55rem;
  text-align: center;
}
.ibiza-rank-badge {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .95rem .9rem;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: rgba(6, 18, 46, 0.45);
}
.ibiza-rank-badge.tier-cruise {
  border-color: rgba(255, 209, 102, .55);
  background: linear-gradient(135deg, rgba(255,209,102,.18), rgba(12, 36, 84, .35));
}
.ibiza-rank-badge.tier-season {
  border-color: rgba(255, 159, 67, .55);
  background: linear-gradient(135deg, rgba(255,159,67,.2), rgba(12, 36, 84, .35));
}
.ibiza-rank-badge.tier-heart {
  border-color: rgba(30, 167, 214, .55);
  background: linear-gradient(135deg, rgba(30,167,214,.2), rgba(12, 36, 84, .35));
}
.ibiza-rank-badge.tier-lover {
  border-color: rgba(155, 92, 255, .55);
  background: linear-gradient(135deg, rgba(155,92,255,.22), rgba(12, 36, 84, .35));
}
.ibiza-rank-badge.tier-amo {
  border-color: rgba(246, 208, 106, .75);
  background: linear-gradient(135deg, rgba(246,208,106,.24), rgba(196,77,255,.12));
  box-shadow: 0 0 0 1px rgba(246,208,106,.18), 0 12px 30px rgba(232, 184, 74, .16);
}
.ibiza-rank-emoji {
  font-size: 1.85rem;
  line-height: 1;
  flex: 0 0 auto;
  width: 2.4rem;
  text-align: center;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.25));
}
.ibiza-rank-text strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.25;
  margin-bottom: .25rem;
}
.ibiza-rank-text p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.4;
}
.ibiza-rank-hits {
  text-align: center;
  margin: .65rem 0 .4rem;
  font-size: .86rem;
}
.rank-ladder {
  display: grid;
  gap: .35rem;
  margin-top: .55rem;
}
.rank-ladder-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .45rem;
  align-items: center;
  padding: .45rem .55rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.14);
  font-size: .78rem;
  color: var(--muted);
}
.rank-ladder-item.active {
  color: var(--text);
  border-color: rgba(232, 184, 74, 0.45);
  background: rgba(232, 184, 74, 0.1);
  font-weight: 700;
}
.rank-ladder-item.locked {
  opacity: 0.45;
  filter: grayscale(0.7);
}
.rank-ladder-item .rl-emoji { font-size: 1rem; }
.rank-ladder-item .rl-range {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: .85;
}
.card-soft {
  margin: .75rem 0 1rem;
  padding: .75rem .8rem !important;
  border-radius: 14px;
  border: 1px solid rgba(232, 184, 74, 0.28);
  background: rgba(6, 18, 46, 0.4);
  box-shadow: none !important;
}
.rank-chip .mini-rank {
  display: flex;
  gap: .55rem;
  align-items: center;
  text-align: left;
}
.rank-chip .mini-rank strong {
  display: block;
  font-size: .92rem;
}
.rank-chip .mini-rank span {
  color: var(--muted);
  font-size: .78rem;
}
.rank-chip .mini-emoji { font-size: 1.4rem; }

/* Profile badge showcase */
.profile-badge-card {
  margin: 0.15rem 0 1rem;
  padding: 0.85rem 0.75rem;
  border-radius: 16px;
  border: 1px solid rgba(232, 184, 74, 0.3);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 204, 61, 0.12), transparent 50%),
    rgba(6, 18, 46, 0.45);
}
.profile-badge-kicker {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: .65rem;
  text-align: center;
}
.profile-badge-main {
  display: flex;
  gap: .85rem;
  align-items: center;
  margin-bottom: .85rem;
}
.profile-badge-img {
  width: 104px;
  height: 104px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.35));
}
.profile-badge-info {
  min-width: 0;
  text-align: left;
}
.profile-badge-info strong {
  display: block;
  font-size: 1.02rem;
  line-height: 1.25;
  margin-bottom: .25rem;
}
.profile-badge-info p {
  margin: 0;
  font-size: .86rem;
  line-height: 1.35;
}
.profile-badge-hits {
  margin-top: .35rem !important;
  color: var(--gold-bright) !important;
  font-weight: 700;
  font-size: .82rem !important;
}
.profile-badge-shelf {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .35rem;
}
.shelf-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  padding: .35rem .15rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
  min-width: 0;
}
.shelf-badge.active {
  border-color: rgba(232, 184, 74, 0.5);
  background: rgba(232, 184, 74, 0.1);
  box-shadow: 0 0 0 1px rgba(232, 184, 74, 0.12);
}
.shelf-badge.locked {
  opacity: 0.38;
  filter: grayscale(0.85);
}
.shelf-badge img {
  width: 100%;
  max-width: 56px;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}
.shelf-badge span {
  font-size: .58rem;
  line-height: 1.15;
  text-align: center;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.shelf-badge.active span { color: var(--text); font-weight: 700; }

.result-badge-wrap {
  display: grid;
  place-items: center;
  margin: 0.15rem 0 0.75rem;
}
.result-badge-img {
  width: min(148px, 42vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.4));
  animation: badge-pop .45s ease;
}
@keyframes badge-pop {
  0% { transform: scale(0.7); opacity: 0; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}

.rank-ladder-item img.rl-badge {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 50%;
}
.rank-ladder-item .rl-emoji { display: none; }

@media (min-width: 720px) {
  .profile-badge-img { width: 120px; height: 120px; }
  .shelf-badge img { max-width: 64px; }
}

/* Icon picker */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: .35rem;
  max-height: 180px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .5rem;
  border-radius: 14px;
  border: 1px solid rgba(232, 184, 74, 0.28);
  background: rgba(6, 18, 46, 0.45);
  margin-top: .35rem;
}
.icon-pick {
  min-height: 42px !important;
  min-width: 0;
  padding: .25rem !important;
  font-size: 1.25rem;
  line-height: 1;
  background: rgba(255,255,255,.04) !important;
  color: inherit !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  border-radius: 10px !important;
}
.icon-pick.active {
  border-color: rgba(232, 184, 74, 0.65) !important;
  background: rgba(232, 184, 74, 0.18) !important;
  box-shadow: 0 0 0 1px rgba(232, 184, 74, 0.2) !important;
}
.icon-pick:active { transform: scale(0.96); }
@media (min-width: 520px) {
  .icon-picker { grid-template-columns: repeat(10, 1fr); max-height: 200px; }
}

/* Profile page */
.profile-hero {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.avatar-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
}
.avatar-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(232, 184, 74, 0.55);
  background: rgba(6, 18, 46, 0.6);
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
}
.avatar-fallback {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 800;
  color: #1a1204;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  border: 2px solid rgba(232, 184, 74, 0.55);
}
.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-top: .45rem;
}
.profile-grid {
  display: grid;
  gap: .85rem;
  margin-top: .85rem;
}
@media (min-width: 720px) {
  .profile-grid { grid-template-columns: 1fr 1fr; }
}
.score-list {
  display: grid;
  gap: .45rem;
}
.score-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .5rem;
  align-items: center;
  padding: .55rem .65rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
  font-size: .88rem;
}
.score-row b { color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.file-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.file-btn input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.muted { color: var(--muted); }
.hidden { display: none !important; }
.footer-note {
  margin-top: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.4;
  padding-bottom: .25rem;
}
.user-pill {
  display: none; /* hide on tiny phones; name still in lobby */
}
#btnLogout {
  min-height: 40px;
  padding: .45rem .7rem;
  font-size: .85rem;
}

/* Larger phones / small tablets */
@media (min-width: 430px) {
  .user-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .65rem;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--card-border);
    font-size: .82rem;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brand p { max-width: 50vw; }
}

/* Tablet+ */
@media (min-width: 720px) {
  .app-shell {
    width: min(920px, calc(100% - 2rem));
    padding: 1.35rem 0 2.5rem;
  }
  .hero {
    grid-template-columns: 1.25fr .95fr;
    align-items: stretch;
  }
  .panel-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .form-actions { flex-direction: row; }
  .form-actions button { width: auto; }
  .quiz-actions button { width: auto; min-width: 180px; }
  .quiz-actions {
    position: static;
    display: flex;
    justify-content: flex-end;
  }
  .brand p { max-width: none; }
  .hero-logo { width: 200px; }
}

/* Landscape phones: tighter vertical */
@media (max-height: 430px) and (orientation: landscape) {
  .hero .lead { display: none; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .q-text { font-size: 1.05rem; margin-bottom: .65rem; }
  .option { min-height: 44px; padding: .65rem .75rem; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
