@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,800&family=Inter:wght@400;500;600;700&display=swap');

/* =====================================================================
   Respondidos — folha de estilo única
   Ordem: tokens → base → texturas → componentes → telas → responsivo
   ===================================================================== */

:root {
  /* superfícies — azul-noite profundo, nunca cinza chapado */
  --bg-0: #080c17;
  --bg-1: #0d1220;
  --bg-2: #141b30;
  --surface: #1a2238;
  --surface-hi: #232d48;
  --surface-lo: #121828;
  --line: #2c3855;
  --line-soft: #223050;

  /* tinta */
  --ink: #eef2fb;
  --ink-dim: #a8b4d0;
  --ink-faint: #6b7a9c;

  /* latão — o acento da casa */
  --brass: #e0b054;
  --brass-hi: #f7d489;
  --brass-lo: #a87a2c;
  --brass-deep: #6d4c14;

  /* semânticas */
  --good: #46c98b;
  --good-deep: #167a4c;
  --bad: #ef5f6b;
  --bad-deep: #98232e;

  /* temas */
  --t-historia: #d9a441;
  --t-geografia: #3fa796;
  --t-biologia: #5cb85c;
  --t-cultura-pop: #e0567c;
  --t-musica: #8e6fd8;
  --t-gerais: #4a90d9;
  --t-escolha: #f0c36b;

  /* forma */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-full: 999px;

  /* sombras com camadas — profundidade em vez de borrão único */
  --sh-1: 0 1px 2px rgb(0 0 0 / .4), 0 2px 8px rgb(0 0 0 / .3);
  --sh-2: 0 2px 4px rgb(0 0 0 / .45), 0 8px 24px rgb(0 0 0 / .38);
  --sh-3: 0 6px 12px rgb(0 0 0 / .5), 0 20px 56px rgb(0 0 0 / .45);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Fundo em camadas: dois brilhos coloridos sobre um degradê profundo.
   Chapar uma cor só é exatamente o que deixa a tela "lavada". */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1200px 800px at 12% -10%, #1e2b52 0%, transparent 60%),
    radial-gradient(900px 700px at 100% 0%, #2a1c44 0%, transparent 55%),
    radial-gradient(700px 900px at 50% 120%, #14263f 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
}

/* ------------------------------------------------------------ texturas */

/* Grão fino sobre tudo — é o que tira o aspecto de plástico liso. */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 9998;
  pointer-events: none;
  opacity: .3;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 8s steps(6) infinite;
}

@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-2%, 1%); }
  40%  { transform: translate(1%, -2%); }
  60%  { transform: translate(-1%, -1%); }
  80%  { transform: translate(2%, 1%); }
  100% { transform: translate(0, 0); }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgb(0 0 0 / .55) 100%);
}

/* Feltro: ruído grosso e baixo contraste, aplicado nas superfícies. */
.card, .panel, .stage-panel, .topbar {
  position: relative;
}

.card::before, .panel::before, .stage-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.6 .9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)' opacity='.5'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------ tipografia */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0;
  line-height: 1.12;
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -.045em;
  background: linear-gradient(175deg, var(--brass-hi) 0%, var(--brass) 42%, var(--brass-lo) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgb(0 0 0 / .5)) drop-shadow(0 8px 26px rgb(224 176 84 / .28));
  margin: 0;
}

.tagline {
  margin: .4rem 0 0;
  color: var(--ink-dim);
  font-size: .96rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}

/* Selo de latão com relevo — reaproveitado no boot e na topbar. */
.logo-mark {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 22px;
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 800;
  color: #3a2a08;
  background:
    linear-gradient(160deg, var(--brass-hi) 0%, var(--brass) 45%, var(--brass-lo) 100%);
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / .55),
    inset 0 -3px 6px rgb(90 60 10 / .55),
    var(--sh-2);
  text-shadow: 0 1px 0 rgb(255 255 255 / .35);
}

.logo-mark--sm {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 1.2rem;
}

/* ------------------------------------------------------------- telas */

.screen {
  display: none;
  min-height: 100dvh;
  animation: screen-in .45s var(--ease);
}

.screen.is-active { display: block; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px) scale(.995); }
  to   { opacity: 1; transform: none; }
}

.is-hidden { display: none !important; }

/* --------------------------------------------------------------- boot */

.boot {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.6rem;
}

