/* ==========================================================================
   RESENHA DOS CASAIS — Tactile Editorial Party Arcade Design System
   Mobile-first (320px–1440px+), Warm Charcoal + Cream Paper + Brazilian Accents
   ========================================================================== */

:root {
  --bg: #14110F;
  --bg-elev: #1E1916;
  --bg-card: #26201C;
  --bg-card-hover: #302823;
  --paper: #FAF6F0;
  --paper-ink: #1B1613;
  --paper-muted: #5C5047;

  --ink: #FAF6F0;
  --ink-soft: #CFC4B8;
  --ink-muted: #988B7E;
  --line: rgba(250, 246, 240, 0.10);
  --line-strong: rgba(250, 246, 240, 0.20);

  --brasa: #FF5A36;
  --brasa-dark: #CC3B1C;
  --ouro: #F5A524;
  --ouro-dark: #C27B0A;
  --menta: #25C281;
  --menta-dark: #16915E;
  --turquesa: #22B8CF;
  --turquesa-dark: #12899C;
  --framboesa: #E63963;
  --framboesa-dark: #B52046;
  --acai: #A855F7;

  --font-display: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-full: 999px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.48;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  border: none;
  background: none;
}

img {
  display: block;
  max-width: 100%;
}

/* --- Ambient Atmosphere --- */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
}

.orb-1 {
  width: 340px;
  height: 340px;
  background: var(--brasa);
  top: -110px;
  right: -90px;
}

.orb-2 {
  width: 320px;
  height: 320px;
  background: var(--ouro);
  bottom: -120px;
  left: -100px;
  opacity: 0.14;
}

.ambient-grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: radial-gradient(rgba(255,255,255,0.6) 0.5px, transparent 0.5px);
  background-size: 6px 6px;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* --- App Shell --- */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: calc(10px + var(--safe-top)) 14px calc(86px + var(--safe-bottom));
}

.app-shell.no-nav {
  padding-bottom: calc(28px + var(--safe-bottom));
}

.boot-loader {
  margin: auto;
  text-align: center;
  padding: 40px 20px;
}

.boot-mark {
  display: inline-flex;
  animation: pulseSoft 1.5s ease-in-out infinite;
}

.boot-text {
  margin-top: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}

/* --- Typography --- */
.h1, .h2, .h3, h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.h1 { font-size: clamp(1.7rem, 6vw, 2.55rem); font-weight: 800; }
.h2 { font-size: clamp(1.3rem, 4.5vw, 1.75rem); font-weight: 700; }
.h3 { font-size: 1.1rem; font-weight: 700; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-muted); }
.soft { color: var(--ink-soft); }

