/* Word's Race — estilo baseado no Sage UI Kit (asgard-ui-showcase) */

:root {
  --font-sans: "Roboto", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-brand: "Exo 2", "Roboto", sans-serif;
  --font-mono: "Roboto Mono", "Monaco", "Menlo", monospace;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-7: 32px;
  --radius-xs: 4px; --radius-sm: 8px; --radius-md: 12px; --radius-lg: 18px; --radius-xl: 24px; --radius-pill: 999px;

  --color-brand-50: #eef2f9; --color-brand-100: #d6e0f1; --color-brand-200: #b0c4e3; --color-brand-300: #7e9dd0;
  --color-brand-400: #4a6fb3; --color-brand-500: #0f2f5a; --color-brand-600: #0c274c; --color-brand-700: #091f3c;
  --color-brand-rgb: 15, 47, 90;
  --color-accent-500: #84cc16; --color-accent-rgb: 132, 204, 22;

  --color-success: #10b981; --color-success-rgb: 16, 185, 129;
  --color-warning: #f59e0b; --color-warning-rgb: 245, 158, 11;
  --color-danger: #ef4444; --color-danger-rgb: 239, 68, 68;
  --color-info: #2563eb;
}

.light-theme {
  color-scheme: light;
  --color-bg: #fbfbfb;
  --color-surface: #fff;
  --color-surface-muted: #f6f7f8;
  --color-surface-strong: #eef0f2;
  --color-surface-overlay: #e6eaee;
  --color-text: #1c2132;
  --color-text-muted: #4c576d;
  --color-text-subtle: #6b7894;
  --color-text-inverse: #fff;
  --color-text-on-brand: #fff;
  --color-border: #e0e4e8;
  --color-border-strong: #d4dbe1;
  --shadow-elevation-1: 0 2px 8px rgba(20, 26, 38, 0.08);
  --shadow-elevation-2: 0 12px 30px rgba(20, 26, 38, 0.14);
  --color-success-bg: rgba(var(--color-success-rgb), 0.12);
  --color-danger-bg: rgba(var(--color-danger-rgb), 0.12);
  --color-warning-bg: rgba(var(--color-warning-rgb), 0.12);
  --color-brand-primary: var(--color-brand-500);
  --color-brand-primary-rgb: var(--color-brand-rgb);
  --color-brand-soft: var(--color-brand-400);
  --appbar-bg: var(--color-brand-500);
  --tile-bg: linear-gradient(180deg, #fff, #f1f4f9);
  --tile-border: #cfd8e6;
  --tile-text: var(--color-brand-500);
  --water: rgba(var(--color-brand-rgb), 0.07);
}

.dark-theme {
  color-scheme: dark;
  --color-bg: #141a26;
  --color-surface: #1a2233;
  --color-surface-muted: #20283b;
  --color-surface-strong: #28324a;
  --color-surface-overlay: #2f3b58;
  --color-text: #f3f5fa;
  --color-text-muted: #c3cbda;
  --color-text-subtle: #9aa6bf;
  --color-text-inverse: #111521;
  --color-text-on-brand: #fff;
  --color-border: #2b374f;
  --color-border-strong: #3a4761;
  --shadow-elevation-1: 0 2px 10px rgba(4, 7, 14, 0.5);
  --shadow-elevation-2: 0 16px 40px rgba(4, 7, 14, 0.55);
  --color-success: #4caf50; --color-success-rgb: 76, 175, 80;
  --color-success-bg: rgba(76, 175, 80, 0.16);
  --color-warning: #ffb020;
  --color-warning-bg: rgba(255, 176, 32, 0.16);
  --color-danger: #f4564a; --color-danger-rgb: 244, 86, 74;
  --color-danger-bg: rgba(244, 86, 74, 0.16);
  --color-info: #4ea3ff;
  --color-brand-primary: var(--color-brand-300);
  --color-brand-primary-rgb: 126, 157, 208;
  --color-brand-soft: var(--color-brand-200);
  --appbar-bg: var(--color-brand-600);
  --tile-bg: linear-gradient(180deg, #2a3550, #222b41);
  --tile-border: #3a4761;
  --tile-text: #e6edfb;
  --water: rgba(126, 157, 208, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
b { font-weight: 700; }
code, kbd {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--color-surface-strong); border: 1px solid var(--color-border);
  border-radius: var(--radius-xs); padding: 0 5px;
}
.material-icons-round { font-size: 20px; line-height: 1; vertical-align: middle; }

/* ---------- appbar (navy, como a sidenav do Asgard) ---------- */
.appbar { background: var(--appbar-bg); color: #fff; box-shadow: 0 2px 12px rgba(5, 15, 32, .25); position: sticky; top: 0; z-index: 20; }
.appbar-inner { max-width: 1360px; margin: 0 auto; height: 60px; padding: 0 var(--space-4); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.brand { display: flex; align-items: center; gap: var(--space-3); color: #fff; text-decoration: none; min-width: 0; }
.brand-logo { height: 22px; width: auto; display: block; }
.brand-sep { width: 1px; height: 24px; background: rgba(255, 255, 255, .25); }
.brand-game { font-family: var(--font-brand); font-weight: 700; font-size: 17px; white-space: nowrap; }
.appbar-actions { display: flex; align-items: center; gap: var(--space-1); }
.appbar-btn { background: transparent; border: 0; color: #fff; width: 38px; height: 38px; border-radius: var(--radius-md); cursor: pointer; display: grid; place-items: center; }
.appbar-btn:hover { background: rgba(255, 255, 255, .12); }
.appbar-room { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); font-family: var(--font-mono); letter-spacing: .12em; margin-right: var(--space-2); }
.appbar-room .material-icons-round { font-size: 18px; opacity: .8; }

/* ---------- layout ---------- */
.screen { padding: var(--space-6) var(--space-4) 48px; }
.page { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-6); }
.page-wide { max-width: 1360px; }
.card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-elevation-2);
  padding: var(--space-6);
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: linear-gradient(90deg, transparent, rgba(var(--color-brand-primary-rgb), .15), transparent);
}

.eyebrow { color: var(--color-text-subtle); font-weight: 600; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.title { font-weight: 700; font-size: clamp(26px, 2.6vw, 36px); line-height: 1.2; letter-spacing: -.02em; }
.subtitle { color: var(--color-text-muted); font-size: 15px; max-width: 680px; margin-top: 6px; }

.page-header {
  position: relative; display: flex; gap: var(--space-3); align-items: flex-start;
  border-bottom: 1px solid var(--color-border); padding-bottom: var(--space-4);
}
.page-header::after {
  content: ''; position: absolute; left: 0; bottom: -1px; width: 140px; height: 2px;
  background: linear-gradient(90deg, rgba(var(--color-brand-primary-rgb), .9), rgba(var(--color-brand-primary-rgb), 0));
}
.page-icon { font-size: 32px; color: var(--color-brand-primary); margin-top: 22px; }

.section-title { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: 16px; margin-bottom: var(--space-4); }
.section-title .material-icons-round { color: var(--color-brand-primary); background: var(--color-surface-muted); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 4px; font-size: 18px; }
.count-pill { margin-left: auto; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: var(--radius-pill); background: rgba(var(--color-brand-primary-rgb), .08); border: 1px solid rgba(var(--color-brand-primary-rgb), .16); color: var(--color-brand-primary); }

/* ---------- botões (app-button) ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: inherit; font-weight: 600; font-size: 14px;
  padding: 12px 20px; border-radius: var(--radius-md); cursor: pointer;
  border: 1px solid transparent; background: var(--color-surface-muted); color: var(--color-text);
  box-shadow: var(--shadow-elevation-1);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn::after { content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .2s ease; pointer-events: none; background: linear-gradient(135deg, rgba(255, 255, 255, .18), transparent 45%); }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-elevation-2); }
.btn:hover:not(:disabled)::after { opacity: 1; }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(var(--color-brand-primary-rgb), .25), var(--shadow-elevation-1); }
.btn:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn .material-icons-round { font-size: 18px; }
.btn-primary {
  background: linear-gradient(135deg, var(--color-brand-500), var(--color-brand-400));
  border-color: rgba(var(--color-brand-rgb), .4); color: #fff;
  box-shadow: 0 10px 22px rgba(var(--color-brand-rgb), .28);
}
.dark-theme .btn-primary { background: linear-gradient(135deg, var(--color-brand-400), #5c86d6); border-color: rgba(126, 157, 208, .4); box-shadow: 0 10px 22px rgba(4, 7, 14, .45); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 14px 26px rgba(var(--color-brand-rgb), .35); }
.btn-secondary { background: var(--color-surface); border-color: var(--color-border); }
.btn-secondary:hover:not(:disabled) { background: var(--color-surface-muted); border-color: var(--color-border-strong); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover:not(:disabled) { box-shadow: none; border-color: var(--color-border); background: var(--color-surface-muted); }
.btn-danger { background: rgba(var(--color-danger-rgb), .08); border-color: rgba(var(--color-danger-rgb), .25); color: var(--color-danger); box-shadow: none; }
.btn-danger:hover:not(:disabled) { background: rgba(var(--color-danger-rgb), .14); border-color: rgba(var(--color-danger-rgb), .4); }
.btn-sm { padding: 8px 14px; font-size: 12px; border-radius: 10px; }
.btn-lg { padding: 14px 24px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }

/* ---------- campos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-5); }
.field-label { font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-subtle); }
.input {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--color-text);
  background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  padding: 11px 14px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: var(--color-text-subtle); }
.input:focus { border-color: var(--color-brand-primary); box-shadow: 0 0 0 3px rgba(var(--color-brand-primary-rgb), .15); }
.input[readonly] { background: var(--color-surface-muted); color: var(--color-text-muted); }

.field-help {
  display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-4);
  padding: 10px 14px; border-radius: var(--radius-md); border-left: 3px solid var(--color-brand-primary);
  background: var(--color-surface-muted); box-shadow: var(--shadow-elevation-1); font-size: 13px; color: var(--color-text-muted); text-align: left;
}
.field-help .material-icons-round { font-size: 18px; color: var(--color-brand-primary); }
.field-help.danger { border-left-color: var(--color-danger); color: var(--color-danger); background: var(--color-danger-bg); font-weight: 600; }
.field-help.info { justify-content: center; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: var(--radius-pill);
  padding: 5px 12px; font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
}
.chip:empty { display: none; }
.chip.neutral { border-color: rgba(var(--color-brand-primary-rgb), .16); background: rgba(var(--color-brand-primary-rgb), .06); color: var(--color-brand-primary); }
.chip.positive { border-color: rgba(var(--color-success-rgb), .32); background: var(--color-success-bg); color: var(--color-success); }
.chip.warning { border-color: rgba(var(--color-warning-rgb), .32); background: var(--color-warning-bg); color: var(--color-warning); }
.chip.critical { border-color: rgba(var(--color-danger-rgb), .32); background: var(--color-danger-bg); color: var(--color-danger); }

/* ---------- peças de letra ---------- */
.tile, .logo-tiles span {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; color: var(--tile-text);
  background: var(--tile-bg); border: 1px solid var(--tile-border); border-radius: var(--radius-md);
  box-shadow: 0 3px 0 var(--tile-border), var(--shadow-elevation-1);
}

/* ---------- home ---------- */
.home-wrap { max-width: 540px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-5); }
.hero { text-align: center; padding-top: var(--space-2); }
.hero .eyebrow { margin-bottom: var(--space-4); }
.hero h1 { font-family: var(--font-brand); font-weight: 800; font-size: clamp(32px, 7vw, 46px); letter-spacing: -.01em; line-height: 1.1; }
.hero .subtitle { margin: var(--space-3) auto 0; }
.hero .subtitle b:not(:first-child) { color: var(--color-brand-primary); }
.logo-tiles { display: flex; justify-content: center; gap: 6px; margin-bottom: var(--space-4); flex-wrap: wrap; }
.logo-tiles span { width: 40px; height: 46px; font-size: 23px; animation: hop 2.6s ease-in-out infinite; }
.logo-tiles .sp { width: 10px; }
.hero-sub { font-family: var(--font-brand); font-weight: 600; color: var(--color-text-subtle); letter-spacing: .04em; margin-top: 2px; }
.logo-tiles span:nth-child(odd) { color: var(--color-brand-primary); }
.logo-tiles span:nth-child(even) { color: var(--color-accent-500); }
.logo-tiles span:nth-child(2) { animation-delay: .1s; } .logo-tiles span:nth-child(3) { animation-delay: .2s; }
.logo-tiles span:nth-child(4) { animation-delay: .3s; } .logo-tiles span:nth-child(5) { animation-delay: .4s; }
.logo-tiles span:nth-child(6) { animation-delay: .5s; } .logo-tiles span:nth-child(8) { animation-delay: .7s; }
.logo-tiles span:nth-child(9) { animation-delay: .8s; } .logo-tiles span:nth-child(10) { animation-delay: .9s; } .logo-tiles span:nth-child(11) { animation-delay: 1s; }
@keyframes hop { 0%, 75%, 100% { transform: translateY(0); } 85% { transform: translateY(-8px); } }

.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.avatar-grid button {
  font-size: 24px; height: 46px; border-radius: var(--radius-md); cursor: pointer;
  border: 1px solid var(--color-border); background: var(--color-surface-muted); transition: transform .15s, border-color .15s, box-shadow .15s;
}
.avatar-grid button:hover { transform: translateY(-1px); border-color: var(--color-border-strong); }
.avatar-grid button[aria-checked=true] { border-color: var(--color-brand-primary); background: rgba(var(--color-brand-primary-rgb), .08); box-shadow: 0 0 0 3px rgba(var(--color-brand-primary-rgb), .15); }
.join-box { display: grid; grid-template-columns: 1fr auto; gap: var(--space-3); align-items: end; }
.join-box .field { margin: 0; }
.code-field .input { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .35em; font-size: 20px; text-align: center; padding: 9px 14px; }
.join-box .btn { height: 47px; }
.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--color-text-subtle); margin: var(--space-5) 0; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--color-border); }
.how { padding: var(--space-4) var(--space-6); box-shadow: var(--shadow-elevation-1); }
.how summary { font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: var(--space-2); list-style: none; }
.how summary::-webkit-details-marker { display: none; }
.how summary .material-icons-round { color: var(--color-brand-primary); }
.how ol { margin: var(--space-3) 0 0; padding-left: 22px; color: var(--color-text-muted); }
.how li { margin-bottom: 6px; }