.boot__logo { animation: boot-pulse 1.6s var(--ease) infinite; }

@keyframes boot-pulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.08) rotate(-4deg); }
}

.boot__text {
  color: var(--ink-faint);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: .8rem;
}

/* --------------------------------------------------------------- auth */

.auth {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2rem;
  padding: 2rem 1.2rem 4rem;
}

.auth__brand { text-align: center; }

.card {
  background:
    linear-gradient(180deg, var(--surface-hi) 0%, var(--surface) 55%, var(--surface-lo) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .07),
    var(--sh-3);
  padding: 1.6rem;
}

.card--auth { width: min(420px, 92vw); }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
  padding: .3rem;
  margin-bottom: 1.4rem;
  background: var(--surface-lo);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-full);
  box-shadow: inset 0 2px 6px rgb(0 0 0 / .45);
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-weight: 600;
  font-size: .92rem;
  padding: .62rem 1rem;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: color .25s, background .25s, box-shadow .25s;
}

.tab.is-active {
  color: #2e2206;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 60%, var(--brass-lo));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .5),
    0 2px 8px rgb(224 176 84 / .3);
}

/* ------------------------------------------------------------- forms */

.form { display: grid; gap: 1rem; }

.form--grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.field { display: grid; gap: .4rem; }
.field--full { grid-column: 1 / -1; }

.field__label {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.field__hint {
  font-size: .74rem;
  color: var(--ink-faint);
}

.input {
  width: 100%;
  font: inherit;
  font-size: .98rem;
  color: var(--ink);
  padding: .78rem .95rem;
  background: var(--surface-lo);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: inset 0 2px 5px rgb(0 0 0 / .4);
  transition: border-color .2s, box-shadow .2s;
}

.input:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow:
    inset 0 2px 5px rgb(0 0 0 / .4),
    0 0 0 3px rgb(224 176 84 / .22);
}

.input--area { resize: vertical; min-height: 76px; }

.form__error,
.form__ok {
  margin: 0;
  font-size: .86rem;
  min-height: 1.1em;
  grid-column: 1 / -1;
}

.form__error { color: var(--bad); }
.form__ok { color: var(--good); }

/* ----------------------------------------------------------- botões */

.btn {
  --btn-bg: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  --btn-ink: var(--ink);
  position: relative;
  display: inline-grid;
  place-items: center;
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  color: var(--btn-ink);
  padding: .8rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--btn-bg);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .12),
    var(--sh-1);
  cursor: pointer;
  user-select: none;
  transition: transform .16s var(--ease-back), box-shadow .2s, filter .2s;
}

.btn > span { position: relative; }

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .16),
    var(--sh-2);
  filter: brightness(1.08);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(.985);
  box-shadow:
    inset 0 2px 6px rgb(0 0 0 / .4);
}

.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn--primary {
  --btn-ink: #2e2206;
  --btn-bg: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 48%, var(--brass-lo) 100%);
  border-color: var(--brass-deep);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .5),
    inset 0 -2px 6px rgb(109 76 20 / .5),
    0 4px 14px rgb(224 176 84 / .28),
    var(--sh-1);
  text-shadow: 0 1px 0 rgb(255 255 255 / .3);
}

/* Brilho que atravessa o botão no hover. */
.btn--primary::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / .45) 50%, transparent 65%);
  background-size: 250% 100%;
  background-position: 150% 0;
  opacity: 0;
  transition: opacity .2s;
}

.btn--primary:hover::after {
  opacity: 1;
  animation: sheen .75s var(--ease);
}

@keyframes sheen {
  from { background-position: 150% 0; }
  to   { background-position: -60% 0; }
}

.btn--ghost {
  --btn-bg: rgb(255 255 255 / .04);
  border-color: var(--line);
}

