.home { padding-top: 12px; }
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; padding: 32px 0; }
.hero-copy { max-width: 390px; }
.home-title-wrap { position: relative; isolation: isolate; padding: 8px 0; }
.home .home-title { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; font-family: var(--font-titulo); font-weight: 400; font-size: clamp(4rem, 10vw, 6.5rem); line-height: .95; letter-spacing: -.025em; }
.title-last { display: inline-block; padding: .04em .02em .1em; color: var(--titulo-cor); font-style: normal; letter-spacing: -.02em; }
@media (forced-colors: active) {
  .title-last { background: none; color: CanvasText; }
}
.home .actions { margin-top: 14px; }
.home-title-wrap + .actions { margin-top: 32px; }
.hero-art { display: grid; place-items: center; min-height: 280px; }
.hero-illustration { display: block; width: 100%; max-width: 440px; height: auto; }
.tag { display: inline-flex; align-items: center; gap: 7px; background: var(--papel-escuro); color: var(--tinta-suave); font-size: .7rem; padding: 7px 10px; border-radius: 6px; font-weight: 500; }
.stepper { display: flex; gap: 12px; margin-bottom: 20px; color: var(--tinta-suave); font-size: .68rem; letter-spacing: .04em; }
.stepper span { min-width: 0; border-bottom: 1.5px solid var(--linha); padding: 0 0 10px; flex: 1; }
.stepper .active { color: var(--tinta); border-color: var(--acento); }
:is(.team-row, .team-dot, .score-chip, .turn-heading) { --team-accent: color-mix(in srgb, var(--team-color) var(--team-intensity), var(--tinta)); }
.team-row { border: 1.5px solid var(--linha); border-left: 4px solid var(--team-accent); border-radius: var(--radius-control); padding: 14px; margin-bottom: 14px; }
.team-details { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 10px; align-items: end; }
.team-input { min-width: 0; }
.team-input label { margin-bottom: 8px; }
.team-palette { display: grid; grid-template-columns: repeat(8, minmax(48px, 1fr)); gap: 2px; margin-top: 12px; }
.color-choice { position: relative; min-height: 48px; display: grid; place-items: center; border-radius: 4px; cursor: pointer; }
.color-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.color-choice > span { width: 26px; height: 26px; background: color-mix(in srgb, var(--swatch) var(--team-intensity), var(--tinta)); border-radius: 50%; display: grid; place-items: center; pointer-events: none; }
.color-choice:has(input:checked) > span { outline: 1.5px solid var(--tinta); outline-offset: 4px; }
.color-choice:has(input:focus-visible) { outline: 2px solid var(--acento); outline-offset: 2px; }
.team-dot { display: inline-block; flex: none; width: 11px; height: 11px; border-radius: 50%; background: var(--team-accent); vertical-align: middle; margin-right: 7px; }
.team-remove { min-height: 52px; display: grid; place-items: center; border: 1.5px solid var(--linha); border-radius: var(--radius-control); background: transparent; color: var(--tinta-suave); }
.team-remove svg { width: 18px; height: 18px; }
.team-remove:hover:enabled { border-color: var(--tinta); color: var(--tinta); }
.add-team { width: 100%; min-height: 52px; border: 1.5px dashed var(--linha); border-radius: var(--radius-control); background: transparent; margin-top: 4px; }
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.themes-panel h2 { font: 600 1rem var(--font-texto); letter-spacing: 0; }
.theme-choice { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 12px; min-width: 0; min-height: 106px; padding: 15px 12px; border: 1.5px solid var(--linha); border-radius: var(--radius-control); background: var(--papel-claro); cursor: pointer; transition: background .15s, color .15s; text-transform: none; letter-spacing: 0; -webkit-tap-highlight-color: transparent; user-select: none; }
.theme-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.theme-choice:has(input:checked) { background: var(--papel-escuro); color: var(--tinta); border-color: var(--acento); }
.theme-choice[data-adulto=true]:has(input:checked) { background: var(--erro); border-color: var(--tinta); }
.theme-check { position: absolute; top: 10px; right: 10px; display: none; pointer-events: none; }
.theme-check svg { width: 16px; height: 16px; }
.theme-choice:has(input:checked) .theme-check { display: block; }
.theme-choice:has(input:focus-visible) { outline: 2px solid var(--acento); outline-offset: 3px; }
.theme-symbol { pointer-events: none; }
.theme-symbol svg { width: 28px; height: 28px; }
.theme-name { font-size: .83rem; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; pointer-events: none; }
.center { text-align: center; }
.turn { max-width: 620px; margin: auto; }
.turn-heading { text-align: left; padding: 26px 0 16px; }
.turn-heading > p { color: var(--tinta-suave); font-size: 1rem; margin-bottom: 10px; }
.turn-heading h1 { font-size: clamp(3rem, 12vw, 5rem); overflow-wrap: anywhere; }
.turn-color { display: block; width: 64px; height: 4px; background: var(--team-accent); margin-top: 18px; }
.scoreboard { margin-top: 30px; text-align: left; }
.scoreboard > h3 { font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--tinta-suave); margin-bottom: 12px; }
.score-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.score-chip { display: flex; flex-direction: column; gap: 12px; padding: 15px; border: 1.5px solid var(--linha); background: var(--papel-claro); border-radius: var(--radius-control); min-width: 0; }
.score-chip.current { border-color: var(--team-accent); box-shadow: inset 3px 0 0 var(--team-accent); }
.score-name { font-size: .8rem; font-weight: 500; overflow-wrap: anywhere; }
.score-value { display: flex; gap: 7px; align-items: baseline; }
.score-value b { font: 500 2.3rem/.9 var(--font-titulo); }
.score-value small { color: var(--tinta-suave); font-size: .7rem; }
body:has(.game-screen) { display: flex; flex-direction: column; }
body:has(.game-screen) main { flex: 1; display: flex; padding-top: 8px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.game-screen { display: flex; flex-direction: column; flex: 1; width: 100%; max-width: 560px; margin: auto; }
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.game-top .eyebrow { margin-bottom: 5px; }
.game-top h3 { font-size: .9rem; }
.timer { font: 500 2.5rem/1 var(--font-titulo); font-variant-numeric: tabular-nums; }
.timer.urgent { color: var(--tinta); }
.timer.critical { color: var(--tinta); }
.timer-track { flex: none; width: 100%; height: 5px; background: var(--papel-escuro); margin-bottom: 14px; }
.timer-fill { background: var(--tinta-suave); width: 100%; height: 100%; transition: width .2s linear; }
.timer-fill.urgent { background: var(--aviso); }
.timer-fill.critical { background: var(--erro); }
.word-card { --difficulty-color: var(--tinta); position: relative; width: 100%; min-height: 260px; flex: 1; padding: 24px; border: 0; border-top: 5px solid var(--difficulty-color); background: var(--papel-claro); border-radius: 0; clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; user-select: none; }
.word-card[data-dificuldade="1"] { --difficulty-color: var(--dificuldade-facil); }
.word-card[data-dificuldade="2"] { --difficulty-color: var(--dificuldade-media); }
.word-card[data-dificuldade="3"] { --difficulty-color: var(--dificuldade-dificil); }
.word-card:focus-visible { outline: none; background: #303030; }
.word-card .visual { display: grid; place-items: center; line-height: 1; }
.word-card .visual svg { width: 112px; height: 112px; color: var(--difficulty-color); }
.word-card strong { font-family: var(--font-titulo); font-weight: 400; font-size: clamp(1.8rem, 7vw, 3rem); line-height: 1; overflow-wrap: anywhere; }
.word-card.long-word strong { font-size: clamp(1.5rem, 5.5vw, 2.2rem); }
.word-card small { color: var(--tinta-suave); font-size: .72rem; }
.card-theme svg { width: 16px; height: 16px; }
.card-points { align-self: stretch; display: flex; align-items: center; justify-content: space-between; padding: 14px 0 0; border-top: 1px solid var(--linha); margin-top: 4px; font-size: .85rem; color: var(--tinta-suave); }
.card-points b { color: var(--difficulty-color); font-size: 1.2rem; }
.game-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.game-actions .button { min-height: 68px; padding: 12px; flex-direction: row; justify-content: flex-start; gap: 10px; }
.game-actions .answer-error { background: var(--erro); color: var(--texto-sobre-cor); border-color: var(--erro); box-shadow: none; }
.game-actions .answer-error:hover { background: var(--erro-hover); border-color: var(--erro-hover); color: var(--texto-sobre-cor); }
.game-actions .answer-correct { background: var(--sucesso); color: var(--texto-sobre-cor); border-color: var(--sucesso); box-shadow: none; }
.game-actions .answer-correct:hover { background: var(--sucesso-esc); border-color: var(--sucesso-esc); }
.game-actions .button:active { box-shadow: none; transform: translateY(3px); }
.answer-symbol { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); border-radius: 6px; }
.answer-symbol svg { width: 20px; height: 20px; }
.answer-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.answer-title { font-size: .95rem; line-height: 1.15; font-weight: 600; }
.game-actions small { font-size: .72rem; font-weight: 400; line-height: 1.1; }
.preparation-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin-top: 14px; }
.preparation-actions .button { padding: 10px 8px; font-size: .84rem; }
.game-exit { display: flex; justify-content: center; }
.game-exit .back { margin: 6px 0 0; font-size: .8rem; }
.turn-outcome { display: flex; align-items: baseline; gap: 10px; margin-top: 24px; }
.turn-outcome strong { font: 500 3rem/1 var(--font-titulo); }
.turn-outcome span { color: var(--tinta-suave); }
.ranking { list-style: none; padding: 0; margin: 24px 0; counter-reset: ranking; }
.ranking li { display: flex; align-items: center; gap: 14px; padding: 18px 0; border-bottom: 1.5px solid var(--linha); }
.ranking li > strong { width: 28px; font: 500 1.6rem var(--font-titulo); }
.ranking li > span:not(.rank-score) { min-width: 0; overflow-wrap: anywhere; }
.ranking .rank-score { margin-left: auto; font-family: var(--font-titulo); font-size: 1.6rem; white-space: nowrap; }
.ranking li:first-child { border-color: var(--acento); }
.history { text-align: left; border-top: 1.5px solid var(--linha); padding-top: 14px; margin-top: 20px; }
.history summary { cursor: pointer; padding: 12px 0; }
.history p { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: .85rem; }
@media (min-width: 621px) { .theme-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  body:has(.home) { display: flex; flex-direction: column; }
  body:has(.home) main { flex: 1; display: flex; align-items: center; padding: 20px 24px max(28px, env(safe-area-inset-bottom)); }
  .home { width: 100%; max-width: 360px; margin: auto; padding: 0; }
  .hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }
  .hero-copy { display: contents; }
  .home-title-wrap { grid-row: 1; padding: 0; }
  .home .home-title { align-items: center; font-size: clamp(4rem, 20vw, 6rem); }
  .hero-art { display: grid; grid-row: 2; min-height: 0; height: clamp(128px, 26dvh, 220px); margin: 12px 0 16px; }
  .hero-illustration { width: 100%; height: 100%; }
  .home .actions { margin-top: 12px; }
  .home .home-title-wrap + .actions { margin-top: 0; }
  .team-palette { grid-template-columns: repeat(4, minmax(48px, 1fr)); }
}
@media (max-width: 360px) { .team-row { padding: 10px; } }
@media (max-width: 620px) and (max-height: 700px) {
  .word-card { min-height: 220px; gap: 9px; padding: 16px; }
  .word-card .visual svg { width: 72px; height: 72px; }
  .word-card strong { font-size: 1.9rem; }
  .word-card.long-word strong { font-size: 1.5rem; }
  .word-card .tag { padding: 5px 8px; }
  .game-top { margin-bottom: 8px; }
  .timer-track { margin-bottom: 12px; }
  .game-actions, .preparation-actions { margin-top: 12px; }
}
@media (max-width: 620px) and (max-height: 560px) {
  .home .hero { grid-template-columns: minmax(0, 1fr) 120px; column-gap: 8px; align-items: center; }
  .home .home-title { font-size: clamp(2.4rem, 12vw, 3rem); }
  .home-title-wrap { grid-column: 1; }
  .hero-art { grid-column: 2; grid-row: 1; height: 100px; margin: 0; }
  .home .actions { grid-column: 1 / -1; }
  .home .home-title-wrap + .actions { margin-top: 12px; }
}