/* ---------- lobby ---------- */
.lobby-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: var(--space-5); align-items: start; }
.room-card { grid-column: 1 / -1; text-align: center; background: linear-gradient(135deg, rgba(var(--color-brand-primary-rgb), .08), rgba(var(--color-brand-primary-rgb), .02)), var(--color-surface); }
.room-code { display: flex; justify-content: center; gap: var(--space-3); margin: var(--space-3) 0 var(--space-5); }
.room-code .tile { width: 64px; height: 74px; font-size: 40px; }
.invite { display: flex; gap: var(--space-2); max-width: 560px; margin: 0 auto; }
.leave { margin-top: var(--space-4); }
.lobby-players { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-2); }
.lobby-players li {
  position: relative; display: flex; align-items: center; gap: var(--space-2); padding: 8px 10px 8px 14px;
  border-radius: var(--radius-md); background: var(--color-surface-muted); border: 1px solid var(--color-border);
  font-weight: 500; overflow: hidden; animation: pop .3s ease;
}
.lobby-players li::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.lobby-players li .av { font-size: 22px; }
.lobby-players li .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lobby-players li .nm { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.lobby-players li .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.lobby-players li .actions { display: flex; gap: 2px; align-self: center; }
.lobby-players li.off .av, .lobby-players li.off .nm { opacity: .5; } /* botões continuam nítidos para expulsar */
.lobby-players li.me { border-color: rgba(var(--color-brand-primary-rgb), .4); }
.tag { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-radius: var(--radius-pill); padding: 1px 7px; background: rgba(var(--color-accent-rgb), .18); color: #4d7c0f; }
.dark-theme .tag { color: var(--color-accent-500); }
.tag.muted { background: var(--color-surface-strong); color: var(--color-text-muted); }
.kick { border: 0; background: none; cursor: pointer; color: var(--color-text-subtle); padding: 0; display: grid; }
.kick:hover { color: var(--color-brand-primary); }
.kick.danger:hover { color: var(--color-danger); }
.tag.off { background: rgba(var(--color-danger-rgb), .14); color: var(--color-danger); }
.kick .material-icons-round { font-size: 18px; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

.settings { display: flex; flex-direction: column; gap: var(--space-4); }
.setting .lbl { font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-subtle); margin-bottom: 6px; }
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface-muted); box-shadow: var(--shadow-elevation-1);
}
.seg button {
  font-family: inherit; font-weight: 600; font-size: 13px; border: 0; border-radius: var(--radius-pill);
  padding: 7px 14px; cursor: pointer; background: transparent; color: var(--color-text-muted);
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg button:hover:not(:disabled):not([aria-pressed=true]) { background: var(--color-surface-strong); color: var(--color-text); }
.seg button[aria-pressed=true] { background: var(--color-brand-primary); color: var(--color-text-inverse); box-shadow: 0 6px 14px rgba(var(--color-brand-primary-rgb), .25); }
.seg button:disabled { cursor: default; }
.lbl-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; margin-bottom: 6px; }
.lbl-row .lbl { margin-bottom: 0; }
.presets { display: flex; gap: 4px; }
.preset { font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; border-radius: var(--radius-pill); padding: 3px 10px; border: 1px solid rgba(var(--color-brand-primary-rgb), .3); background: transparent; color: var(--color-brand-primary); }
.preset:hover { background: rgba(var(--color-brand-primary-rgb), .08); }
.seg.multi button { display: inline-flex; align-items: center; gap: 4px; padding-left: 10px; }
.seg .chk { font-size: 17px; }
.board .actions { display: inline-flex; }
.setting .desc { font-size: 12.5px; color: var(--color-text-subtle); margin-top: 6px; }
.check { display: flex; gap: var(--space-2); align-items: flex-start; margin-top: var(--space-5); font-weight: 500; cursor: pointer; }
.check small { color: var(--color-text-subtle); font-weight: 400; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--color-brand-primary); }
.lobby-actions { margin-top: var(--space-6); text-align: center; }