.btn--danger {
  --btn-ink: #fff;
  --btn-bg: linear-gradient(180deg, #e2555f, var(--bad-deep));
  border-color: #6d1a22;
}

.btn--danger-ghost {
  --btn-ink: var(--bad);
  --btn-bg: transparent;
  border-color: rgb(239 95 107 / .35);
}

.btn--block { width: 100%; }
.btn--lg { padding: 1rem 2rem; font-size: 1.05rem; }
.btn--tiny { padding: .42rem .9rem; font-size: .8rem; }

/* ------------------------------------------------------------ topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .7rem clamp(.8rem, 3vw, 1.6rem);
  background: linear-gradient(180deg, rgb(20 27 48 / .96), rgb(13 18 32 / .88));
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
  box-shadow: 0 6px 24px rgb(0 0 0 / .35);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.topbar__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -.02em;
}

.topbar__nav {
  display: flex;
  gap: .25rem;
  margin-left: auto;
  padding: .25rem;
  background: rgb(0 0 0 / .28);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-full);
}

.navbtn {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-weight: 600;
  font-size: .88rem;
  padding: .5rem 1rem;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: color .2s, background .2s;
}

.navbtn:hover { color: var(--ink); }

.navbtn.is-active {
  color: var(--brass-hi);
  background: rgb(224 176 84 / .12);
  box-shadow: inset 0 0 0 1px rgb(224 176 84 / .25);
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: .3rem;
  font-size: .68rem;
  font-weight: 700;
  color: #fff;
  background: var(--bad);
  border-radius: var(--r-full);
  box-shadow: 0 0 0 2px var(--bg-1);
}

.avatar-btn {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: var(--r-full);
  transition: transform .2s var(--ease-back);
}

.avatar-btn:hover { transform: scale(1.08); }

/* menu da conta */
.account { position: relative; }

.account__menu {
  position: absolute;
  top: calc(100% + .6rem);
  right: 0;
  z-index: 60;
  min-width: 210px;
  padding: .4rem;
  background: linear-gradient(170deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  animation: menu-in .2s var(--ease-back);
}

.account__menu[hidden] { display: none; }

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-8px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.account__head {
  display: grid;
  gap: .15rem;
  padding: .6rem .8rem .7rem;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: .35rem;
}

.account__head strong { font-size: .95rem; }

.account__head span {
  font-size: .76rem;
  color: var(--ink-faint);
}

.account__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: .6rem .8rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  text-align: left;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .18s, color .18s;
}

.account__item:hover { background: rgb(255 255 255 / .06); color: var(--ink); }
.account__item--danger { color: var(--bad); }
.account__item--danger:hover { background: rgb(239 95 107 / .12); }

.account__flag {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brass);
}

/* ----------------------------------------------------------- avatares */

.avatar {
  display: block;
  object-fit: cover;
  border-radius: var(--r-full);
  background: linear-gradient(140deg, var(--surface-hi), var(--surface-lo));
  border: 2px solid var(--line);
  box-shadow: var(--sh-1);
}

.avatar--sm { width: 36px; height: 36px; }
.avatar--md { width: 52px; height: 52px; }
.avatar--lg {
  width: 120px;
  height: 120px;
  border-width: 3px;
  border-color: var(--brass-lo);
  box-shadow: var(--sh-2), 0 0 0 6px rgb(224 176 84 / .08);
}

/* -------------------------------------------------------------- lobby */

.lobby {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) clamp(.8rem, 3vw, 1.6rem) 4rem;
}

.view { display: none; animation: view-in .35s var(--ease); }
.view.is-active { display: grid; gap: 1.4rem; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: clamp(1rem, 4vw, 2.6rem);
  padding: clamp(1.2rem, 4vw, 2.4rem);
  background:
    radial-gradient(600px 300px at 85% 10%, rgb(224 176 84 / .1), transparent 70%),
    linear-gradient(160deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .07), var(--sh-3);
}

.hero__wheel { display: grid; place-items: center; }

#wheel-preview {
  width: clamp(160px, 26vw, 250px);
  height: auto;
  animation: idle-spin 44s linear infinite;
  filter: drop-shadow(0 12px 30px rgb(0 0 0 / .5));
}

@keyframes idle-spin { to { transform: rotate(360deg); } }

.hero__title { font-size: clamp(1.6rem, 4vw, 2.4rem); }

.hero__sub {
  margin: .7rem 0 1.4rem;
  color: var(--ink-dim);
  line-height: 1.6;
  max-width: 46ch;
}

.hero__sub strong { color: var(--brass-hi); }

.hero__actions { display: flex; flex-wrap: wrap; gap: .7rem; }

.queue-status {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-top: 1.1rem;
  padding: .7rem 1rem;
  font-size: .9rem;
  color: var(--ink-dim);
  background: rgb(0 0 0 / .25);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgb(224 176 84 / .25);
  border-top-color: var(--brass);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* faixa de temas */
.themes-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .7rem;
}