/* --- Top Header --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0 14px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.08rem;
  line-height: 1.05;
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--ink-muted);
  display: block;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  position: relative;
  transition: transform 0.14s ease, background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover { background: var(--bg-card-hover); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }

.notif-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--framboesa);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 99px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  max-width: 170px;
}

.user-pill span {
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Bottom Mobile Navigation --- */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + var(--safe-bottom));
  width: min(calc(100% - 24px), 520px);
  background: rgba(30, 25, 22, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 6px;
  display: flex;
  justify-content: space-around;
  gap: 4px;
  z-index: 100;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px;
  border-radius: 14px;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 700;
  position: relative;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item svg { width: 20px; height: 20px; }
.nav-item.active {
  background: var(--brasa);
  color: #fff;
}

/* --- Tactile Cards & Surfaces --- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
}

.card-paper {
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: var(--r-md);
  padding: 18px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}

.card-paper .muted { color: var(--paper-muted); }

.card-highlight {
  background: linear-gradient(135deg, rgba(255,90,54,0.16), rgba(245,165,36,0.09));
  border: 1px solid rgba(255,90,54,0.38);
}

/* --- Tactile Arcade Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 11px 18px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.95rem;
  transition: transform 0.1s ease, filter 0.15s ease, background 0.15s ease;
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: translateY(2px);
}

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

.btn-primary {
  background: var(--brasa);
  color: #fff;
  box-shadow: 0 4px 0 var(--brasa-dark);
}

.btn-primary:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--brasa-dark);
}

.btn-gold {
  background: var(--ouro);
  color: #1B140A;
  box-shadow: 0 4px 0 var(--ouro-dark);
}

.btn-gold:active:not(:disabled) { box-shadow: 0 1px 0 var(--ouro-dark); }

.btn-mint {
  background: var(--menta);
  color: #082317;
  box-shadow: 0 4px 0 var(--menta-dark);
}

.btn-mint:active:not(:disabled) { box-shadow: 0 1px 0 var(--menta-dark); }

.btn-cyan {
  background: var(--turquesa);
  color: #062126;
  box-shadow: 0 4px 0 var(--turquesa-dark);
}

.btn-danger {
  background: var(--framboesa);
  color: #fff;
  box-shadow: 0 4px 0 var(--framboesa-dark);
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.btn-ghost:hover { background: var(--bg-card-hover); }

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 10px;
}

.btn-lg {
  min-height: 56px;
  font-size: 1.05rem;
  padding: 14px 22px;
}

.btn-block { width: 100%; }

/* --- Badges & Chips --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.badge-brasa { background: rgba(255,90,54,0.18); color: #FF947B; border-color: rgba(255,90,54,0.35); }
.badge-mint { background: rgba(37,194,129,0.18); color: #7EEBC0; border-color: rgba(37,194,129,0.35); }
.badge-gold { background: rgba(245,165,36,0.18); color: #FFD07A; border-color: rgba(245,165,36,0.35); }
.badge-cyan { background: rgba(34,184,207,0.18); color: #7AE6F7; border-color: rgba(34,184,207,0.35); }
.badge-danger { background: rgba(230,57,99,0.2); color: #FF8AA6; border-color: rgba(230,57,99,0.4); }

/* --- Avatars --- */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.15);
  background: var(--bg-card);
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.av-xs { width: 28px; height: 28px; font-size: 0.75rem; }
.av-sm { width: 34px; height: 34px; font-size: 0.85rem; }
.av-md { width: 48px; height: 48px; font-size: 1.15rem; }
.av-lg { width: 72px; height: 72px; font-size: 1.65rem; }
.av-xl { width: 96px; height: 96px; font-size: 2.1rem; }

/* --- Forms & Inputs --- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.input, .textarea, .select {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brasa);
  box-shadow: 0 0 0 3px rgba(255,90,54,0.22);
}

.textarea {
  resize: vertical;
  min-height: 84px;
}

/* --- Login Profile Wall (Netflix / Switch Style) --- */
.login-hero {
  text-align: center;
  padding: 14px 4px 20px;
}

.login-hero .logo-big {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
}

.login-hero p {
  color: var(--ink-soft);
  margin: 8px auto 0;
  max-width: 440px;
  font-size: 0.94rem;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.profile-tile {
  background: var(--bg-elev);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.profile-tile:hover {
  transform: translateY(-3px);
  border-color: var(--brasa);
  background: var(--bg-card);
}

.profile-tile:active { transform: scale(0.96); }

.profile-tile .p-name {
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-tile .p-couple {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-tile.add-new {
  border-style: dashed;
  border-color: rgba(255,90,54,0.5);
  background: rgba(255,90,54,0.07);
}

/* --- 4-Digit PIN Numeric Keypad --- */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 18px;
}

.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.pin-dot.filled {
  background: var(--brasa);
  border-color: var(--brasa);
  transform: scale(1.15);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 280px;
  margin: 0 auto;
}

.pin-key {
  height: 56px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s ease, transform 0.08s ease;
}

.pin-key:active {
  background: var(--brasa);
  color: #fff;
  transform: scale(0.95);
}

.pin-key.muted-key {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* --- Photo Picker --- */
.photo-uploader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.photo-preview-ring {
  position: relative;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, var(--brasa), var(--ouro));
  cursor: pointer;
}

.photo-preview-ring .avatar {
  width: 100%;
  height: 100%;
  border: 3px solid var(--bg-elev);
}

.photo-cam-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--paper-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.preset-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.preset-swatch.selected {
  border-color: #fff;
  transform: scale(1.14);
}

/* --- Hub & Bento Games Showcase --- */
.hub-banner {
  background: linear-gradient(125deg, #271E19 0%, #1C1613 60%, #2D1B14 100%);
  border: 1px solid rgba(255,90,54,0.3);
  border-radius: var(--r-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
}

.hub-banner-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 720px) {
  .hub-banner-grid {
    grid-template-columns: 1.3fr 1fr;
    align-items: center;
  }
}

.quick-join-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.code-input {
  text-transform: uppercase;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
  max-width: 145px;
}

.rooms-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.room-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.16s ease, transform 0.14s ease;
}

.room-card:hover { border-color: var(--ouro); transform: translateY(-2px); }

.room-code-pill {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(245,165,36,0.16);
  color: var(--ouro);
  border: 1px solid rgba(245,165,36,0.35);
}

/* Asymmetric / Editorial Game Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(162px, 1fr));
  gap: 12px;
}

@media (min-width: 640px) {
  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }
}

.game-card {
  background: var(--bg-elev);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 15px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--game-accent, var(--brasa));
  background: var(--bg-card);
}

.game-card:active { transform: scale(0.98); }

.game-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--game-accent, var(--brasa)) 18%, transparent);
  color: var(--game-accent, var(--brasa));
  border: 1px solid color-mix(in srgb, var(--game-accent, var(--brasa)) 40%, transparent);
}

.game-icon-box svg { width: 24px; height: 24px; }

.game-card-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.15;
}

.game-card-sub {
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.35;
}

.game-card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

/* --- Room Lobby & Scoreboard --- */
.room-header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 14px;
}

.members-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 5px;
  border-radius: 99px;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  font-size: 0.82rem;
  font-weight: 700;
}

.member-chip.done {
  border-color: var(--menta);
  background: rgba(37,194,129,0.14);
}

.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}