@media (max-width: 620px) {
  body:has(#times-form) main { padding-top: 8px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  main:has(#times-form) > .back { display: none; }
  main:has(#times-form) > .stepper { margin-bottom: 10px; }
  #times-form .panel { margin-top: 0; padding: 10px; }
  #times-form .section-label { margin-bottom: 8px; }
  #times-form .team-row { padding: 8px; margin-bottom: 8px; }
  #times-form .team-input label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #times-form .team-details { grid-template-columns: minmax(0, 1fr) 48px; gap: 8px; }
  #times-form :is(.team-input input, .team-remove) { min-height: 48px; }
  #times-form .team-palette { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0; margin-top: 6px; }
  #times-form .color-choice { min-width: 0; min-height: 44px; }
  #times-form .color-choice > span { width: 22px; height: 22px; }
  #times-form .color-choice:has(input:checked) > span { outline-offset: 3px; }
  #times-form .add-team { min-height: 48px; margin-top: 0; }
  #times-form > .actions { margin-top: 12px; }
}

/* A categoria abre a carta; dificuldade e pontos fecham a composicao. */
.word-card .card-theme { align-self: flex-start; background: transparent; padding: 0; color: var(--tinta); font-size: .85rem; }
.word-card strong { max-width: 100%; text-align: center; }
.word-card small { font-size: .75rem; }
.theme-choice { flex-direction: row; justify-content: flex-start; align-items: center; border: 0; border-radius: 0; min-height: 92px; gap: 12px; padding: 18px 14px; background: #2B2B2B; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%); }
.theme-choice:has(input:focus-visible) { background: #3A3A3A; outline: none; box-shadow: inset 0 0 0 2px var(--acento); }
.theme-symbol { flex: none; }
.theme-symbol svg { width: 24px; height: 24px; }
.theme-name { padding-right: 8px; }
.theme-choice:has(input:checked) { box-shadow: inset 0 -3px 0 var(--acento); }
.theme-symbol { color: var(--tinta); }
.theme-choice:has(input:checked) .theme-symbol, .theme-check { color: var(--acento); }
.theme-choice[data-adulto=true]:has(input:checked) { background: var(--papel-escuro); color: var(--tinta); border-color: var(--erro); box-shadow: inset 0 -3px 0 var(--erro); }
.theme-choice[data-adulto=true]:has(input:checked) :is(.theme-symbol, .theme-check) { color: var(--erro); }
.theme-choice:has(input:focus-visible) { box-shadow: inset 0 0 0 2px var(--acento); }
.theme-choice:active, .theme-choice[data-adulto=true]:active { background: var(--linha); }
.team-row { background: var(--papel-escuro); border-width: 0; border-left: 3px solid var(--team-accent); }
.team-remove { border-width: 1px; }
.team-input input, .select-trigger, .number-stepper, .number-stepper input { background: var(--papel); }
.color-choice > span { border-radius: 4px; }
.add-team { border-style: solid; border-width: 1px; }
.panel { border: 0; }
.stepper { font-size: .8rem; letter-spacing: 0; }
.eyebrow, .scoreboard > h3 { text-transform: none; letter-spacing: 0; font-size: .8rem; }
/* A configuracao cabe no desktop sem empilhar o terceiro ajuste. */
.config-options { display: flex; flex-wrap: wrap; column-gap: 24px; }
.end-match { margin-top: 12px; }
@media (min-width: 900px) {
  main:has(#config-form) { padding-top: 0; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  main:has(#config-form) > .back { margin-bottom: 0; }
  main:has(#config-form) > .stepper { margin-bottom: 12px; }
  #config-form { display: grid; gap: 16px; }
  #config-form > .panel { margin-top: 0; padding: 20px; }
  #config-form .section-label { margin-bottom: 12px; }
  #config-form .theme-choice { min-height: 72px; padding: 12px; }
  #config-form .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  #config-form .check-row { margin-top: 12px; }
  #config-form > .actions { margin-top: 0; }
}
@media (min-width: 900px) and (max-height: 750px) {
  main:has(#config-form) { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  main:has(#config-form) > .stepper { margin-bottom: 8px; }
  #config-form { gap: 12px; }
  #config-form > .panel { padding: 16px; }
  #config-form .theme-choice { min-height: 64px; }
}
@media (max-width: 620px) and (max-height: 700px) {
  .word-card { padding: 16px 20px; gap: 9px; min-height: 240px; }
  .word-card .visual svg { width: 80px; height: 80px; }
  .card-points { padding-top: 10px; }
}