.theme-chip {
  --c: var(--brass);
  position: relative;
  display: grid;
  gap: .25rem;
  padding: .9rem 1rem;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 12% 0%, color-mix(in srgb, var(--c) 55%, transparent) 0%, transparent 62%),
    linear-gradient(160deg, color-mix(in srgb, var(--c) 30%, #0b1020), color-mix(in srgb, var(--c) 10%, #0b1020));
  border: 1px solid color-mix(in srgb, var(--c) 48%, transparent);
  border-radius: var(--r-md);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .14),
    0 0 18px -6px color-mix(in srgb, var(--c) 55%, transparent),
    var(--sh-1);
  transition: transform .2s var(--ease-back), box-shadow .2s;
}

.theme-chip:hover {
  transform: translateY(-3px);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .2),
    0 0 26px -4px color-mix(in srgb, var(--c) 70%, transparent),
    var(--sh-2);
}

.theme-chip__icon {
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 4px rgb(0 0 0 / .5));
}

.theme-chip__name {
  font-weight: 700;
  font-size: .92rem;
  color: color-mix(in srgb, var(--c) 30%, #fff);
  text-shadow: 0 1px 2px rgb(0 0 0 / .55);
}

.theme-chip__count {
  font-size: .74rem;
  color: color-mix(in srgb, var(--c) 22%, var(--ink-dim));
}

/* painéis */
.panel {
  padding: clamp(1rem, 3vw, 1.6rem);
  background: linear-gradient(170deg, var(--surface), var(--surface-lo));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .05), var(--sh-2);
}

.panel__title {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  color: var(--ink);
}

.panel__note {
  margin: 0 0 1rem;
  color: var(--ink-dim);
  font-size: .9rem;
  line-height: 1.55;
}

.panel--danger { border-color: rgb(239 95 107 / .3); }

.empty {
  margin: 0;
  padding: 1.4rem;
  text-align: center;
  color: var(--ink-faint);
  font-size: .9rem;
}

/* listas de usuários */
.userlist { display: grid; gap: .5rem; }

.userrow {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .7rem .9rem;
  background: rgb(255 255 255 / .03);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  transition: background .2s, transform .2s var(--ease-back);
}

.userrow:hover { background: rgb(255 255 255 / .06); transform: translateX(3px); }

.userrow__meta { flex: 1; min-width: 0; }

.userrow__name {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-weight: 600;
  font-size: .95rem;
}

.userrow__bio {
  margin: .15rem 0 0;
  font-size: .8rem;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userrow__actions { display: flex; gap: .4rem; flex-shrink: 0; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
  flex-shrink: 0;
}

.dot.is-online {
  background: var(--good);
  box-shadow: 0 0 0 3px rgb(70 201 139 / .2);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  50% { box-shadow: 0 0 0 6px rgb(70 201 139 / .05); }
}

/* ranking */
.ranking { display: grid; gap: .4rem; }

.rankrow {
  display: grid;
  grid-template-columns: 34px 40px 1fr auto;
  align-items: center;
  gap: .8rem;
  padding: .6rem .9rem;
  background: rgb(255 255 255 / .03);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}

.rankrow--me {
  border-color: rgb(224 176 84 / .45);
  background: rgb(224 176 84 / .08);
}

.rankrow__pos {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink-faint);
  text-align: center;
}

.rankrow:nth-child(1) .rankrow__pos { color: var(--brass-hi); }
.rankrow:nth-child(2) .rankrow__pos { color: #cfd6e6; }
.rankrow:nth-child(3) .rankrow__pos { color: #c98b5e; }

.rankrow__score {
  font-weight: 700;
  font-size: .9rem;
  color: var(--brass-hi);
}

/* perfil */
.profile-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  align-items: center;
}

.avatar-edit { display: grid; gap: .5rem; justify-items: center; }

.avatar-edit__btn {
  font-size: .78rem;
  font-weight: 600;
  color: var(--brass);
  cursor: pointer;
  padding: .35rem .8rem;
  border: 1px solid rgb(224 176 84 / .35);
  border-radius: var(--r-full);
  transition: background .2s;
}

.avatar-edit__btn:hover { background: rgb(224 176 84 / .12); }

.profile-info { flex: 1; min-width: 200px; }

.profile-bio {
  margin: .5rem 0 1rem;
  color: var(--ink-dim);
  line-height: 1.55;
  max-width: 52ch;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: .6rem;
}

.stat {
  padding: .7rem .5rem;
  text-align: center;
  background: rgb(0 0 0 / .25);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}

.stat__num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brass-hi);
  line-height: 1;
}

