/* =========================================================
   TOURNAMENT - STYLE.CSS
   Cópia própria dos tokens de cor da família NDQuest (mesmos
   valores dos outros jogos, arquivo independente, sem referência
   cruzada). Reaproveita os componentes genéricos (cards, botões,
   campos, abas) e adiciona os específicos do Torneio: chave, tabela
   da liga, modal de resultado e log de correções.
   ========================================================= */
:root {
  --color-bg: #071b30;
  --color-bg-alt: #0d2846;
  --color-surface: #123a5e;
  --color-surface-border: rgba(254, 162, 3, 0.18);

  --color-gold: #fea203;
  --color-gold-light: #ffc24d;

  --color-paper: #f4ebda;

  --color-text: #eaf2fa;
  --color-text-muted: #9fb4c9;

  --color-success: #5fa77c;
  --color-error: #b5544a;

  --font-display: 'Fraunces', serif;
  --font-body: 'Work Sans', sans-serif;

  --radius-lg: 22px;
  --radius-md: 14px;

  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.6;
}

a {
  color: inherit;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 20px 96px;
}

#screen-config,
#screen-join,
#screen-waiting-player,
#screen-question,
#screen-results,
#screen-final {
  max-width: 500px;
  margin: 0 auto;
}

.eyebrow {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin: 0 0 10px;
}

h1.title-display {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0 0 12px;
}

.subtitle {
  color: var(--color-text-muted);
  margin: 0 0 32px;
  line-height: 1.6;
}

