﻿

    html {
      -webkit-text-size-adjust: 100%;
      text-size-adjust: 100%;
    }

    body {
      font-family: 'Outfit', sans-serif;
      background: var(--bg-deep);
      background-image:
        radial-gradient(ellipse 90% 60% at 50% -10%, rgba(245, 185, 66, 0.14), transparent 55%),
        radial-gradient(ellipse 50% 40% at 0% 100%, rgba(59, 130, 246, 0.08), transparent),
        radial-gradient(ellipse 50% 40% at 100% 100%, rgba(168, 85, 247, 0.08), transparent),
        linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 100%);
      color: var(--text);
      min-height: 100vh;
      min-height: 100dvh;
      height: 100dvh;
      padding:
        max(var(--pad-page), env(safe-area-inset-top))
        max(var(--pad-page), env(safe-area-inset-right))
        max(var(--pad-page), env(safe-area-inset-bottom))
        max(var(--pad-page), env(safe-area-inset-left));
      overflow: hidden;
    }

    body::before {
      content: '';
      position: fixed;
      inset: 0;
      background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
      background-size: 28px 28px;
      pointer-events: none;
      opacity: 0.35;
      z-index: 0;
    }

    .container {
      position: relative;
      z-index: 1;
      width: 100%;
      max-width: 100%;
      height: 100%;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    /* ── Cabeçalho ── */
    .brand {
      text-align: center;
      margin-bottom: var(--gap-sm);
      flex-shrink: 0;
    }

    .brand-top {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.15rem;
    }

    .brand-tag {
      font-size: clamp(0.65rem, 1.4vw, 0.78rem);
      font-weight: 600;
      letter-spacing: 0.22em;
      text-transform: uppercase;
      color: var(--accent-light);
      opacity: 0.9;
    }

    .brand h1 {
      font-family: 'Fredoka', sans-serif;
      font-size: var(--header-title);
      font-weight: 700;
      letter-spacing: 0.06em;
      line-height: 1;
      background: linear-gradient(180deg, #fff 0%, var(--accent-light) 45%, var(--accent) 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      filter: drop-shadow(0 2px 12px rgba(245, 185, 66, 0.35));
    }

    .brand p {
      color: var(--text-muted);
      margin-top: 0.35rem;
      font-size: var(--header-sub);
    }

    .viewer-count {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.45rem;
      margin-top: 0.35rem;
      padding: 0.35rem 0.75rem;
      border-radius: 999px;
      font-size: clamp(0.72rem, 1.5vw, 0.92rem);
      font-weight: 700;
      color: var(--accent-light);
      background: rgba(245, 185, 66, 0.1);
      border: 1px solid rgba(245, 185, 66, 0.28);
    }

    .viewer-count-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #22c55e;
      box-shadow: 0 0 8px rgba(34, 197, 94, 0.75);
      flex-shrink: 0;
    }

    .brand kbd {
      display: inline-block;
      padding: 0.1rem 0.45rem;
      border-radius: 5px;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.12);
      font-family: inherit;
      font-size: 0.85em;
      color: var(--text);
    }

    .top-panel {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: var(--gap-md);
      margin-bottom: var(--gap-sm);
      flex-wrap: wrap;
      flex-shrink: 0;
    }

    .top-panel-left {
      display: flex;
      align-items: center;
      gap: var(--gap-lg);
      flex-wrap: wrap;
    }

    .cartelas-card {
      border-color: rgba(245, 185, 66, 0.35);
      background: rgba(245, 185, 66, 0.08);
    }

    .cartelas-card[hidden] { display: none !important; }

    .cartelas-card .stat-value {
      color: var(--accent-light);
      font-size: clamp(1.2rem, 2.8vw, 1.85rem);
    }

    .cartelas-card .stat-value.zero {
      color: #86efac;
    }

    .conferencia-panel {
      margin-top: var(--gap-md);
      background: var(--surface);
      border: 1px solid var(--surface-border);
      border-radius: var(--radius);
      padding: 0.85rem 1rem;
      backdrop-filter: blur(8px);
      box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    }

    .conferencia-panel[hidden] { display: none !important; }

    .conferencia-panel h2 {
      font-size: clamp(0.95rem, 2vw, 1.15rem);
      margin: 0 0 0.65rem;
      color: var(--accent-light);
      font-weight: 700;
    }

    .conferencia-table {
      width: 100%;
      border-collapse: collapse;
      font-size: clamp(0.85rem, 1.8vw, 1rem);
    }

    .conferencia-table th,
    .conferencia-table td {
      text-align: left;
      padding: 0.45rem 0.55rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .conferencia-table th {
      color: var(--text-muted);
      font-weight: 600;
      font-size: 0.8em;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .conferencia-table tr:last-child td {
      border-bottom: none;
    }

    .conferencia-table .conf-nome {
      display: block;
      font-size: 0.82em;
      color: var(--text-muted);
      margin-top: 0.15rem;
    }

    .conferencia-table tr.pts-near td:last-child { color: #fde68a; }
    .conferencia-table tr.pts-close td:last-child { color: #fdba74; font-weight: 600; }
    .conferencia-table tr.pts-winner td:last-child { color: #86efac; font-weight: 700; }

    .stats-card {
      background: var(--surface);
      border: 1px solid var(--surface-border);
      border-radius: var(--radius);
      padding: 0.65rem 1rem;
      min-width: min(220px, 100%);
      backdrop-filter: blur(8px);
      box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    }

    .stats-head {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 1rem;
      margin-bottom: 0.45rem;
    }

    .stat-label {
      font-size: clamp(0.68rem, 1.6vw, 0.8rem);
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.1em;
      font-weight: 600;
    }

    .stat-value {
      font-family: 'Fredoka', sans-serif;
      font-size: var(--stat-value);
      font-weight: 600;
      color: var(--accent-light);
    }

    .progress-track {
      height: 6px;
      background: rgba(255, 255, 255, 0.06);
      border-radius: 99px;
      overflow: hidden;
    }

    .progress-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, var(--accent), var(--accent-light));
      border-radius: 99px;
      transition: width 0.4s ease;
      box-shadow: 0 0 12px var(--accent-glow);
    }

    .actions {
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: var(--gap-sm);
      flex-wrap: wrap;
    }

    .btn {
      font-family: inherit;
      font-size: var(--btn-font);
      font-weight: 600;
      padding: var(--btn-pad-y) var(--btn-pad-x);
      border: none;
      border-radius: calc(var(--radius) + 2px);
      cursor: pointer;
      transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
      min-height: 42px;
      white-space: nowrap;
    }

    .btn:active:not(:disabled) {
      transform: scale(0.97);
    }

    .btn-undo {
      background: rgba(255, 255, 255, 0.06);
      color: var(--text);
      border: 1px solid var(--surface-border);
    }

    .btn-undo:hover:not(:disabled) {
      background: rgba(255, 255, 255, 0.1);
    }

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

    .btn-new {
      background: linear-gradient(135deg, #ef4444, #dc2626);
      color: white;
      box-shadow: 0 4px 18px var(--danger-glow);
    }

    .btn-new:hover {
      filter: brightness(1.08);
    }

    .btn-draw {
      background: linear-gradient(135deg, var(--accent) 0%, #f59e0b 50%, var(--accent-light) 100%);
      color: #1a1200;
      font-family: 'Fredoka', sans-serif;
      font-size: calc(var(--btn-font) + 0.05rem);
      font-weight: 700;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      box-shadow: 0 4px 24px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    }

    .draw-wrap .btn-draw {
      width: 100%;
      min-height: 48px;
      font-size: clamp(0.85rem, 1.8vw, 1rem);
    }

    .actions .btn-draw {
      width: auto;
    }

    .btn-draw:hover:not(:disabled) {
      filter: brightness(1.06);
      box-shadow: 0 6px 28px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }

    .btn-draw:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      filter: grayscale(0.3);
    }

    .draw-wrap {
      margin-bottom: var(--gap-sm);
      flex-shrink: 0;
    }

    .main-layout {
      display: grid;
      grid-template-columns: 1fr;
      gap: var(--gap-md);
      align-items: stretch;
      flex: 1;
      min-height: 0;
    }

    .grid-wrapper {
      background: var(--surface);
      border-radius: clamp(12px, 1.8vw, 18px);
      padding: var(--gap-xs);
      border: 1px solid var(--surface-border);
      min-width: 0;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      backdrop-filter: blur(10px);
      box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }

    .board-stage {
      display: flex;
      flex: 1;
      min-height: 0;
      width: 100%;
      align-items: stretch;
      justify-content: center;
      gap: clamp(0.75rem, 2vw, 2.5rem);
    }

    .telao-spotlight {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      flex: 1;
      min-width: 0;
      min-height: 0;
      max-width: 100%;
      text-align: center;
      overflow: hidden;
    }

    .telao-hero {
      flex-shrink: 0;
      width: 100%;
    }

    .telao-recent {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      width: 100%;
      margin-top: clamp(0.5rem, 1.2vh, 1rem);
    }

    .telao-recent .recent-label {
      margin-bottom: var(--gap-xs);
    }

    .telao-recent .recent-balls {
      flex: 1;
      min-height: 0;
      width: 100%;
    }

    .telao-label {
      font-size: clamp(0.75rem, 1.5vw, 1rem);
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.14em;
      font-weight: 600;
      margin-bottom: clamp(0.5rem, 1.5vh, 1rem);
    }

    .telao-ball-stage {
      position: relative;
      margin-bottom: clamp(0.35rem, 0.8vh, 0.65rem);
      perspective: 900px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .telao-ball-stage .ball-stage-glow {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: calc(var(--telao-ball) * 1.4);
      height: calc(var(--telao-ball) * 1.4);
    }

    .telao-ball-stage .ball-stage-glow.pulse {
      animation: telaoGlowPulse 0.55s ease-in-out infinite;
    }

    @keyframes telaoGlowPulse {
      0%, 100% { opacity: 0.65; transform: translate(-50%, -50%) scale(1); }
      50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
    }

    .bingo-ball.telao {
      width: var(--telao-ball);
      height: var(--telao-ball);
      transform-style: preserve-3d;
      will-change: transform;
    }

    .bingo-ball.telao.spinning {
      animation: telaoBallSpin 0.42s linear infinite;
    }

    @keyframes telaoBallSpin {
      0%   { transform: rotateY(0deg) rotateX(8deg) scale(1); }
      25%  { transform: rotateY(90deg) rotateX(-6deg) scale(1.04); }
      50%  { transform: rotateY(180deg) rotateX(8deg) scale(1); }
      75%  { transform: rotateY(270deg) rotateX(-6deg) scale(1.04); }
      100% { transform: rotateY(360deg) rotateX(8deg) scale(1); }
    }

    .bingo-ball.telao .ball-letter {
      font-size: calc(var(--telao-ball) * 0.24);
    }

    .bingo-ball.telao .ball-number {
      font-size: calc(var(--telao-ball) * 0.46);
      margin-top: 0.05em;
    }

    .bingo-ball.telao.empty .ball-number {
      font-size: calc(var(--telao-ball) * 0.3);
    }

    .telao-count {
      font-family: 'Fredoka', sans-serif;
      font-size: clamp(1.4rem, 3vw, 2.2rem);
      font-weight: 600;
      color: var(--accent-light);
      text-shadow: 0 0 20px var(--accent-glow);
      margin-bottom: clamp(0.5rem, 1vh, 0.85rem);
    }

    .telao-auto-timer {
      font-family: 'Fredoka', sans-serif;
      font-size: clamp(1.1rem, 2.4vw, 1.75rem);
      font-weight: 700;
      color: #86efac;
      text-shadow: 0 0 18px rgba(134, 239, 172, 0.45);
      margin-bottom: clamp(0.35rem, 0.8vh, 0.55rem);
      min-height: 1.4em;
      letter-spacing: 0.02em;
    }

    .telao-auto-timer[hidden] { display: none !important; }

    .telao-auto-timer.countdown {
      color: var(--accent-light);
      text-shadow: 0 0 22px var(--accent-glow);
    }

    .telao-auto-timer.drawing {
      color: #fde68a;
      animation: blink 1s ease-in-out infinite;
    }

    .telao-auto-timer.paused {
      color: #94a3b8;
      text-shadow: none;
    }

    .telao-draw {
      width: 100%;
      max-width: 280px;
      margin: 0 auto;
    }

    .telao-draw .btn-draw {
      width: 100%;
      min-height: 48px;
      font-size: clamp(0.85rem, 1.6vw, 1rem);
    }

    .bingo-board {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      align-items: stretch;
      gap: clamp(3px, 0.5vw, 8px);
      padding: clamp(3px, 0.5vh, 8px);
      background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%),
        rgba(0, 0, 0, 0.28);
      border-radius: calc(var(--radius) + 4px);
      border: 1px solid rgba(255, 255, 255, 0.06);
      flex: 1;
      min-width: 0;
      min-height: 0;
      height: 100%;
      overflow: hidden;
    }

    .bingo-column {
      display: flex;
      flex-direction: column;
      align-items: center;
      min-height: 0;
      height: 100%;
      padding: clamp(2px, 0.3vh, 4px) 0;
      border-radius: calc(var(--radius) + 2px);
    }

    .bingo-column.b { background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), transparent 85%); }
    .bingo-column.i { background: linear-gradient(180deg, rgba(239, 68, 68, 0.08), transparent 85%); }
    .bingo-column.n { background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), transparent 85%); }
    .bingo-column.g { background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), transparent 85%); }
    .bingo-column.o { background: linear-gradient(180deg, rgba(168, 85, 247, 0.08), transparent 85%); }

    /* ── Bolas compartilhadas ── */
    .ball-shine::before {
      content: '';
      position: absolute;
      top: 12%;
      left: 18%;
      width: 30%;
      height: 18%;
      background: rgba(255, 255, 255, 0.38);
      border-radius: 50%;
      filter: blur(1px);
      z-index: 0;
    }

    .col-header,
    .cell,
    .bingo-ball {
      position: relative;
      border-radius: 50%;
    }

    .col-header,
    .bingo-ball:not(.empty) {
      color: white;
      box-shadow:
        inset -4px -6px 12px rgba(0, 0, 0, 0.35),
        inset 3px 3px 10px rgba(255, 255, 255, 0.22),
        0 4px 14px rgba(0, 0, 0, 0.4);
    }

    .col-header {
      width: min(var(--cell-size), 100%);
      height: min(var(--cell-size), 100%);
      max-width: 100%;
      aspect-ratio: 1;
      flex-shrink: 0;
      margin: 0 auto clamp(2px, 0.25vh, 4px);
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: 'Fredoka', sans-serif;
      font-size: min(calc(var(--cell-size) * 0.5), 1.4rem);
      font-weight: 700;
    }

    .col-header.b, .bingo-ball.b, .cell.marked.b {
      background:
        radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.55) 0%, transparent 32%),
        radial-gradient(circle at 38% 32%, var(--col-b-light) 0%, var(--col-b-dark) 68%, #0c2d6e 100%);
    }
    .col-header.i, .bingo-ball.i, .cell.marked.i {
      background:
        radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.55) 0%, transparent 32%),
        radial-gradient(circle at 38% 32%, var(--col-i-light) 0%, var(--col-i-dark) 68%, #6b1010 100%);
    }
    .col-header.n, .bingo-ball.n, .cell.marked.n {
      background:
        radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.55) 0%, transparent 32%),
        radial-gradient(circle at 38% 32%, var(--col-n-light) 0%, var(--col-n-dark) 68%, #7c4a03 100%);
    }
    .col-header.g, .bingo-ball.g, .cell.marked.g {
      background:
        radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.55) 0%, transparent 32%),
        radial-gradient(circle at 38% 32%, var(--col-g-light) 0%, var(--col-g-dark) 68%, #0a4d22 100%);
    }
    .col-header.o, .bingo-ball.o, .cell.marked.o {
      background:
        radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.55) 0%, transparent 32%),
        radial-gradient(circle at 38% 32%, var(--col-o-light) 0%, var(--col-o-dark) 68%, #4a1578 100%);
    }

    .col-header.b, .col-header.i, .col-header.n, .col-header.g, .col-header.o,
    .bingo-ball:not(.empty),
    .cell.marked {
      /* shine via pseudo */
    }

    .col-header::before,
    .bingo-ball:not(.empty)::before,
    .cell.marked::before {
      content: '';
      position: absolute;
      top: 10%;
      left: 16%;
      width: 32%;
      height: 18%;
      background: rgba(255, 255, 255, 0.42);
      border-radius: 50%;
      filter: blur(0.5px);
      z-index: 1;
    }

    .cell.marked::after {
      content: '';
      position: absolute;
      inset: 8%;
      border-radius: 50%;
      border: 1px solid rgba(255, 255, 255, 0.18);
      box-shadow: inset 0 -2px 6px rgba(0, 0, 0, 0.2);
      pointer-events: none;
      z-index: 1;
    }

    .column {
      display: grid;
      grid-template-rows: repeat(15, minmax(0, 1fr));
      align-items: center;
      justify-items: center;
      gap: clamp(1px, 0.12vh, 2px);
      min-width: 0;
      width: 100%;
      flex: 1;
      min-height: 0;
    }

    /* Bolas na cartela — aguardando sorteio */
    .cell {
      width: min(var(--cell-size), 100%, 100%);
      height: auto;
      max-height: 100%;
      aspect-ratio: 1;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-family: 'Fredoka', sans-serif;
      font-size: var(--cell-font);
      font-weight: 600;
      color: rgba(255, 255, 255, 0.32);
      background:
        radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.06) 0%, transparent 45%),
        radial-gradient(circle at 50% 60%, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.55) 100%);
      border: 1.5px dashed rgba(255, 255, 255, 0.1);
      box-shadow:
        inset 0 3px 10px rgba(0, 0, 0, 0.45),
        0 1px 0 rgba(255, 255, 255, 0.04);
      transition: box-shadow 0.35s ease, background 0.35s ease, color 0.35s ease, border 0.35s ease;
      user-select: none;
      pointer-events: none;
    }

    .cell .cell-letter {
      display: none;
      font-size: var(--cell-letter-font);
      line-height: 1;
      font-weight: 700;
      letter-spacing: 0.02em;
      opacity: 0.92;
      position: relative;
      z-index: 2;
    }

    .cell .cell-num {
      line-height: 1;
      position: relative;
      z-index: 2;
    }

    .cell.b { border-color: rgba(96, 165, 250, 0.22); color: rgba(147, 197, 253, 0.38); }
    .cell.i { border-color: rgba(248, 113, 113, 0.22); color: rgba(252, 165, 165, 0.38); }
    .cell.n { border-color: rgba(251, 191, 36, 0.22); color: rgba(253, 224, 71, 0.38); }
    .cell.g { border-color: rgba(74, 222, 128, 0.22); color: rgba(134, 239, 172, 0.38); }
    .cell.o { border-color: rgba(192, 132, 252, 0.22); color: rgba(216, 180, 254, 0.38); }

    .cell.marked {
      color: white;
      border: none;
      font-weight: 700;
      box-shadow:
        inset -4px -8px 14px rgba(0, 0, 0, 0.42),
        inset 4px 4px 12px rgba(255, 255, 255, 0.24),
        0 4px 14px rgba(0, 0, 0, 0.38);
    }

    .cell.marked .cell-letter {
      display: block;
      margin-bottom: 0.02em;
    }

    .cell.marked .cell-num {
      font-size: var(--cell-num-marked);
      font-weight: 700;
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    }

    .cell.marked.b {
      box-shadow:
        inset -4px -8px 14px rgba(0, 0, 0, 0.42),
        inset 4px 4px 12px rgba(255, 255, 255, 0.24),
        0 0 8px rgba(96, 165, 250, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.38);
    }
    .cell.marked.i {
      box-shadow:
        inset -4px -8px 14px rgba(0, 0, 0, 0.42),
        inset 4px 4px 12px rgba(255, 255, 255, 0.24),
        0 0 8px rgba(248, 113, 113, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.38);
    }
    .cell.marked.n {
      box-shadow:
        inset -4px -8px 14px rgba(0, 0, 0, 0.42),
        inset 4px 4px 12px rgba(255, 255, 255, 0.24),
        0 0 8px rgba(251, 191, 36, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.38);
    }
    .cell.marked.g {
      box-shadow:
        inset -4px -8px 14px rgba(0, 0, 0, 0.42),
        inset 4px 4px 12px rgba(255, 255, 255, 0.24),
        0 0 8px rgba(74, 222, 128, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.38);
    }
    .cell.marked.o {
      box-shadow:
        inset -4px -8px 14px rgba(0, 0, 0, 0.42),
        inset 4px 4px 12px rgba(255, 255, 255, 0.24),
        0 0 8px rgba(192, 132, 252, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.38);
    }

    .cell.marked.last {
      animation: ballAppear 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
      z-index: 2;
    }

    .cell.marked.last.b,
    .cell.marked.last.i,
    .cell.marked.last.n,
    .cell.marked.last.g,
    .cell.marked.last.o {
      box-shadow:
        inset -4px -8px 14px rgba(0, 0, 0, 0.42),
        inset 4px 4px 12px rgba(255, 255, 255, 0.28),
        0 0 0 2px var(--accent),
        0 0 16px var(--accent-glow),
        0 4px 14px rgba(0, 0, 0, 0.45);
    }

    @keyframes ballAppear {
      0% { transform: scale(0.5); opacity: 0.4; }
      55% { transform: scale(1.08); }
      100% { transform: scale(1); opacity: 1; }
    }

    .history {
      margin-top: var(--gap-md);
      padding-top: var(--gap-md);
      border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .history h2 {
      font-size: clamp(0.7rem, 1.8vw, 0.85rem);
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.08em;
      margin-bottom: var(--gap-sm);
    }

    .history-list {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gap-xs);
      max-height: var(--history-max-h);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .history-item {
      font-family: 'Fredoka', sans-serif;
      font-weight: 600;
      font-size: clamp(0.68rem, 1.6vw, 0.82rem);
      padding: 0.2rem 0.55rem;
      border-radius: 99px;
      border: 1px solid transparent;
    }

    .history-item.h-b { background: rgba(59, 130, 246, 0.18); color: #93c5fd; border-color: rgba(59, 130, 246, 0.35); }
    .history-item.h-i { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
    .history-item.h-n { background: rgba(245, 158, 11, 0.18); color: #fde68a; border-color: rgba(245, 158, 11, 0.35); }
    .history-item.h-g { background: rgba(34, 197, 94, 0.18); color: #86efac; border-color: rgba(34, 197, 94, 0.35); }
    .history-item.h-o { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.35); }

    .history-empty {
      color: var(--text-muted);
      font-size: clamp(0.8rem, 2vw, 0.9rem);
    }

    .saved-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: clamp(0.65rem, 1.6vw, 0.75rem);
      color: var(--text-muted);
      margin-top: var(--gap-md);
    }

    .saved-badge::before {
      content: '';
      width: 6px;
      height: 6px;
      background: var(--marked);
      border-radius: 50%;
      animation: blink 2s infinite;
    }

    @keyframes blink {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.3; }
    }

    .ball-stage {
      position: relative;
      display: flex;
      justify-content: center;
      margin-bottom: var(--gap-sm);
    }

    .ball-stage-glow {
      position: absolute;
      inset: 50% auto auto 50%;
      width: calc(var(--ball-main) * 1.35);
      height: calc(var(--ball-main) * 1.35);
      transform: translate(-50%, -50%);
      border-radius: 50%;
      background: radial-gradient(circle, rgba(245, 185, 66, 0.18), transparent 70%);
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.35s ease;
    }

    .ball-stage-glow.active {
      opacity: 1;
    }

    /* Painel de bolas — removido; telão usa telao-spotlight */
    .bingo-ball {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-family: 'Fredoka', sans-serif;
      font-weight: 700;
      color: white;
      flex-shrink: 0;
    }

    .bingo-ball.telao.pop {
      animation: ballPop 0.5s cubic-bezier(0.34, 1.4, 0.64, 1);
    }

    @keyframes ballPop {
      0% { transform: scale(0.8) rotate(-8deg); }
      45% { transform: scale(1.12) rotate(4deg); }
      100% { transform: scale(1) rotate(0); }
    }

    .bingo-ball .ball-letter {
      font-size: var(--ball-letter-main);
      line-height: 1;
      z-index: 1;
      opacity: 0.95;
    }

    .bingo-ball .ball-number {
      font-size: var(--ball-num-main);
      line-height: 1;
      z-index: 1;
      margin-top: 0.05rem;
    }

    .bingo-ball.empty {
      background: radial-gradient(circle at 35% 28%, #475569, #1e293b) !important;
      box-shadow:
        inset -6px -10px 16px rgba(0, 0, 0, 0.4),
        inset 3px 3px 10px rgba(255, 255, 255, 0.08),
        0 6px 20px rgba(0, 0, 0, 0.35) !important;
    }

    .bingo-ball.empty::before {
      opacity: 0.2;
    }

    .bingo-ball.empty .ball-number {
      font-size: clamp(1.5rem, 5vh, 2.5rem);
      color: var(--text-muted);
    }

    .recent-label {
      margin-bottom: var(--gap-sm);
      font-size: clamp(0.65rem, 1.8vw, 0.8rem);
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.1em;
      text-align: center;
      flex-shrink: 0;
    }

    .recent-balls {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      justify-content: center;
      align-content: flex-start;
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding: 0.35rem;
      background: rgba(0, 0, 0, 0.15);
      border-radius: var(--radius);
      border: 1px solid rgba(255, 255, 255, 0.04);
    }

    .bingo-ball.small {
      width: var(--ball-small);
      height: var(--ball-small);
      cursor: default;
    }

    .bingo-ball.small .ball-letter {
      font-size: var(--ball-letter-small);
    }

    .bingo-ball.small .ball-number {
      font-size: var(--ball-num-small);
      margin-top: 0;
    }

    .recent-empty {
      color: var(--text-muted);
      font-size: clamp(0.75rem, 2vw, 0.85rem);
      text-align: center;
      padding: 0.75rem 0;
    }

    /* Modal */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(4px);
      z-index: 100;
      align-items: center;
      justify-content: center;
      padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right));
    }

    .modal-overlay.open {
      display: flex;
    }

    .modal {
      background: var(--surface);
      border-radius: 18px;
      padding: clamp(1.25rem, 4vw, 2rem);
      max-width: 400px;
      width: 100%;
      border: 1px solid var(--surface-border);
      text-align: center;
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    }

    .modal h3 {
      font-size: clamp(1.05rem, 3vw, 1.25rem);
      margin-bottom: 0.75rem;
    }

    .modal p {
      color: var(--text-muted);
      margin-bottom: 1.25rem;
      line-height: 1.5;
      font-size: clamp(0.85rem, 2.5vw, 1rem);
    }

    .modal-actions {
      display: flex;
      gap: var(--gap-sm);
      justify-content: center;
      flex-wrap: wrap;
    }

    .btn-cancel {
      background: rgba(255, 255, 255, 0.08);
      color: var(--text);
    }

    .btn-cancel:hover {
      background: rgba(255, 255, 255, 0.12);
    }

    .btn-confirm {
      background: var(--danger);
      color: white;
    }

    body.telao-display .top-panel .actions,
    body.telao-display .telao-draw {
      display: none !important;
    }

    .bingo-waiting-banner {
      text-align: center;
      padding: clamp(1rem, 3vw, 1.75rem);
      border-radius: var(--radius);
      background: linear-gradient(145deg, rgba(245, 185, 66, 0.16), rgba(245, 185, 66, 0.06));
      border: 2px solid rgba(245, 185, 66, 0.45);
      box-shadow: 0 0 40px rgba(245, 185, 66, 0.15);
    }

    .bingo-waiting-banner[hidden] {
      display: none !important;
    }

    .bingo-waiting-icon {
      display: block;
      font-size: clamp(2rem, 6vw, 3.5rem);
      line-height: 1;
      margin-bottom: 0.5rem;
      animation: waitingPulse 2.2s ease-in-out infinite;
    }

    .bingo-waiting-banner p {
      font-family: 'Fredoka', sans-serif;
      font-size: clamp(1.25rem, 3.5vw, 2rem);
      font-weight: 700;
      color: var(--accent-light);
      line-height: 1.2;
    }

    .bingo-waiting-sub {
      display: block;
      margin-top: 0.45rem;
      font-size: clamp(0.85rem, 2vw, 1.05rem);
      color: var(--text-muted);
      font-weight: 600;
    }

    body.telao-display .bingo-waiting-banner {
      padding: clamp(1.25rem, 4vw, 2.5rem);
      margin-bottom: 0.35rem;
    }

    body.telao-display .bingo-waiting-banner p {
      font-size: clamp(1.75rem, 5vw, 3.25rem);
    }

    body.telao-display .telao-hero.is-waiting .telao-label,
    body.telao-display .telao-hero.is-waiting .ball-stage,
    body.telao-display .telao-hero.is-waiting .telao-count,
    body.telao-display .telao-hero.is-waiting .telao-auto-timer {
      display: none;
    }

    @keyframes waitingPulse {
      0%, 100% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.08); opacity: 0.85; }
    }

    body.telao-display {
      --pad-page: 0.35rem;
      --chrome-h: 76px;
    }

    body.telao-display .brand p {
      display: none;
    }

    body.telao-display .brand .viewer-count {
      display: inline-flex;
      margin-top: 0.15rem;
      font-size: clamp(0.78rem, 1.7vw, 1rem);
    }

    body.telao-display .brand {
      margin-bottom: 0.12rem;
    }

    body.telao-display .brand h1 {
      font-size: clamp(1.15rem, 2.2vw, 1.75rem);
    }

    body.telao-display .top-panel {
      margin-bottom: 0.2rem;
    }

    body.telao-display .stats-card {
      padding: 0.4rem 0.8rem;
    }

    body.telao-display .conferencia-panel {
      margin-top: 0.35rem;
      padding: 0.55rem 0.75rem;
      max-height: min(28vh, 260px);
      overflow: auto;
    }

    body.telao-display .conferencia-table {
      font-size: clamp(0.95rem, 2.2vw, 1.2rem);
    }

    body.telao-display .stat-value {
      font-size: clamp(1.15rem, 2.8vw, 1.75rem);
    }

    body.telao-display .grid-wrapper {
      padding: 3px;
    }

    body.telao-display .bingo-board {
      gap: 3px;
      padding: 4px;
      overflow-y: auto;
      overflow-x: hidden;
      align-content: start;
      align-items: start;
      scrollbar-width: thin;
      scrollbar-color: var(--accent) rgba(255, 255, 255, 0.08);
    }

    body.telao-display .bingo-board::-webkit-scrollbar {
      width: 12px;
    }

    body.telao-display .bingo-board::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.06);
      border-radius: 8px;
      margin: 4px 0;
    }

    body.telao-display .bingo-board::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, var(--accent-light), var(--accent));
      border-radius: 8px;
      border: 2px solid rgba(0, 0, 0, 0.25);
    }

    body.telao-display .bingo-column {
      padding: 1px 0;
      height: auto;
      min-height: 0;
      flex-shrink: 0;
    }

    body.telao-display .column {
      gap: 3px;
      flex: none;
      height: auto;
      grid-template-rows: repeat(15, var(--cell-size));
    }

    body.telao-display .col-header,
    body.telao-display .cell {
      width: var(--cell-size);
      height: var(--cell-size);
      min-width: var(--cell-size);
      min-height: var(--cell-size);
      max-height: var(--cell-size);
      flex-shrink: 0;
    }

    body.telao-display .col-header {
      margin-bottom: 2px;
      font-size: calc(var(--cell-size) * 0.54);
    }

    body.telao-display .cell {
      color: rgba(255, 255, 255, 0.58);
      border-width: 2px;
    }

    body.telao-display .cell .cell-num {
      font-size: calc(var(--cell-size) * 0.5);
      font-weight: 700;
    }

    body.telao-display .cell.marked .cell-num {
      font-size: calc(var(--cell-size) * 0.54);
      font-weight: 700;
    }

    body.telao-display .cell.marked .cell-letter {
      display: block;
      font-size: calc(var(--cell-size) * 0.24);
    }

    body.telao-display .telao-count {
      font-size: clamp(1.35rem, 2.8vw, 2rem);
    }

    @media (min-width: 768px) {
      body.telao-display .board-stage {
        flex-direction: row !important;
        align-items: stretch;
        gap: clamp(0.35rem, 1vw, 0.75rem);
      }

      body.telao-display .telao-hero {
        display: block !important;
      }

      body.telao-display .bingo-board {
        flex: 1 1 74%;
        max-width: 74%;
      }

      body.telao-display .telao-spotlight {
        flex: 1 1 26%;
        max-width: 26%;
        min-width: 160px;
      }

      body.telao-display .telao-recent {
        display: none;
      }
    }

    @media (min-width: 1400px) {
      body.telao-display .bingo-board {
        flex: 1 1 76%;
        max-width: 76%;
      }

      body.telao-display .telao-spotlight {
        flex: 1 1 24%;
        max-width: 24%;
      }
    }

    body.telao-display .cell.marked.last {
      animation: ballAppear 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
    }

    .admin-link {
      position: fixed;
      bottom: max(0.5rem, env(safe-area-inset-bottom));
      right: max(0.5rem, env(safe-area-inset-right));
      z-index: 50;
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: var(--text-muted);
      text-decoration: none;
      font-size: 1rem;
      opacity: 0.35;
      transition: opacity 0.2s;
    }

    .admin-link:hover {
      opacity: 0.85;
      color: var(--accent-light);
    }

    /* ── Telão / projeção (telas largas) ── */
    @media (min-width: 1100px) {
      :root {
        --gap-xs: clamp(3px, 0.35vh, 6px);
      }

      .brand {
        margin-bottom: 0.25rem;
      }

      .brand h1 {
        display: block;
        font-size: clamp(1.4rem, 2.5vw, 2rem);
      }

      .brand-tag {
        font-size: 0.7rem;
      }

      .brand p {
        display: none;
      }

      .top-panel {
        margin-bottom: 0.35rem;
      }

      .telao-spotlight {
        max-width: 40%;
      }

      .telao-hero {
        display: block;
      }

      .actions .btn-draw {
        display: none;
      }

      .grid-wrapper {
        padding: clamp(0.35rem, 0.8vh, 0.65rem);
      }

      .col-header {
        font-size: min(calc(var(--cell-size) * 0.55), 2rem);
      }

      .cell .cell-num {
        font-size: min(calc(var(--cell-size) * 0.44), 1.3rem);
        font-weight: 600;
      }

      .cell.marked .cell-letter {
        font-size: min(calc(var(--cell-size) * 0.28), 0.85rem);
      }

      .cell.marked .cell-num {
        font-size: min(calc(var(--cell-size) * 0.46), 1.35rem);
      }
    }

    /* ── Desktop: cartela em tela cheia, histórico só no painel ── */
    @media (min-width: 901px) {
      :root {
        --chrome-h: 118px;
      }

      .brand p {
        display: none;
      }

      .history,
      .saved-badge {
        display: none;
      }
    }

    /* ── Monitores menores / notebooks (altura limitada) ── */
    @media (max-height: 820px) {
      :root {
        --chrome-h: 108px;
        --ball-small: 36px;
      }

      .brand p {
        display: none;
      }

      .brand h1 {
        font-size: 1.35rem;
      }

      .btn {
        min-height: 36px;
      }

      .history,
      .saved-badge {
        display: none;
      }
    }

    @media (max-height: 680px) {
      :root {
        --chrome-h: 92px;
        --ball-main: min(82px, 16vh);
        --ball-small: 30px;
      }

      .brand {
        margin-bottom: 0.25rem;
      }
    }

    @media (max-width: 1099px) {
      .telao-hero {
        display: none;
      }

      .board-stage {
        flex-direction: column;
      }

      .telao-spotlight {
        max-width: 100%;
        flex: none;
      }

      .telao-recent {
        margin-top: var(--gap-sm);
      }

      .telao-recent .recent-balls {
        max-height: clamp(100px, 22vh, 180px);
      }
    }
    @media (max-width: 480px) {
      body {
        height: auto;
        overflow-y: auto;
        overflow-x: hidden;
      }

      .container {
        height: auto;
        min-height: 100dvh;
      }

      :root {
        --ball-main: clamp(110px, 38vw, 160px);
        --chrome-h: 200px;
      }

      .main-layout {
        flex: none;
      }

      .top-panel {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
      }

      .actions {
        justify-content: center;
      }

      .actions .btn {
        flex: 1;
        min-width: 0;
      }

      .brand p {
        display: none;
      }

      .history {
        display: none;
      }
    }

    /* ── Celular landscape / tablet pequeno ── */
    @media (max-width: 768px) and (orientation: landscape) {
      body {
        height: auto;
        overflow-y: auto;
        overflow-x: hidden;
      }

      .container {
        height: auto;
        min-height: 100dvh;
      }

      :root {
        --ball-main: clamp(90px, 22vh, 140px);
        --chrome-h: 100px;
      }

      .brand p {
        display: none;
      }

      .brand h1 {
        font-size: clamp(1.1rem, 4vh, 1.5rem);
      }

      .main-layout {
        flex: none;
      }

      .grid-wrapper {
        padding: var(--gap-sm);
      }

      .history {
        display: none;
      }
    }

    /* ── Tablet portrait (481px – 900px) ── */
    @media (min-width: 481px) and (max-width: 900px) {
      body {
        height: auto;
        overflow-y: auto;
        overflow-x: hidden;
      }

      .container {
        height: auto;
        min-height: 100dvh;
      }

      .main-layout {
        flex: none;
      }
    }

    /* ── TV e telas muito grandes ── */
    @media (min-width: 1600px) and (min-height: 900px) {
      :root {
        --ball-small: 52px;
        --header-title: 2.25rem;
      }
    }

    /* ── TV 4K ── */
    @media (min-width: 2200px) and (min-height: 1080px) {
      :root {
        --ball-num-main: 5.5rem;
        --ball-letter-main: 2.25rem;
        --header-title: 3rem;
      }
    }

    /* ── Preferência movimento reduzido ── */
    @media (prefers-reduced-motion: reduce) {
      .bingo-ball.telao.pop,
      .bingo-ball.telao.spinning,
      .cell.marked.last {
        animation: none;
      }
    }