.stat__label {
  display: block;
  margin-top: .25rem;
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* histórico */
.history { display: grid; gap: .45rem; }

.histrow {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: .8rem;
  padding: .65rem .9rem;
  background: rgb(255 255 255 / .03);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  font-size: .9rem;
}

.histrow__flag { width: 8px; height: 34px; border-radius: 4px; }
.histrow--win  .histrow__flag { background: var(--good); }
.histrow--loss .histrow__flag { background: var(--bad); }
.histrow--draw .histrow__flag { background: var(--ink-faint); }

.histrow__score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
}

.histrow__when { font-size: .76rem; color: var(--ink-faint); }

/* ============================================================= duelo */

.screen--match { display: none; }
.screen--match.is-active { display: grid; }

.match {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 940px;
  margin: 0 auto;
  width: 100%;
  padding: clamp(.7rem, 2vw, 1.2rem);
  gap: clamp(.7rem, 2vw, 1.2rem);
}

.match__hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: .8rem 1rem;
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .08), var(--sh-2);
}

.player {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
}

.player--right { flex-direction: row; justify-content: flex-end; }
.player--right .player__meta { text-align: right; }

.player__meta { min-width: 0; }

.player__name {
  display: block;
  font-weight: 700;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 15ch;
}

/* Você é sempre o jogador da esquerda, marcado pela cor da casa. */
.player--me .player__name { color: var(--brass-hi); }

.player--me .player__name::after {
  content: 'você';
  display: block;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.player__score {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--brass-hi);
  min-width: 1.4ch;
  text-align: center;
  transition: transform .3s var(--ease-back);
}

.player__score.is-bump { transform: scale(1.45); }

.player.is-turn .avatar {
  border-color: var(--brass);
  box-shadow: 0 0 0 4px rgb(224 176 84 / .18), var(--sh-1);
}

.player.is-off { opacity: .45; }

/* marcadores de acerto */
.pips {
  display: flex;
  gap: 3px;
  margin-top: .3rem;
}

.player--right .pips { justify-content: flex-end; }

.pip {
  width: 9px;
  height: 5px;
  border-radius: 3px;
  background: rgb(255 255 255 / .12);
  transition: background .3s, box-shadow .3s;
}

.pip.is-on {
  background: linear-gradient(90deg, var(--brass), var(--brass-hi));
  box-shadow: 0 0 6px rgb(224 176 84 / .6);
}

.match__center { text-align: center; }

.clock {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.match__round {
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: .15rem;
}

/* ---------------------------------------------------- morte súbita */

/* Empataram no alvo: daqui em diante, um erro sozinho decide o duelo. */
.match.is-sudden .match__hud {
  border-color: rgb(239 95 107 / .55);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .08),
    0 0 0 1px rgb(239 95 107 / .25),
    0 0 32px -6px rgb(239 95 107 / .5),
    var(--sh-2);
  animation: sudden-pulse 2.4s ease-in-out infinite;
}

@keyframes sudden-pulse {
  50% { box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .08),
    0 0 0 1px rgb(239 95 107 / .4),
    0 0 46px -4px rgb(239 95 107 / .7),
    var(--sh-2); }
}

.match.is-sudden .match__round {
  color: var(--bad);
  font-weight: 800;
  letter-spacing: .18em;
}

.match.is-sudden .clock { color: var(--bad); }

.match.is-sudden .player__score {
  color: var(--bad);
  text-shadow: 0 0 18px rgb(239 95 107 / .5);
}

.match__stage {
  display: grid;
  place-items: center;
  position: relative;
}

.stage-panel {
  display: none;
  width: 100%;
  animation: stage-in .4s var(--ease);
}

.stage-panel.is-active {
  display: grid;
  justify-items: center;
  gap: 1.2rem;
}

@keyframes stage-in {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: none; }
}

.stage-title { font-size: 1.2rem; text-align: center; }