.logo-row {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.logo-row img {
  height: 40px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  text-align: left;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.field input,
.field select {
  background: var(--color-bg);
  border: 1px solid var(--color-surface-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-row .field label {
  min-height: 3.2em;
  display: flex;
  align-items: flex-end;
}

@media (max-width: 480px) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .field-row .field label {
    min-height: 0;
  }
}

.btn {
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--color-gold);
  color: #2b1600;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-surface-border);
}

.field-error {
  color: var(--color-error);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-bottom: 12px;
}

/* ---------------------------------------------------------

   Abas de método de entrada (Buscar de uma Sala / QR / Colar)
   --------------------------------------------------------- */

.method-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.method-tab {
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  position: relative;
  z-index: 1;
  border: 1px solid var(--color-surface-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.method-tab:hover {
  border-color: var(--color-gold);
  color: var(--color-text);
}

.method-tab.is-active {
  background: var(--color-gold);
  border-color: var(--color-gold);
  color: #2b1600;
}

.method-panel {
  margin-bottom: 8px;
}

/* ---------------------------------------------------------

   Seletor de idioma - fixo, canto superior direito, em toda
   tela do Time Attack (host e jogador)
   --------------------------------------------------------- */

.language-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.language-btn {
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.language-btn.is-active {
  background: linear-gradient(180deg, var(--color-gold-light), var(--color-gold));
  color: var(--color-bg);
}

@media (max-width: 480px) {
  .language-toggle {
    top: 10px;
    right: 10px;
  }
}

/* ---------------------------------------------------------

/* ==========================================================================
   NAV-AUTH-LIGHT - indicador de login leve (avatar + nome, sem
   dropdown), fica ao lado do toggle de idioma. Ver
   assets/js/navAuthLight.js.
   ========================================================================== */

#nav-auth-light{
    position:fixed;
    top:16px;
    /* Valor de fallback só pro instante antes do JS calcular a
       posição real (positionNextToLanguageToggle, em
       navAuthLight.js) - depois disso o "right" é ajustado
       dinamicamente com base na largura de verdade do toggle de
       idioma, não um número fixo chutado. */
    right:96px;
    z-index:50;
}

.nav-auth-light-widget{
    display:flex;
    align-items:center;
    gap:6px;
    padding:6px 10px 6px 4px;
    background:var(--color-surface, rgba(255,255,255,.04));
    border:1px solid var(--color-surface-border, rgba(255,255,255,.12));
    border-radius:999px;
    box-shadow:var(--shadow-soft, none);
    text-decoration:none;
    color:inherit;
}

.nav-auth-light-signin{
    display:flex;
    align-items:center;
    padding:6px 14px;
    background:var(--color-gold);
    color:var(--color-bg);
    border-radius:999px;
    font-size:12px;
    font-weight:700;
    text-decoration:none;
    white-space:nowrap;
}

.nav-auth-light-avatar-slot{
    width:22px;
    height:22px;
    border-radius:50%;
    flex-shrink:0;
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:hidden;
}

.nav-auth-light-avatar-img{
    width:22px;
    height:22px;
    border-radius:50%;
    object-fit:cover;
    flex-shrink:0;
    display:block;
}

.nav-auth-light-avatar-fallback{
    /* Cor de marca do jogo (dourado, mesma da cor ativa do toggle de
       idioma), não um azul genérico solto - era um bug de
       inconsistência real: o avatar usava #3b82f6, uma cor que não
       existe em nenhum outro lugar da identidade do jogo. */
    background:var(--color-gold);
    color:var(--color-bg);
    font-size:11px;
    font-weight:700;
    line-height:1;
}

.nav-auth-light-name{
    font-size:12px;
    font-weight:600;
    line-height:1;
}

@media (max-width: 640px){
    #nav-auth-light{
        top:10px;
        right:86px;
    }
}


/* ---------------------------------------------------------
   Torneio
   --------------------------------------------------------- */

/* .field, .btn e afins definem display e anulam o atributo hidden do
   navegador - reportado ao vivo em outros jogos, mesma defesa aqui. */
[hidden] {
  display: none !important;
}

.container.is-wide {
  max-width: 1200px;
}

#screen-config {
  max-width: 640px;
  margin: 0 auto;
}

.field textarea,
textarea.tn-textarea {
  background: var(--color-bg);
  border: 1px solid var(--color-surface-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  min-height: 150px;
  resize: vertical;
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-gold);
}

.hint-text {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 6px 0 0;
}

.join-existing-link {
  display: inline-block;
  color: var(--color-gold);
  font-size: 0.9rem;
  text-decoration: none;
  margin-bottom: 20px;
}

.join-existing-link:hover {
  color: var(--color-gold-light);
}

.tn-check {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.tn-check[hidden],
.hint-text[hidden] {
  display: none;
}

.tn-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tn-seg label {
  flex: 1 1 180px;
  border: 1px solid var(--color-surface-border);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text);
}

.tn-seg label:has(input:checked) {
  border-color: var(--color-gold);
  background: rgba(var(--color-gold-rgb, 254, 162, 3), 0.1);
}

.tn-seg label.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tn-fieldlabel {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.tn-mine h2,
.tn-log h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 12px;
}

.tn-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tn-list li {
  border: 1px solid var(--color-surface-border);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.tn-list a {
  color: var(--color-text);
  font-weight: 700;
  text-decoration: none;
}

.tn-list a:hover {
  color: var(--color-gold);
}

.tn-head-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.tn-head-row h1 {
  overflow-wrap: anywhere;
}

.tn-head-row .subtitle {
  margin-bottom: 0;
}

.tn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tn-actions .btn {
  width: auto;
  padding: 10px 18px;
  font-size: 0.9rem;
}

.tn-pill {
  border: 1px solid var(--color-surface-border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.tn-notice {
  border: 1px solid var(--color-surface-border);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0 0 16px;
}

.tn-notice[hidden],
.tn-champion[hidden],
.tn-tabs[hidden] {
  display: none;
}

.tn-champion {
  border: 1px solid var(--color-success);
  background: rgba(95, 167, 124, 0.12);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.6;
}

.tn-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tn-rounds {
  display: flex;
  gap: 28px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: stretch;
}

.tn-round {
  display: flex;
  flex-direction: column;
  min-width: 230px;
  gap: 12px;
}

.tn-round-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: 4px;
}

.tn-round-matches {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 12px;
  flex: 1;
}

.tn-match {
  border: 1px solid var(--color-surface-border);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tn-match.is-ready {
  border-color: var(--color-gold);
}

.tn-match.is-bye {
  opacity: 0.5;
}

.tn-side {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  font-size: 0.9rem;
}

.tn-side + .tn-side {
  border-top: 1px solid var(--color-surface-border);
}

.tn-side .nm {
  overflow-wrap: anywhere;
}

.tn-side.is-winner {
  font-weight: 700;
  color: var(--color-gold-light);
}

.tn-side.is-loser {
  color: var(--color-text-muted);
}

.tn-side.is-tbd .nm {
  color: var(--color-text-muted);
  font-style: italic;
}

.tn-side .sc {
  font-variant-numeric: tabular-nums;
}

.tn-match-foot {
  border-top: 1px solid var(--color-surface-border);
  padding: 6px 8px;
  display: flex;
  justify-content: flex-end;
}

.tn-link {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  color: var(--color-gold);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 6px;
}

.tn-link:hover {
  color: var(--color-gold-light);
}

.tn-table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}

.tn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 520px;
}

.tn-table th,
.tn-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid var(--color-surface-border);
}

.tn-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tn-table td.nm,
.tn-table th.nm {
  text-align: left;
}

.tn-table td.pts {
  font-weight: 700;
  color: var(--color-gold-light);
}

.tn-table tr.is-first td {
  color: var(--color-success);
}

.tn-fixtures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.tn-fix-round {
  margin-bottom: 24px;
}

.tn-log {
  margin-top: 28px;
}

.tn-center {
  text-align: center;
  padding: 80px 0;
  color: var(--color-text-muted);
}

.tn-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
}

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

.tn-modal-card {
  width: 100%;
  max-width: 440px;
  margin: 0;
}

.tn-modal-card h3 {
  font-family: var(--font-display);
  margin: 0 0 18px;
}

.tn-score-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.tn-score-row label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.tn-score-row input {
  background: var(--color-bg);
  border: 1px solid var(--color-surface-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.1rem;
  text-align: center;
  width: 100%;
}

.tn-vs {
  padding-bottom: 12px;
  color: var(--color-text-muted);
}

@media (max-width: 640px) {
  .tn-round {
    min-width: 200px;
  }
}

.logo-text {
    font-family: var(--font-display, 'Fraunces', serif);
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: 0.02em;
    color: var(--color-text);
}

/* Botao "← NDQuest" padronizado (mesmo visual e posicao em todos os
   jogos): pilula fixa no canto superior esquerdo, espelhando o toggle
   de idioma do canto direito. */
.back-to-ndquest {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: color 0.2s ease;
}

.back-to-ndquest:hover {
  color: var(--color-text);
}

@media (max-width: 480px) {
  .back-to-ndquest {
    top: 10px;
    left: 10px;
    padding: 6px 10px;
  }
}