/* ---------- jogo ---------- */
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--space-5); align-items: start; }
.stage { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
.kpi {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: var(--space-3);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevation-1); padding: 10px 12px; min-height: 64px;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(135deg, var(--color-brand-primary), var(--color-brand-soft)); }
.kpi:nth-child(3)::before { background: var(--color-accent-500); }
.kpi:nth-child(4)::before { background: var(--color-warning); }
.kpi-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-md); background: var(--color-surface-muted); border: 1px solid var(--color-border); color: var(--color-brand-primary); font-size: 22px; flex-shrink: 0; }
.kpi-label { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-subtle); }
.kpi-value { font-size: 20px; font-weight: 700; line-height: 1.2; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--color-text-subtle); }

.word-card { text-align: center; padding: var(--space-5) var(--space-6) var(--space-6); overflow: hidden; }
.word-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); min-height: 28px; }
.mode-label { font-size: 12px; color: var(--color-text-subtle); display: inline-flex; align-items: center; gap: 4px; }
.mode-label .material-icons-round { font-size: 16px; }
.word-tiles { user-select: none; -webkit-user-select: none; display: flex; justify-content: center; flex-wrap: wrap; gap: var(--gap, 8px); margin: var(--space-5) 0; min-height: 90px; align-items: center; }
.word-tiles .tile { width: var(--tw, 58px); height: calc(var(--tw, 58px) * 1.2); font-size: calc(var(--tw, 58px) * .64); animation: drop .4s cubic-bezier(.3, 1.5, .6, 1) both; flex-shrink: 0; }
.word-tiles .tile.hidden-letter { color: transparent; background: repeating-linear-gradient(45deg, var(--color-surface-strong) 0 6px, var(--color-surface-muted) 6px 12px); animation: flip .45s ease both; }
.word-tiles.ok .tile { color: var(--color-success); border-color: rgba(var(--color-success-rgb), .45); box-shadow: 0 3px 0 rgba(var(--color-success-rgb), .45), var(--shadow-elevation-1); }
.word-tiles .countdown { font-family: var(--font-brand); font-size: 76px; font-weight: 800; color: var(--color-brand-primary); animation: pulse 1s ease infinite; }
.word-tiles .waiting { color: var(--color-text-subtle); }
@keyframes drop { from { transform: translateY(-20px); opacity: 0; } }
@keyframes flip { 0% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
@keyframes pulse { 50% { transform: scale(1.1); } }

.timer { height: 8px; background: var(--color-surface-strong); border-radius: var(--radius-pill); margin: 0 auto; max-width: 640px; overflow: hidden; }
.timer-bar { height: 100%; width: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--color-brand-primary), var(--color-brand-soft)); transform-origin: left; }
.timer-bar.warn { background: var(--color-warning); }
.timer-bar.danger { background: var(--color-danger); }
.timer-num { font-family: var(--font-mono); font-size: 13px; color: var(--color-text-subtle); margin: 6px 0 var(--space-4); min-height: 1.4em; }