.stage-msg {
  margin: 0;
  color: var(--ink-dim);
  font-size: .95rem;
  text-align: center;
  min-height: 1.4em;
}

/* ------------------------------------------------------------ roleta */

.wheel-wrap {
  position: relative;
  width: min(78vw, 440px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

#wheel {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 44px rgb(0 0 0 / .6));
}

/* Ponteiro em latão, ancorado no topo. */
.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  translate: -50% 0;
  z-index: 3;
  width: 26px;
  height: 40px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 45%, var(--brass-lo));
  clip-path: polygon(50% 100%, 0 26%, 12% 0, 88% 0, 100% 26%);
  filter: drop-shadow(0 3px 6px rgb(0 0 0 / .6));
  transform-origin: 50% 15%;
}

.wheel-pointer.is-ticking { animation: pointer-tick .07s ease-out; }

@keyframes pointer-tick {
  0%   { transform: rotate(0deg); }
  45%  { transform: rotate(-13deg); }
  100% { transform: rotate(0deg); }
}

/* Botão central da roleta — o elemento mais tátil da tela. */
.wheel-hub {
  position: absolute;
  z-index: 2;
  width: 27%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--brass-deep);
  background:
    radial-gradient(circle at 38% 30%, var(--brass-hi) 0%, var(--brass) 40%, var(--brass-lo) 100%);
  color: #37280a;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(.72rem, 2.4vw, 1rem);
  letter-spacing: .06em;
  cursor: pointer;
  box-shadow:
    inset 0 3px 0 rgb(255 255 255 / .5),
    inset 0 -4px 10px rgb(90 60 10 / .6),
    0 6px 20px rgb(0 0 0 / .5);
  transition: transform .18s var(--ease-back), filter .2s;
}

.wheel-hub:not(:disabled):hover {
  transform: scale(1.07);
  filter: brightness(1.1);
}

.wheel-hub:not(:disabled):active { transform: scale(.94); }

.wheel-hub:disabled {
  cursor: default;
  filter: grayscale(.55) brightness(.62);
}

/* Halo pulsante quando é a sua vez de girar. */
.wheel-hub.is-ready::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--brass);
  animation: hub-halo 1.5s var(--ease) infinite;
  pointer-events: none;
}

@keyframes hub-halo {
  0%   { transform: scale(1);    opacity: .8; }
  100% { transform: scale(1.28); opacity: 0; }
}

/* --------------------------------------------------- escolha de tema */

.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .7rem;
  width: min(100%, 560px);
}

.theme-opt {
  --c: var(--brass);
  display: grid;
  gap: .3rem;
  justify-items: center;
  padding: 1rem .8rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(165deg, color-mix(in srgb, var(--c) 55%, #000), color-mix(in srgb, var(--c) 24%, #000));
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .18), var(--sh-1);
  transition: transform .18s var(--ease-back), box-shadow .2s;
}

.theme-opt:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .25), var(--sh-2),
              0 0 22px color-mix(in srgb, var(--c) 40%, transparent);
}

.theme-opt:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.theme-opt__icon { font-size: 1.7rem; }
.theme-opt__name { font-size: .88rem; }

.timer-bar {
  width: min(100%, 560px);
  height: 6px;
  background: rgb(0 0 0 / .4);
  border-radius: var(--r-full);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgb(0 0 0 / .5);
}

.timer-bar__fill {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--brass-lo), var(--brass-hi));
  transform-origin: left;
}

/* ---------------------------------------------------------- pergunta */

.stage-panel[data-stage="question"].is-active {
  justify-items: stretch;
  width: min(100%, 720px);
}

.qhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.qtheme {
  --c: var(--brass);
  padding: .4rem 1rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 70%, #000), color-mix(in srgb, var(--c) 40%, #000));
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  border-radius: var(--r-full);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .2);
}

.qclock { position: relative; width: 52px; height: 52px; }

.qclock__ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.qclock__track,
.qclock__fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}

.qclock__track { stroke: rgb(255 255 255 / .1); }

.qclock__fill {
  stroke: var(--brass);
  stroke-dasharray: 119.4;
  stroke-dashoffset: 0;
  transition: stroke .3s;
}

.qclock.is-low .qclock__fill { stroke: var(--bad); }

