@import url('./fonts.css');

/* ==========================================================================
   Cartas à Solta · identidade "Algodão doce"
   Contorno de desenho (tinta), cartas com borda inferior grossa (profundidade),
   lilás de fundo, roxo nas perguntas, rosa para escolha, amarelo do mascote.
   ========================================================================== */
:root {
  --bg: #f1ecff;
  --bg-deep: #e6ddff;
  --paper: #ffffff;
  --ink: #2b2350;
  --ink-soft: #5b5285;
  --violet: #6c4cf0;
  --violet-soft: #d9cfff;
  --pink: #ff7eb6;
  --pink-soft: #ffe0ee;
  --yellow: #ffd166;
  --yellow-soft: #fff1c9;
  --mint: #6ee7b7;
  --sky: #a8e1ff;
  --line: 2.5px solid var(--ink);
  --edge: 0 5px 0 var(--ink);
  --edge-sm: 0 3px 0 var(--ink);
  --radius: 18px;
  --display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
  font-family: var(--body);
  color: var(--ink);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; line-height: 1.1; letter-spacing: -.2px; }
p { margin: 0; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 12px; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.muted { color: var(--ink-soft); font-size: 14px; line-height: 1.5; }

/* ---------- Superfícies e botões ---------- */
.panel { background: var(--paper); border: var(--line); border-radius: 24px; box-shadow: var(--edge); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; font-family: var(--display); font-weight: 600; font-size: 14px; line-height: 1.2; box-shadow: var(--edge-sm); }
.primary-button, .outline-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border: var(--line); border-radius: 16px;
  font-family: var(--display); font-weight: 600; font-size: 17px; line-height: 1.1;
  box-shadow: 0 4px 0 var(--ink); transition: transform .12s, box-shadow .12s, background-color .15s;
}
.primary-button { background: var(--pink); color: var(--ink); }
.outline-button { background: var(--paper); color: var(--ink); }
.primary-button:hover:not(:disabled) { background: #ff94c3; }
.outline-button:hover:not(:disabled) { background: var(--pink-soft); }
.primary-button:active:not(:disabled), .outline-button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.primary-button:disabled, .outline-button:disabled { background: #ece8f7; color: #8d86ab; border-color: #b9b2d3; box-shadow: 0 4px 0 #b9b2d3; }
.wide { width: 100%; }
.text-button { background: none; border: 0; padding: 6px 2px; color: var(--ink-soft); font-weight: 800; font-size: 14px; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--violet-soft); }
.text-button:hover { color: var(--ink); text-decoration-color: var(--pink); }
.icon-button { display: inline-grid; place-items: center; width: 46px; height: 46px; flex: none; padding: 0; background: var(--paper); border: var(--line); border-radius: 50%; box-shadow: var(--edge-sm); font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1; transition: transform .12s, box-shadow .12s, background-color .15s; }
.icon-button:hover { background: var(--yellow-soft); }
.icon-button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Formulários ---------- */
label { display: flex; flex-direction: column; gap: 7px; font-size: 14px; font-weight: 800; }
input { width: 100%; min-height: 48px; padding: 11px 14px; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; font-weight: 700; font-size: 16px; outline: none; transition: box-shadow .15s; }
input::placeholder { color: #9a93b8; font-weight: 600; }
input:focus { box-shadow: 0 0 0 4px var(--violet-soft); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.field-help { font-size: 13px; line-height: 1.45; color: var(--ink-soft); font-weight: 700; }

/* ---------- Topo ---------- */
.app-shell { max-width: 1240px; margin: 0 auto; padding: 18px 24px 22px; min-height: 100dvh; display: flex; flex-direction: column; gap: 16px; }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; margin-right: auto; flex: none; }
.brand-mascot { width: 34px; height: 38px; overflow: visible; transition: transform .3s var(--bounce); }
.brand:hover .brand-mascot { transform: rotate(-10deg) translateY(-2px); }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: -.4px; line-height: 1; }
.room-header { display: none; }
.mobile-players { display: none; }
.mobile-menu, .chat-trigger { display: none; }
.chat-trigger { position: relative; }

/* ---------- Home ---------- */
.entry-screen { flex: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px); gap: 40px; align-items: center; padding: 10px 0 20px; }
.entry-copy h1 { font-size: clamp(40px, 5.2vw, 66px); font-weight: 700; line-height: 1.02; letter-spacing: -1px; }
.entry-lead { margin-top: 16px; max-width: 520px; font-size: 18px; line-height: 1.5; color: var(--ink-soft); }
.entry-details { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.entry-details li { padding: 5px 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); font-size: 13px; font-weight: 800; }
.entry-details li:nth-child(1) { background: var(--yellow-soft); }
.entry-details li:nth-child(2) { background: #dcf6ff; }
.entry-details li:nth-child(3) { background: #d8f8ea; }
.hero { position: relative; height: 360px; margin-top: 10px; }
.hero canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: pointer; opacity: 0; transition: opacity .6s; }
.hero.has-3d canvas { opacity: 1; }
.hero-fallback { position: absolute; inset: 0; transition: opacity .35s, transform .35s; }
.hero.has-3d .hero-fallback { opacity: 0; transform: translateY(16px) scale(.96); visibility: hidden; transition: opacity .35s, transform .35s, visibility 0s .35s; }
.mini-card { position: absolute; width: 190px; height: 250px; padding: 22px 20px; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 7px 0 var(--ink); display: flex; flex-direction: column; gap: 10px; }
.mini-card small { font-family: var(--display); font-size: 14px; font-weight: 600; opacity: .85; }
.mini-card b { font-family: var(--display); font-weight: 600; font-size: 25px; line-height: 1.12; }
.mini-question { left: 6%; top: 30px; background: var(--violet); color: #fff; transform: rotate(-7deg); }
.mini-answer { left: calc(6% + 170px); top: 54px; background: var(--paper); transform: rotate(8deg); }
.mini-mascot { position: absolute; left: calc(6% + 330px); top: 10px; width: 78px; height: 88px; overflow: visible; transform: rotate(12deg); }
.entry-form { padding: 28px 26px 22px; display: flex; flex-direction: column; gap: 16px; }
.entry-form h2 { font-size: 32px; }
#entry-help:empty { display: none; }
#entry-help { font-size: 14px; color: var(--ink-soft); line-height: 1.45; margin-top: -6px; }
#entry-form, #join-link-form { display: flex; flex-direction: column; gap: 14px; }
.entry-footnote { font-size: 12px; color: var(--ink-soft); text-align: center; }
.page-footer { text-align: center; font-size: 12px; color: var(--ink-soft); }

/* ---------- Mesa ---------- */
.in-room .app-shell { height: 100dvh; min-height: 0; max-width: none; padding: 12px 18px 14px; gap: 12px; }
.in-room .page-footer { display: none; }
.in-room .brand { margin-right: 0; }
.in-room .brand-name { font-size: 23px; }
.in-room .room-header { display: flex; align-items: baseline; gap: 10px; min-width: 0; margin-right: auto; padding: 6px 14px; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; box-shadow: var(--edge-sm); }
.room-title { font-family: var(--display); font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.header-goal { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.in-room .chat-trigger { display: inline-grid; }
.chat-dot { position: absolute; right: 2px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--pink); border: 2px solid var(--ink); display: none; }
.chat-trigger.unread .chat-dot { display: block; }
.table-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 18px; }

.players-panel { display: flex; flex-direction: column; min-height: 0; padding: 16px 14px 14px; }
.players-heading { font-size: 20px; display: flex; align-items: baseline; gap: 8px; padding: 0 4px 10px; }
.players-heading span { font-family: var(--body); font-size: 13px; color: var(--ink-soft); font-weight: 800; }
.players-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px; }
.player-row { display: flex; align-items: center; gap: 9px; padding: 8px 6px; border-radius: 16px; }
.player-row.me { background: var(--bg); }
.player-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.player-name { display: flex; align-items: center; gap: 5px; min-width: 0; font-weight: 900; font-size: 15px; line-height: 1.2; }
.player-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you-badge { flex: none; font-size: 10px; font-weight: 900; padding: 0 6px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--pink-soft); }
.player-status { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.score { min-width: 34px; padding: 3px 7px; text-align: center; font-family: var(--display); font-weight: 700; font-size: 18px; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; display: inline-block; }
.player-row.offline { opacity: .5; }
.sidebar-bottom { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 2px dashed var(--violet-soft); margin-top: 8px; }
.round-goal { text-align: center; font-size: 13px; color: var(--ink-soft); }
.round-goal strong { color: var(--ink); }
.sidebar-links { display: flex; justify-content: space-between; }

.avatar { --size: 40px; position: relative; display: inline-grid; place-items: center; width: var(--size); height: var(--size); flex: none; border-radius: 50%; background: var(--tok, var(--yellow)); border: 2.5px solid var(--ink); font-family: var(--display); font-weight: 700; font-size: calc(var(--size) * .44); line-height: 1; color: var(--ink); }
.avatar.anon { background: var(--violet); color: #fff; }
.avatar.anon svg { width: 62%; height: 62%; overflow: visible; }
.online-dot { position: absolute; right: -2px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--mint); border: 2px solid var(--ink); }

.game-panel { position: relative; min-width: 0; min-height: 0; }
#round-content { position: relative; height: 100%; min-height: 0; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; gap: 12px; }
.game-meta { position: absolute; z-index: 2; top: 6px; left: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.connection-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.connection-chip > span { width: 9px; height: 9px; border-radius: 50%; background: #2fbf86; border: 1.5px solid var(--ink); }
.connection-chip.reconnecting > span { background: var(--pink); }

.question-block { position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 6px; }
.question-card {
  position: relative; width: min(100% - 250px, 860px); max-height: clamp(110px, 26dvh, 220px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--yellow) var(--violet);
  display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 10px;
  padding: 20px 56px 16px; background: var(--violet); color: #fff; border: 3px solid var(--ink); border-radius: 26px; box-shadow: 0 6px 0 var(--ink); text-align: center;
}
.question-card h1 { font-size: clamp(21px, 2.15vw, 31px); font-weight: 600; line-height: 1.18; text-wrap: balance; overflow-wrap: anywhere; }
.question-card h1 .w { display: inline-block; }
.question-required { flex: none; padding: 3px 12px; background: #ffffff26; border: 1.5px solid #ffffff80; border-radius: 999px; font-size: 12px; font-weight: 800; }
.question-mascot { position: absolute; top: -18px; right: calc(50% - min(50% - 125px, 430px) - 14px); width: 58px; height: 66px; overflow: visible; transform: rotate(14deg); transform-origin: 50% 100%; }
.question-mascot path, .victory-mascot path { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.question-mascot .m-body, .victory-mascot .m-body { fill: var(--yellow); stroke: var(--ink); stroke-width: 3.5; }
.question-mascot .m-eyes circle { fill: var(--ink); }
.question-mascot .m-cheek, .victory-mascot .m-cheek { fill: #ff9cc4; stroke: none; }
.question-mascot .m-mouth { stroke-width: 3.2; }
.question-scroll-hint { margin-top: 8px; font-size: 11px; color: var(--ink-soft); }

.round-tabs { display: none; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.section-heading h2 { font-size: 20px; }
#hand-hint { font-size: 12px; color: var(--ink-soft); font-weight: 800; text-align: right; }
.answers-heading { align-items: center; }
.answers-heading h2 { margin-right: auto; }
.outline-button.small { min-height: 40px; padding: 6px 14px; font-size: 15px; border-radius: 13px; box-shadow: var(--edge-sm); }

.hand-section { min-height: 0; }
.hand-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 10px 4px 8px; }
.hand-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.hand-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.hand-card { position: relative; min-width: 0; padding: 0; background: none; border: 0; text-align: left; display: flex; }
.card-face {
  position: relative; flex: 1; min-height: 120px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  padding: 14px 14px 10px; background: var(--paper); border: var(--line); border-radius: var(--radius); box-shadow: var(--edge);
  transform: rotate(var(--tilt, 0deg)); transition: transform .28s var(--bounce), background-color .2s, box-shadow .2s;
}
.hand-card:not(:disabled):hover .card-face { transform: translateY(-6px) rotate(0deg); }
.hand-card.selected .card-face { background: var(--pink); transform: translateY(-10px) rotate(0deg); box-shadow: 0 8px 0 var(--ink); }
.hand-card.inactive:not(.selected) .card-face { opacity: .55; }
.card-text { font-weight: 900; font-size: clamp(15px, 1.2vw, 18px); line-height: 1.25; overflow-wrap: anywhere; }
.card-footer { display: flex; align-items: center; gap: 5px; min-height: 18px; }
.card-mascot { width: 15px; height: 17px; flex: none; opacity: .75; }
.card-mark { font-family: var(--display); font-weight: 600; font-size: 12px; color: var(--ink-soft); }
.selected .card-mark { color: var(--ink); }
.selected-badge:empty { display: none; }
.selected-badge { margin-left: auto; padding: 1px 8px; font-size: 11px; font-weight: 900; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 999px; }
.selection-number:empty { display: none; }
.selection-number { position: absolute; top: -12px; left: -8px; width: 28px; height: 28px; display: grid; place-items: center; background: var(--yellow); border: 2.5px solid var(--ink); border-radius: 50%; font-family: var(--display); font-weight: 700; font-size: 15px; }
.selection-bar { margin-top: 6px; padding: 7px 12px; font-size: 13px; font-weight: 800; background: var(--yellow-soft); border: 2px dashed var(--ink); border-radius: 12px; text-align: center; }

.answers-section { min-height: 0; display: flex; flex-direction: column; }
.answers-grid { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-content: start; gap: 16px; padding: 14px 6px 12px; }
.answers-grid:empty::after { content: 'As respostas vão aparecendo aqui.'; grid-column: 1 / -1; padding: 22px; text-align: center; color: var(--ink-soft); font-size: 14px; font-weight: 800; border: 2.5px dashed #b8acec; border-radius: 20px; }
.answer-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; background: var(--paper); border: var(--line); border-radius: 20px; box-shadow: var(--edge); }
.answer-owner { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.answer-owner .avatar { --size: 28px; border-width: 2px; }
.answer-text { flex: 1; font-size: clamp(15px, 1.15vw, 18px); line-height: 1.4; font-weight: 800; overflow-wrap: anywhere; }
.answer-fill { background: var(--yellow); border-radius: 6px; padding: 0 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; font-weight: 900; }
.combination-separator { display: block; height: 0; margin: 8px 0; border-top: 2px dashed var(--violet-soft); }
.vote-button { min-height: 44px; padding: 8px 12px; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--edge-sm); font-family: var(--display); font-weight: 600; font-size: 16px; transition: transform .12s, box-shadow .12s, background-color .15s; }
.vote-button:hover:not(:disabled) { background: var(--pink-soft); }
.vote-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.vote-button.voted { background: var(--pink); }
.vote-button:disabled:not(.voted) { background: #f2eefc; color: #857ea6; border-color: #c3bbe0; box-shadow: 0 3px 0 #c3bbe0; }
.vote-count:empty { display: none; }
.vote-count { position: absolute; top: -13px; left: 14px; padding: 2px 10px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; font-family: var(--display); font-weight: 700; font-size: 14px; }
.answer-card.winner { background: var(--yellow-soft); }
.sticker { position: absolute; z-index: 3; top: -16px; right: -10px; display: grid; place-items: center; width: 58px; height: 58px; padding: 6px; background: var(--pink); border: 2.5px solid var(--ink); border-radius: 50%; font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1; text-align: center; transform: rotate(12deg); pointer-events: none; }
.sticker.win { width: 70px; height: 70px; background: var(--mint); font-size: 16px; }

.round-status { font-size: 13px; color: var(--ink-soft); font-weight: 800; }
.result-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; background: var(--yellow); border: var(--line); border-radius: 22px; box-shadow: var(--edge); }
.result-banner h3 { font-size: 24px; font-weight: 700; }
.result-banner p { font-size: 14px; margin-top: 3px; }
.result-banner .primary-button { white-space: nowrap; }

/* ---------- Sala de espera ---------- */
.room-lobby { height: 100%; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 12px 6px 18px; text-align: center; }
.room-lobby h1 { font-size: clamp(32px, 3.4vw, 44px); font-weight: 700; }
#lobby-help { max-width: 560px; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.lobby-players { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; padding: 6px 0; }
.lobby-players > div { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 84px; }
.lobby-players .avatar { --size: 58px; box-shadow: var(--edge-sm); }
.lobby-players strong { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-players small { font-size: 11px; color: var(--ink-soft); font-weight: 800; }
.lobby-players .offline { opacity: .5; }
.lobby-settings { width: min(100%, 760px); padding: 20px 22px; text-align: left; flex: none; }
.lobby-settings h2 { font-size: 24px; margin-bottom: 14px; }
#settings-fields > label { margin-bottom: 14px; }
.settings-grid { display: grid; grid-template-columns: 1fr .8fr 1.4fr; gap: 12px; }
.dropdown-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; font-size: 14px; font-weight: 800; }
.themed-dropdown { position: relative; }
.themed-dropdown summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 10px 14px; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; font-size: 14px; font-weight: 800; cursor: pointer; }
.themed-dropdown summary::-webkit-details-marker { display: none; }
.dropdown-arrow { width: 10px; height: 10px; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: translateY(-3px) rotate(45deg); transition: transform .2s; flex: none; }
.themed-dropdown[open] summary { background: var(--bg); }
.themed-dropdown[open] .dropdown-arrow { transform: translateY(2px) rotate(-135deg); }
.dropdown-options { position: absolute; z-index: 6; top: calc(100% + 6px); left: 0; right: 0; padding: 6px; background: var(--paper); border: var(--line); border-radius: 16px; box-shadow: var(--edge); }
.dropdown-options label { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 10px; font-size: 14px; cursor: pointer; }
.dropdown-options label:hover { background: var(--bg); }
.dropdown-options label:has(input:checked) { background: var(--pink-soft); }
.dropdown-options input { appearance: none; width: 18px; height: 18px; min-height: 18px; flex: none; padding: 0; border: 2px solid var(--ink); border-radius: 50%; }
.dropdown-options input:checked { background: var(--pink); box-shadow: inset 0 0 0 3px var(--paper); }
#settings-fields:disabled summary { background: #f5f2fd; cursor: default; }
#settings-fields:disabled input:not([type='radio']) { background: #f5f2fd; }
#settings-fields:disabled .dropdown-arrow { display: none; }
#settings-note { margin: 12px 0 14px; }
.lobby-settings-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.lobby-foot { font-size: 13px; color: var(--ink-soft); }

/* ---------- Diálogos ---------- */
dialog { width: min(560px, calc(100% - 28px)); max-height: calc(100dvh - 40px); overflow: auto; padding: 24px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 26px; box-shadow: 0 8px 0 var(--ink); }
dialog::backdrop { background: #2b235070; backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dialog-heading h2 { font-size: 26px; }
.dialog-heading .icon-button { width: 40px; height: 40px; font-size: 22px; }
dialog > label { margin: 16px 0 10px; }
.invite-code { font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: 6px; text-align: center; }
.invite-link-label { margin-top: 20px !important; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
#confirm-message { font-size: 15px; line-height: 1.5; color: var(--ink-soft); }
.side-dialog { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(390px, 100%); border-radius: 26px 0 0 26px; border-right: 0; box-shadow: -6px 0 0 var(--ink); display: none; flex-direction: column; gap: 10px; }
.side-dialog[open] { display: flex; }
.side-dialog .players-list { flex: 1; }
.side-dialog .avatar { --size: 46px; }
.drawer-bottom { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.drawer-bottom .wide { margin-bottom: 4px; }
.chat-messages { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 2px; }
.chat-bubble { align-self: flex-start; max-width: 86%; padding: 8px 12px; background: var(--bg); border: 2px solid var(--ink); border-radius: 16px 16px 16px 4px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.chat-bubble strong { font-size: 12px; color: var(--ink-soft); }
.chat-bubble.mine { align-self: flex-end; background: var(--pink-soft); border-radius: 16px 16px 4px 16px; }
#chat-form { display: flex; gap: 8px; }
#chat-form .primary-button { width: 50px; padding: 0; flex: none; }
#chat-form svg { width: 20px; height: 20px; fill: var(--ink); }
.tutorial-dialog { width: min(660px, calc(100% - 28px)); }
.instructions { margin: 16px 0; padding-left: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.instructions li { counter-increment: step; position: relative; padding-left: 44px; font-size: 15px; line-height: 1.5; font-weight: 700; color: var(--ink-soft); }
.instructions li b { color: var(--ink); }
.instructions li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; display: grid; place-items: center; background: var(--yellow); border: 2px solid var(--ink); border-radius: 50%; font-family: var(--display); font-weight: 700; color: var(--ink); }
.tutorial-faq h3 { font-size: 20px; margin: 6px 0 8px; }
.tutorial-faq details { border-top: 2px dashed var(--violet-soft); padding: 10px 0; }
.tutorial-faq summary { cursor: pointer; font-weight: 900; }
.tutorial-faq details p { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
.info-note { margin-top: 12px; padding: 12px 14px; background: var(--bg); border-radius: 14px; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }

.victory-dialog { width: min(440px, calc(100% - 28px)); padding: 0; overflow: visible; background: transparent; border: 0; box-shadow: none; }
.victory-dialog::backdrop { background: #2b2350b0; backdrop-filter: blur(4px); }
.victory-particles { position: fixed; inset: 0; pointer-events: none; }
.victory-particles canvas { width: 100% !important; height: 100% !important; }
.victory-panel { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 64px 26px 24px; background: var(--paper); border: 3px solid var(--ink); border-radius: 28px; box-shadow: 0 8px 0 var(--ink); text-align: center; }
.victory-close { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; }
.victory-mascot { position: absolute; top: -62px; left: 50%; width: 104px; height: 118px; margin-left: -52px; overflow: visible; }
.victory-mascot .m-eyes path { stroke-width: 3.4; }
.victory-mascot .m-open { fill: #ff6f8f; stroke-width: 3; }
.victory-eyebrow { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--ink-soft); text-transform: lowercase; }
.victory-panel h2 { font-size: 34px; font-weight: 700; }
.victory-name { font-family: var(--display); font-weight: 700; font-size: 26px; padding: 2px 14px; background: var(--yellow); border: 2.5px solid var(--ink); border-radius: 14px; transform: rotate(-2deg); margin: 6px 0; }
.victory-score { font-weight: 900; font-size: 15px; }
.victory-message { color: var(--ink-soft); font-size: 15px; margin: 6px 0 10px; }
.victory-actions { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.victory-host-note { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

.toast { position: fixed; z-index: 40; left: 50%; bottom: 22px; max-width: calc(100vw - 30px); padding: 12px 20px; background: var(--ink); color: #fff; border-radius: 16px; font-family: var(--display); font-weight: 600; font-size: 16px; text-align: center; box-shadow: 0 5px 0 var(--violet); opacity: 0; transform: translate(-50%, 24px) scale(.96); transition: opacity .25s, transform .35s var(--bounce); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

.confetti-piece { position: fixed; z-index: 30; width: 10px; height: 14px; border: 1.5px solid var(--ink); border-radius: 3px; pointer-events: none; }

/* ---------- Telas médias ---------- */
@media (max-width: 1100px) and (min-width: 901px) {
  .table-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 14px; }
  .hand-grid { gap: 10px; }
  .card-face { padding: 12px 11px 9px; }
}
@media (min-width: 901px) and (max-height: 820px) {
  .in-room .app-shell { padding-top: 8px; padding-bottom: 10px; gap: 8px; }
  #round-content { gap: 8px; }
  .question-card { padding: 14px 52px 12px; max-height: clamp(96px, 22dvh, 170px); gap: 7px; }
  .question-card h1 { font-size: clamp(19px, 1.9vw, 26px); }
  .card-face { min-height: 92px; padding: 11px 12px 8px; }
  .question-mascot { width: 50px; height: 57px; top: -10px; }
  .result-banner { padding: 10px 16px; }
  .result-banner h3 { font-size: 21px; }
  .hand-grid { padding-top: 8px; }
  .section-heading { margin-bottom: 2px; }
  .section-heading h2 { font-size: 18px; }
  .answers-grid { padding-top: 12px; gap: 14px; }
}

/* ---------- Celular e tablet ---------- */
@media (max-width: 900px) {
  .app-shell { padding: 12px 14px 18px; gap: 12px; }
  .entry-screen { grid-template-columns: 1fr; gap: 18px; padding-top: 0; }
  .hero { height: 260px; margin-top: 8px; }
  .mini-card { width: 150px; height: 200px; padding: 16px; }
  .mini-card b { font-size: 20px; }
  .mini-answer { left: calc(6% + 132px); }
  .mini-mascot { left: calc(6% + 262px); width: 64px; }
  .in-room .app-shell { padding: 8px 10px 10px; gap: 8px; }
  .in-room .mobile-menu { display: inline-grid; }
  .in-room .room-header { display: none; }
  .in-room .brand { margin-right: auto; }
  .in-room .mobile-players { display: flex; }
  .in-room.waiting-room .mobile-players { display: none; }
  .mobile-players { align-items: center; justify-content: center; gap: 4px; flex: none; }
  .mobile-avatar-button { padding: 0; background: none; border: 0; }
  .mobile-avatar-button .avatar { --size: 32px; border-width: 2px; }
  .mobile-avatar-button.offline { opacity: .45; }
  .mobile-avatar-button .online-dot { width: 10px; height: 10px; }
  .mobile-player-count { margin-left: 6px; font-size: 11px; line-height: 1.1; color: var(--ink-soft); font-weight: 800; }
  .table-layout { display: block; }
  .players-panel { display: none; }
  .game-panel { height: 100%; }
  #round-content { grid-template-rows: auto auto auto minmax(0, 1fr) auto; gap: 10px; }
  #round-content .game-meta { display: none; }
  .answers-heading .round-status { display: none; }
  .question-card { width: 100%; padding: 16px 48px 14px; max-height: clamp(110px, 28dvh, 200px); border-radius: 22px; }
  .question-card h1 { font-size: clamp(19px, 5.4vw, 24px); }
  .question-mascot { width: 46px; height: 52px; top: -10px; right: 2px; }
  .round-tabs { display: flex; gap: 10px; }
  .round-tabs button { flex: 1; min-height: 46px; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--edge-sm); font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--ink-soft); }
  .round-tabs button[aria-pressed='true'] { background: var(--pink); color: var(--ink); }
  #round-content[data-view='hand'] .answers-section, #round-content[data-view='answers'] .hand-section { display: none; }
  .hand-section { overflow: auto; overscroll-behavior: contain; }
  .hand-grid, .hand-grid.five, .hand-grid.six { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; padding: 12px 4px; }
  .card-face { min-height: 128px; }
  .card-text { font-size: 17px; }
  .answers-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
  .result-banner { flex-direction: column; align-items: stretch; text-align: center; gap: 10px; }
  .room-lobby h1 { font-size: 32px; }
}
@media (max-width: 480px) {
  .brand-name { font-size: 22px; }
  .in-room .brand-name { font-size: 20px; }
  .brand-mascot { width: 28px; height: 32px; }
  .icon-button { width: 42px; height: 42px; }
  .entry-copy h1 { font-size: 38px; }
  .entry-lead { font-size: 16px; }
  .entry-form { padding: 22px 18px 18px; }
  .hero { height: 220px; }
  .mini-card { width: 128px; height: 172px; padding: 14px; border-radius: 18px; }
  .mini-card b { font-size: 17px; }
  .mini-question { left: 2%; }
  .mini-answer { left: calc(2% + 110px); }
  .mini-mascot { left: calc(2% + 228px); width: 54px; }
  .answer-card { padding: 11px 12px 12px; }
  dialog { padding: 20px 16px; border-radius: 22px; }
  .side-dialog { border-radius: 22px 0 0 22px; }
  .lobby-settings { padding: 16px; }
  .lobby-settings-actions > * { flex: 1; }
}
@media (max-width: 360px) {
  .in-room .brand-name { display: none; }
  .hand-grid, .hand-grid.five, .hand-grid.six { gap: 12px 9px; }
  .card-text { font-size: 15px; }
  .question-card { padding: 14px 40px 12px; }
}
@media (max-width: 900px) and (max-height: 640px) {
  .in-room .mobile-players { display: none; }
  .question-card { max-height: 22dvh; padding-top: 12px; padding-bottom: 10px; }
  .card-face { min-height: 104px; }
}

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