.answer-form { display: flex; gap: var(--space-3); max-width: 640px; margin: 0 auto; }
.answer-input { font-family: var(--font-mono); font-size: 24px; text-align: center; padding: 12px 14px; }
.answer-input::placeholder { font-family: var(--font-sans); font-size: 16px; }
.answer-input.shake { animation: shake .35s; border-color: var(--color-danger); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.feedback { min-height: 28px; margin-top: var(--space-3); font-weight: 600; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.feedback.good { color: var(--color-success); }
.feedback.bad { color: var(--color-danger); }

.reveal-title { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-subtle); margin-bottom: var(--space-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.res {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-pill); padding: 4px 12px 4px 8px;
  font-size: 13px; font-weight: 500; border: 1px solid var(--color-border); background: var(--color-surface-muted); animation: pop .3s ease both;
}
.res.ok { border-color: rgba(var(--color-success-rgb), .32); background: var(--color-success-bg); }
.res.bad { border-color: rgba(var(--color-danger-rgb), .28); background: var(--color-danger-bg); }
.res .typed { font-family: var(--font-mono); text-decoration: line-through; color: var(--color-danger); }
.res .plus { font-weight: 700; color: var(--color-success); }
.res.bad .plus, .res.none .plus { color: var(--color-text-subtle); }

/* pista */
.track { padding: var(--space-5) var(--space-6); }
.lanes { display: flex; flex-direction: column; gap: 6px; }
.lane { display: grid; grid-template-columns: 200px minmax(0, 1fr) 76px; align-items: center; gap: var(--space-3); height: var(--lane-h, 48px); }
.lane .rank { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--color-text-subtle); min-width: 24px; }
.lane.lead .rank { color: #d4a017; }
.lane .score { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; line-height: 1.1; }
.lane .score-num { font-family: var(--font-mono); font-size: 20px; font-weight: 700; color: var(--color-text); }
.lane.lead .score-num { color: var(--color-success); }
.lane .score-gap { font-size: 11px; color: var(--color-text-subtle); white-space: nowrap; }
.lane.lead .score-gap { color: var(--color-success); font-weight: 600; }
.lanes.compact .score-gap { display: none; }
.lanes.compact .score-num { font-size: 16px; }
.lane-head { height: auto; margin-bottom: 18px; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-subtle); }
.lane-head .score { text-align: right; display: block; }
.ruler { position: relative; height: 16px; }
.ruler span { position: absolute; top: 0; transform: translateX(-50%); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0; text-transform: none; }
.ruler span.first { transform: none; }
.ruler span.last { transform: translateX(-100%); color: var(--color-accent-500); font-weight: 700; }
.lane .who { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13.5px; min-width: 0; }
.lane .who .nm { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.2; overflow-wrap: anywhere; }
.lane .who .done { color: var(--color-success); font-size: 18px; }
.lane.me .who .nm { font-weight: 700; color: var(--color-brand-primary); }
.lane.off { opacity: .4; }
.road { position: relative; height: 100%; border-radius: var(--radius-sm); background: linear-gradient(180deg, transparent 0 60%, var(--water) 60% 100%); }
.road::before { /* marcas de distância a cada 25% */
  content: ''; position: absolute; inset: 0 0 40% 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--color-border) calc(25% - 1px) 25%);
  opacity: .7;
}
.bridge {
  position: absolute; left: 0; bottom: 40%; height: 28%; width: 0; min-width: 3px;
  background-color: var(--c);
  background-image: linear-gradient(90deg, rgba(0, 0, 0, .2) 1px, transparent 1px), linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(0, 0, 0, .06));
  background-size: var(--brick, 10px) 100%, 100% 100%;
  border-radius: 3px; box-shadow: 0 2px 0 rgba(0, 0, 0, .12);
  transition: width 1s cubic-bezier(.25, .9, .3, 1); z-index: 1;
}
.runner { position: absolute; left: 0; bottom: 66%; font-size: calc(var(--lane-h, 46px) * .58); line-height: 1; transform: translateX(-50%); transition: left 1s cubic-bezier(.25, .9, .3, 1); z-index: 2; }
.runner.jump { animation: jump .6s ease; }
@keyframes jump { 40% { translate: 0 -12px; } }
.gain { position: absolute; bottom: 92%; transform: translateX(-50%); font-weight: 700; font-size: 13px; color: var(--color-success); white-space: nowrap; animation: floatUp 1.8s ease forwards; z-index: 3; }
.gain.small { color: var(--color-text-subtle); }
@keyframes floatUp { from { opacity: 0; translate: 0 6px; } 15% { opacity: 1; } to { opacity: 0; translate: 0 -20px; } }
.road::after { /* linha de chegada */
  content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 0;
  border-right: 3px dashed var(--color-accent-500); opacity: .8;
}