.segmented button {
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.segmented button.active {
  background: var(--brasa);
  color: #fff;
}

/* --- Game Stage Shared Components --- */
.game-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.prompt-card {
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 20px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

.prompt-card .prompt-cat {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(255,90,54,0.14);
  color: var(--brasa-dark);
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.prompt-card .prompt-q {
  font-family: var(--font-display);
  font-size: clamp(1.22rem, 4.8vw, 1.65rem);
  font-weight: 800;
  line-height: 1.22;
}

/* Hold-to-Reveal Secret Card (Impostor) */
.secret-card {
  position: relative;
  border-radius: 20px;
  padding: 28px 18px;
  text-align: center;
  background: var(--bg-card);
  border: 2px dashed var(--line-strong);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.secret-card.revealed {
  background: var(--paper);
  color: var(--paper-ink);
  border-style: solid;
  border-color: var(--ouro);
  transform: scale(1.01);
}

.secret-card.revealed.is-impostor {
  background: #3A101B;
  color: #FFE4EA;
  border-color: var(--framboesa);
}

/* Choice Grid */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
  font-size: 0.96rem;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}

.choice-btn:hover { background: var(--bg-card-hover); }
.choice-btn.selected { border-color: var(--brasa); background: rgba(255,90,54,0.16); }
.choice-btn.correct { border-color: var(--menta); background: rgba(37,194,129,0.18); }

/* Drawing Canvas (Telefone Sem Fio) */
.canvas-wrap {
  background: #FFFFFF;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid var(--line-strong);
  touch-action: none;
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.draw-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.2);
}

.color-dot.active {
  border-color: #fff;
  transform: scale(1.18);
  box-shadow: 0 0 0 2px var(--brasa);
}

/* Wavelength / Termômetro Semicircle */
.thermo-wrap {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  text-align: center;
}

.thermo-svg {
  width: 100%;
  height: auto;
  display: block;
}

.thermo-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  font-weight: 800;
  font-size: 0.88rem;
}

.thermo-slider {
  width: 100%;
  height: 40px;
  accent-color: var(--brasa);
  margin: 10px 0;
}

/* Bomba das Categorias */
.bomb-arena {
  text-align: center;
  padding: 22px 16px;
  border-radius: 22px;
  background: var(--bg-elev);
  border: 2px solid var(--line);
}

.bomb-arena.holding {
  border-color: var(--framboesa);
  background: radial-gradient(circle at center, rgba(230,57,99,0.28), rgba(20,17,15,0.95));
  animation: bombPulse var(--pulse-speed, 0.9s) ease-in-out infinite;
}

.bomb-pass-btn {
  width: 100%;
  max-width: 320px;
  min-height: 92px;
  border-radius: 24px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  background: var(--framboesa);
  color: #fff;
  box-shadow: 0 8px 0 var(--framboesa-dark);
  margin: 14px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.bomb-pass-btn:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--framboesa-dark);
}