.qclock__num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.question {
  font-size: clamp(1.15rem, 3.4vw, 1.65rem);
  line-height: 1.32;
  text-align: center;
  text-wrap: balance;
  padding: 1.2rem 1rem;
  background: linear-gradient(170deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .07), var(--sh-2);
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .6rem;
}

.opt {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .95rem 1.1rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(175deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .08), var(--sh-1);
  transition: transform .16s var(--ease-back), box-shadow .2s, border-color .2s, background .3s;
}

.opt:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: var(--brass-lo);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .14), var(--sh-2);
}

.opt:not(:disabled):active { transform: translateY(1px) scale(.99); }

.opt__key {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .82rem;
  color: var(--ink-dim);
  background: rgb(0 0 0 / .3);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.opt.is-picked {
  border-color: var(--brass);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .16), 0 0 0 2px rgb(224 176 84 / .3);
}

.opt.is-correct {
  background: linear-gradient(175deg, #2b7f57, var(--good-deep));
  border-color: var(--good);
  color: #fff;
  animation: pop-good .45s var(--ease-back);
}

.opt.is-wrong {
  background: linear-gradient(175deg, #a83341, var(--bad-deep));
  border-color: var(--bad);
  color: #fff;
  animation: shake .4s ease-in-out;
}

.opt.is-dim { opacity: .38; }

@keyframes pop-good {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

.qstatus {
  margin: 0;
  text-align: center;
  font-size: .88rem;
  color: var(--ink-dim);
  min-height: 1.4em;
}

/* -------------------------------------------------------------- fim */

.result {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: clamp(1.4rem, 5vw, 2.6rem);
  text-align: center;
  background: linear-gradient(170deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  width: min(100%, 520px);
}

.result__crown { font-size: 3.4rem; animation: crown-drop .7s var(--ease-back); }

@keyframes crown-drop {
  from { transform: translateY(-30px) scale(.5) rotate(-20deg); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.result__title { font-size: 1.9rem; }
.result__title--win  { color: var(--brass-hi); }
.result__title--loss { color: var(--bad); }

.result__score {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: .04em;
}

.result__detail { color: var(--ink-dim); font-size: .92rem; }

.match__foot { display: grid; place-items: center; }

/* ------------------------------------------------------------ modais */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgb(4 7 14 / .74);
  backdrop-filter: blur(8px);
  animation: fade-in .25s var(--ease);
}

.modal-root[hidden] { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(440px, 100%);
  padding: 1.6rem;
  background: linear-gradient(170deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  animation: modal-in .35s var(--ease-back);
}

@keyframes modal-in {
  from { transform: translateY(24px) scale(.94); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.modal__title { font-size: 1.25rem; margin-bottom: .6rem; }

.modal__body {
  color: var(--ink-dim);
  line-height: 1.6;
  font-size: .94rem;
  margin-bottom: 1.3rem;
}

.modal__actions {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------ toasts */

.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9500;
  display: grid;
  gap: .5rem;
  justify-items: end;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: .7rem;
  max-width: min(360px, 88vw);
  padding: .8rem 1.1rem;
  font-size: .9rem;
  color: var(--ink);
  background: linear-gradient(170deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  pointer-events: auto;
  animation: toast-in .35s var(--ease-back);
}

.toast.is-out { animation: toast-out .3s var(--ease) forwards; }
.toast--good { border-left-color: var(--good); }
.toast--bad  { border-left-color: var(--bad); }

@keyframes toast-in {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes toast-out {
  to { transform: translateX(40px); opacity: 0; }
}

.toast__actions { display: flex; gap: .4rem; margin-left: auto; }

/* -------------------------------------------------------- responsivo */

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .hero__sub { margin-inline: auto; }
  .hero__actions { justify-content: center; }

  .topbar { flex-wrap: wrap; }
  .topbar__nav { order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
  .navbtn { flex: 1; padding: .5rem .4rem; font-size: .8rem; }

  .player__name { max-width: 9ch; font-size: .82rem; }
  .player__score { font-size: 1.5rem; }
  .avatar--md { width: 40px; height: 40px; }
  .clock { font-size: 1.3rem; }

  .options { grid-template-columns: 1fr; }
  .opt { padding: .85rem 1rem; font-size: .95rem; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .profile-head { justify-content: center; text-align: center; }
}

/* Respeita quem pediu menos movimento — mas mantém a roleta usável. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  #wheel-preview { animation: none; }
  .grain { animation: none; }
}