/* placar */
.leaderboard { padding: var(--space-5); }
.board { list-style: none; padding: 0; margin: 0 0 var(--space-4); display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow-y: auto; }
.board li { display: grid; grid-template-columns: 24px 26px minmax(0, 1fr) auto auto; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--radius-md); font-weight: 500; font-size: 14px; }
.board li.me { background: rgba(var(--color-brand-primary-rgb), .08); }
.board .pos { font-weight: 700; color: var(--color-text-subtle); text-align: center; font-size: 13px; }
.board li:nth-child(1) .pos { color: #d4a017; } .board li:nth-child(2) .pos { color: #9aa6bf; } .board li:nth-child(3) .pos { color: #c47c3c; }
.board .av { font-size: 18px; }
.board .nm { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.2; overflow-wrap: anywhere; }
.board .bl { font-family: var(--font-mono); font-weight: 700; color: var(--color-brand-primary); }

/* regras no jogo */
.rules-box { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--color-border); }
.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.rules li { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; }
.rules li .material-icons-round { font-size: 17px; color: var(--color-brand-primary); }
.rules .r-label { color: var(--color-text-muted); }
.rules b { font-weight: 600; text-align: right; }
.rules-note { margin-top: var(--space-3); font-size: 12px; color: var(--color-text-subtle); }