@keyframes bombPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230,57,99,0.5); }
  50% { box-shadow: 0 0 36px 8px rgba(230,57,99,0.35); }
}

/* Codenames 5x5 Grid (Mobile-Optimized!) */
.code-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

@media (min-width: 540px) {
  .code-grid { gap: 8px; }
}

.code-tile {
  aspect-ratio: 1.15 / 1;
  min-height: 52px;
  padding: 4px 3px;
  border-radius: 10px;
  background: var(--paper);
  color: var(--paper-ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.6rem, 2.3vw, 0.86rem);
  line-height: 1.08;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
  border: 2px solid transparent;
  box-shadow: 0 3px 0 rgba(0,0,0,0.3);
  transition: transform 0.12s ease, background 0.16s ease;
}

.code-tile:active:not(:disabled) { transform: scale(0.95); }

.code-tile.spy-brasa { border-color: var(--brasa); background: #FFE2DA; color: #7C1B07; }
.code-tile.spy-turquesa { border-color: var(--turquesa); background: #D7F6FA; color: #084852; }
.code-tile.spy-neutral { border-color: #B5A89A; background: #EDE6DC; color: #544A40; }
.code-tile.spy-bomb { border-color: #111; background: #2D2624; color: #FF7B9B; }

.code-tile.rev-brasa { background: var(--brasa); color: #fff; border-color: #FF8C73; }
.code-tile.rev-turquesa { background: var(--turquesa); color: #05262B; border-color: #79E6F5; }
.code-tile.rev-neutral { background: #4F453E; color: #D8CFC6; opacity: 0.72; }
.code-tile.rev-bomb { background: #111; color: var(--framboesa); border-color: var(--framboesa); }

/* Duelo 1x1 (Batalha de Desculpas) */
.duel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 560px) {
  .duel-grid { grid-template-columns: 1fr 1fr; }
}

.duel-card {
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 18px;
  padding: 20px 16px;
  text-align: center;
  border: 3px solid transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 140px;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.duel-card:hover { transform: translateY(-2px); border-color: var(--brasa); }
.duel-card.selected { border-color: var(--menta); box-shadow: 0 0 0 3px rgba(37,194,129,0.3); }

/* Bar chart for Quem na Roda */
.bar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.bar-track {
  height: 12px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--brasa);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Manual Accordion & Guide */
.manual-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.manual-step {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: rgba(255,255,255,0.04);
  padding: 11px 12px;
  border-radius: 12px;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brasa);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Modal / Bottom Sheet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 7, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  z-index: 500;
  animation: fadeIn 0.16s ease;
}

@media (min-width: 600px) {
  .modal-backdrop { align-items: center; }
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 20px 18px calc(20px + var(--safe-bottom));
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: slideUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

/* Toasts */
.toast-root {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 420px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 900;
  pointer-events: none;
}

.toast {
  background: var(--paper);
  color: var(--paper-ink);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
  border-bottom: 4px solid var(--brasa);
  animation: slideDown 0.18s ease;
}

.toast.ok { border-bottom-color: var(--menta); }
.toast.err { border-bottom-color: var(--framboesa); }

/* Utilities */
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 20px; }
.text-center { text-align: center; }

.qr-box {
  background: #fff;
  padding: 12px;
  border-radius: 16px;
  display: inline-block;
  margin: 8px auto;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
}

.score-row.top1 {
  background: linear-gradient(90deg, rgba(245,165,36,0.2), rgba(255,90,54,0.1));
  border-color: rgba(245,165,36,0.45);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
}

.toggle {
  width: 48px;
  height: 28px;
  border-radius: 99px;
  background: #463B34;
  position: relative;
  flex-shrink: 0;
  transition: background 0.16s ease;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s ease;
}

.toggle.on { background: var(--menta); }
.toggle.on::after { transform: translateX(20px); }

@keyframes pulseSoft {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