/* ---------- pódio ---------- */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
.podium-wrap { max-width: 860px; align-items: center; }
.podium-head { text-align: center; }
.podium-head .title { font-family: var(--font-brand); font-weight: 800; font-size: clamp(32px, 5vw, 46px); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: var(--space-3); width: 100%; }
.step { display: flex; flex-direction: column; align-items: center; width: min(30%, 210px); }
.step .av { font-size: 54px; animation: hop 2s ease-in-out infinite; }
.step .nm { font-weight: 700; font-size: 16px; text-align: center; max-width: 100%; line-height: 1.2; overflow-wrap: anywhere; }
.step .bl { color: var(--color-text-subtle); font-size: 13px; margin-bottom: var(--space-2); }
.step .block {
  width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; display: flex; justify-content: center; padding-top: var(--space-3);
  font-family: var(--font-brand); font-size: 40px; font-weight: 800; color: #fff;
  background: linear-gradient(160deg, var(--color-brand-400), var(--color-brand-500)); box-shadow: var(--shadow-elevation-2);
  transform-origin: bottom; animation: grow .8s cubic-bezier(.3, 1.3, .6, 1) both;
}
.step.p1 .block { height: 170px; animation-delay: .6s; background: linear-gradient(160deg, #a3e635, #65a30d); }
.step.p2 .block { height: 120px; animation-delay: .3s; }
.step.p3 .block { height: 86px; background: linear-gradient(160deg, var(--color-brand-300), var(--color-brand-400)); }
@keyframes grow { from { transform: scaleY(0); } }
.results-card { width: 100%; overflow-x: auto; padding: var(--space-3) var(--space-5); }
.results { width: 100%; border-collapse: collapse; font-size: 14px; }
.results th { text-align: left; color: var(--color-text-subtle); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: 10px 8px; }
.results td { padding: 10px 8px; border-top: 1px solid var(--color-border); }
.results td.num { font-family: var(--font-mono); }
.results tr.me td { background: rgba(var(--color-brand-primary-rgb), .06); }
.podium-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; justify-content: center; align-items: center; }

/* ---------- janela de confirmação (app-modal) ---------- */
.dialog-overlay {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: var(--space-4);
  background: rgba(18, 22, 34, .52); backdrop-filter: blur(2px); animation: fade .15s ease;
}
.dark-theme .dialog-overlay { background: rgba(7, 9, 14, .65); }
.dialog {
  width: min(420px, 100%); background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); box-shadow: 0 20px 50px rgba(20, 26, 38, .18), var(--shadow-elevation-2);
  padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); animation: pop .18s ease;
}
.dialog-title { font-size: 18px; font-weight: 700; }
.dialog-msg { color: var(--color-text-muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }
.btn-danger-solid { background: var(--color-danger); color: #fff; border-color: transparent; box-shadow: 0 10px 22px rgba(var(--color-danger-rgb), .28); }
@keyframes fade { from { opacity: 0; } }

/* ---------- toast / conexão ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 160%); z-index: 50; max-width: calc(100% - 32px);
  background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); border-left: 3px solid var(--color-brand-primary);
  box-shadow: var(--shadow-elevation-2); padding: 12px 18px; border-radius: var(--radius-md); font-weight: 500; transition: transform .25s ease;
}
.toast.show { transform: translate(-50%, 0); }
.conn { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 6px; background: var(--color-danger); color: #fff; padding: 6px 16px; border-radius: var(--radius-pill); font-weight: 600; font-size: 13px; box-shadow: var(--shadow-elevation-2); }

@media (max-width: 960px) {
  .game-grid { grid-template-columns: 1fr; }
  .leaderboard { position: static; }
  .lobby-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .screen { padding: var(--space-4) var(--space-4) 40px; }
  .card { padding: var(--space-4); border-radius: var(--radius-lg); }
  .brand-logo, .brand-sep { display: none; }
  .lane { grid-template-columns: 96px minmax(0, 1fr) 44px; gap: var(--space-2); }
  .lane .rank { display: none; }
  .lane .score-num { font-size: 16px; }
  .lane .score-gap { display: none; }
  .lane .who { font-size: 12px; }
  .room-code .tile { width: 52px; height: 60px; font-size: 32px; }
  .answer-form { flex-direction: column; }
  .answer-input { font-size: 20px; }
  .join-box { grid-template-columns: 1fr; }
  .invite { flex-direction: column; }
  .page-icon { display: none; }
  .track { padding: var(--space-4); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
