/* ============================================
   CRUZADAS TECH — DESIGN SYSTEM RESPONSIVO
   ============================================ */

:root {
    /* Fundo */
    --bg-gradient: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 50%, #ecfeff 100%);

    /* Primárias */
    --primary: #6D28D9;
    --primary-hover: #5B21B6;
    --primary-light: #EDE9FE;
    --primary-border: #C4B5FD;

    /* Sucesso */
    --success: #059669;
    --success-hover: #047857;
    --success-light: #D1FAE5;
    --success-border: #10B981;

    /* Destaque / seleção */
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-light: #DBEAFE;
    --accent-border: #93C5FD;

    /* Erro */
    --danger: #DC2626;
    --danger-light: #FEE2E2;
    --danger-border: #F87171;

    /* Aviso */
    --warn: #D97706;

    /* Neutros */
    --dark: #0F172A;
    --body: #1E293B;
    --muted: #64748B;
    --gray: #94A3B8;
    --light-gray: #E2E8F0;
    --white: #FFFFFF;

    /* ============================================
       CÉLULA RESPONSIVA — SEM OVERFLOW
       Grid tem 12 colunas + 11 gaps de 3px + padding 8px + padding wrapper 16px
       Fórmula: (100vw - 32px wrapper - 16px padding grid - 33px gaps) / 12
       = (100vw - 81px) / 12
       Limitado entre 22px e 40px
       ============================================ */
    --cell-size: clamp(22px, calc((100vw - 81px) / 12), 40px);

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
    --shadow-glow-primary: 0 0 0 4px rgba(109, 40, 217, 0.25);
    --shadow-glow-accent: 0 0 0 4px rgba(37, 99, 235, 0.25);
    --shadow-glow-success: 0 0 0 4px rgba(5, 150, 105, 0.25);

    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
    width: 100%;
    min-height: 100%;
    background: var(--bg-gradient);
    color: var(--body);
    overscroll-behavior-y: contain;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body { min-height: 100dvh; }

button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* ============================================
   APP CONTAINER
   ============================================ */
.app {
    width: 100%;
    min-height: 100dvh;
    max-width: 980px;
    margin: 0 auto;
    background: transparent;
    position: relative;
    overflow-x: hidden;
}

.screen {
    display: none;
    width: 100%;
    min-height: 100dvh;
    flex-direction: column;
    padding: max(16px, env(safe-area-inset-top, 0px)) 14px calc(16px + var(--safe-bottom));
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.screen.active { display: flex; }

/* ============================================
   TELA DE BOAS-VINDAS
   ============================================ */
.welcome-card {
    width: 100%;
    max-width: 560px;
    text-align: center;
    margin: auto;
}

.logo-emoji {
    display: block;
    margin-bottom: 6px;
    font-size: clamp(3rem, 14vw, 5rem);
    filter: drop-shadow(0 8px 16px rgba(109, 40, 217, 0.25));
    animation: floaty 3s ease-in-out infinite;
}

.game-title {
    font-size: clamp(2rem, 10vw, 3.4rem);
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: -0.045em;
    color: var(--dark);
    word-break: break-word;
}

.highlight-text {
    background: linear-gradient(135deg, #6D28D9 0%, #2563EB 50%, #0891B2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.game-subtitle {
    color: var(--muted);
    margin: 10px 0 22px;
    line-height: 1.5;
    font-size: clamp(0.88rem, 3.6vw, 1rem);
    font-weight: 500;
}

.footer-credit {
    margin-top: 18px !important;
    font-size: 0.72rem !important;
    opacity: 0.7;
}

/* ============================================
   GRID DE TEMAS
   ============================================ */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.topic-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
    min-height: 78px;
    padding: 12px;
    border: none;
    border-radius: var(--radius-lg);
    color: var(--white);
    font-size: clamp(0.75rem, 3.1vw, 0.92rem);
    font-weight: 800;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    word-break: break-word;
}

.topic-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 55%);
    pointer-events: none;
}

.topic-btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.topic-btn:active { transform: scale(0.97); }

.topic-icon {
    font-size: clamp(1.4rem, 6vw, 1.7rem);
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.18));
}

.topic-label {
    font-weight: 800;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.theme-informatica { background: linear-gradient(135deg, #3B82F6 0%, #1E40AF 100%); }
.theme-logica      { background: linear-gradient(135deg, #A855F7 0%, #6D28D9 100%); }
.theme-analise     { background: linear-gradient(135deg, #F59E0B 0%, #B45309 100%); }
.theme-web         { background: linear-gradient(135deg, #10B981 0%, #047857 100%); }
.theme-banco       { background: linear-gradient(135deg, #EC4899 0%, #BE185D 100%); }
.theme-ingles      { background: linear-gradient(135deg, #0EA5E9 0%, #0C4A6E 100%); }

/* ============================================
   BOTÕES
   ============================================ */
.btn {
    width: 100%;
    min-height: 50px;
    padding: 13px 15px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 800;
    font-size: clamp(0.88rem, 3.4vw, 0.95rem);
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
    touch-action: manipulation;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: var(--white);
    box-shadow: 0 6px 18px rgba(109, 40, 217, 0.28);
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(109, 40, 217, 0.4); }

.btn-secondary {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-hover) 100%);
    color: var(--white);
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.28);
}
.btn-secondary:hover { box-shadow: 0 8px 22px rgba(5, 150, 105, 0.4); }

.btn-outline {
    background: var(--white);
    border: 2px solid var(--light-gray);
    color: var(--body);
    box-shadow: var(--shadow-sm);
}
.btn-outline:hover {
    border-color: var(--primary-border);
    color: var(--primary);
    background: var(--primary-light);
}

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

.button-group-bottom {
    display: grid;
    gap: 8px;
}

/* ============================================
   TELA DO JOGO — CABEÇALHO
   ============================================ */
.game-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 32px - var(--safe-bottom));
    width: 100%;
}

.game-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    width: 100%;
}

.header-left { justify-self: start; }
.header-right { justify-self: end; }

.header-center {
    display: flex;
    justify-content: center;
    gap: clamp(6px, 2.5vw, 16px);
    font-size: clamp(0.85rem, 3.5vw, 1.05rem);
    font-weight: 800;
}

.phase-pill {
    padding: 6px 11px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: var(--white);
    border-radius: 999px;
    font-size: clamp(0.68rem, 2.9vw, 0.78rem);
    font-weight: 900;
    letter-spacing: 0.06em;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
}

.stat-item { white-space: nowrap; }
.timer-alert { color: var(--warn); }
.score-item { color: var(--primary); }

.btn-exit {
    padding: 6px 12px;
    background: var(--danger-light);
    border: 2px solid var(--danger-border);
    border-radius: 999px;
    color: var(--danger);
    font-size: clamp(0.72rem, 3vw, 0.82rem);
    font-weight: 800;
    cursor: pointer;
    transition: background 0.16s ease, transform 0.16s ease;
    touch-action: manipulation;
    white-space: nowrap;
}
.btn-exit:hover { background: #FECACA; }
.btn-exit:active { transform: scale(0.96); }

/* ============================================
   TAG DE TEMA
   ============================================ */
.topic-tag {
    align-self: flex-start;
    margin-bottom: 10px;
    padding: 5px 12px;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    border: 2px solid var(--success-border);
    border-radius: 999px;
    color: #065F46;
    font-size: clamp(0.68rem, 2.9vw, 0.78rem);
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.18);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   CAIXA DE DICA
   ============================================ */
.hint-box {
    min-height: 88px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    border: 2px solid var(--primary-border);
    border-left: 5px solid var(--primary);
    border-radius: var(--radius-md);
    color: var(--primary-hover);
    text-align: left;
    box-shadow: var(--shadow-md);
    width: 100%;
    overflow: hidden;
}

.hint-title {
    display: block;
    color: var(--primary);
    font-size: clamp(0.68rem, 2.9vw, 0.78rem);
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hint-entry {
    display: flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1.4;
    flex-wrap: wrap;
}

.hint-entry strong {
    flex: 0 0 auto;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 8px;
    color: var(--white);
    font-size: clamp(0.78rem, 3.2vw, 0.9rem);
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(109, 40, 217, 0.3);
}

.hint-entry span,
.hint-empty {
    font-size: clamp(0.92rem, 4vw, 1.12rem);
    font-weight: 700;
    color: var(--dark);
    word-break: break-word;
    flex: 1 1 auto;
    min-width: 0;
}

.hint-empty { color: var(--muted); line-height: 1.4; }
.success-message { color: var(--success) !important; }

/* ============================================
   LAYOUT DO JOGO
   ============================================ */
.game-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* Grid wrapper SEM overflow — o grid escala para caber */
.grid-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 8px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    overflow: hidden;
}

.crossword-grid {
    display: grid;
    gap: 3px;
    width: max-content;
    max-width: 100%;
    padding: 4px;
    margin: 0 auto;
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    position: relative;
}

.cell.black { background: transparent; }

/* ============================================
   CÉLULAS
   ============================================ */
.cell input {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 2px solid #CBD5E1;
    border-radius: 7px;
    outline: none;
    background: var(--white);
    color: var(--dark);
    font-size: clamp(0.9rem, 4vw, 1.35rem);
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.1s ease;
    touch-action: manipulation;
    caret-color: var(--accent);
}

.cell input:focus {
    position: relative;
    z-index: 3;
    border-color: var(--accent);
    background: #FFFFFF;
    box-shadow: var(--shadow-glow-accent);
}

.cell.active-word input {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.cell.active-word input:focus {
    background: #BFDBFE;
    border-color: var(--accent-hover);
    box-shadow: var(--shadow-glow-accent);
}

.cell-number {
    position: absolute;
    top: 1px;
    left: 3px;
    z-index: 1;
    color: var(--primary);
    font-size: clamp(0.44rem, 1.9vw, 0.62rem);
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
}

.cell.wrong-letter input {
    border-color: var(--danger) !important;
    background: var(--danger-light) !important;
    color: #991B1B !important;
    animation: shake 0.28s ease;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.cell.correct-word input {
    border-color: var(--success-border) !important;
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%) !important;
    color: #065F46 !important;
    animation: popIn 0.35s ease;
    box-shadow: var(--shadow-glow-success);
    font-weight: 900;
}

.cell.correct-word input:disabled {
    opacity: 1;
    cursor: default;
}

/* ============================================
   LISTAS DE DICAS
   ============================================ */
.clues-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
}

.clues-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.clues-heading {
    margin-bottom: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: clamp(0.68rem, 2.9vw, 0.8rem);
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--white);
    text-align: center;
}

.clues-heading-across {
    background: linear-gradient(135deg, #3B82F6 0%, #1E40AF 100%);
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.28);
}

.clues-heading-down {
    background: linear-gradient(135deg, #F59E0B 0%, #B45309 100%);
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.28);
}

.clues-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    -webkit-overflow-scrolling: touch;
}

.clue-item {
    display: flex;
    gap: 6px;
    padding: 8px 9px;
    border-radius: var(--radius-sm);
    background: #F8FAFC;
    border-left: 3px solid var(--light-gray);
    color: var(--body);
    font-size: clamp(0.72rem, 3vw, 0.83rem);
    line-height: 1.35;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
    word-break: break-word;
}

.clue-item:hover {
    background: var(--primary-light);
    border-left-color: var(--primary);
}

.clue-number {
    flex: 0 0 auto;
    font-weight: 900;
    color: var(--primary);
    min-width: 18px;
}

.clue-item.active-clue {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: var(--white);
    border-left-color: var(--accent);
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.35);
}

.clue-item.active-clue .clue-number { color: var(--white); }

.clue-item.clue-done {
    opacity: 0.55;
    background: var(--success-light);
    border-left-color: var(--success);
}

.clue-item.clue-done .clue-text {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: var(--success);
}

.clue-empty {
    color: var(--muted);
    font-size: 0.78rem;
    font-style: italic;
    padding: 6px;
}

/* ============================================
   PROGRESSO
   ============================================ */
.progress-bar-container {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    width: 100%;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: clamp(0.7rem, 2.9vw, 0.82rem);
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.track {
    width: 100%;
    height: 10px;
    overflow: hidden;
    background: var(--light-gray);
    border-radius: 999px;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.1);
}

.fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #10B981 0%, #059669 50%, #047857 100%);
    border-radius: inherit;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

/* ============================================
   MODAIS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
}

.modal.active { display: flex; }

.modal-card {
    width: 100%;
    max-width: 420px;
    max-height: calc(100dvh - 28px);
    overflow-y: auto;
    padding: 22px 18px calc(18px + var(--safe-bottom));
    background: var(--white);
    border-radius: var(--radius-xl);
    text-align: center;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    animation: slideUp 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-icon {
    margin-bottom: 8px;
    font-size: clamp(2.4rem, 11vw, 3.2rem);
    line-height: 1;
}

.modal-title {
    margin-bottom: 14px;
    font-size: clamp(1.25rem, 5.5vw, 1.7rem);
    font-weight: 900;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.modal-body {
    color: var(--body);
    line-height: 1.6;
    text-align: left;
    font-size: clamp(0.84rem, 3.4vw, 0.94rem);
}

.modal-body p + p { margin-top: 8px; }
.modal-body strong { color: var(--primary); }

.modal-copy {
    color: var(--muted);
    line-height: 1.5;
    font-size: clamp(0.86rem, 3.4vw, 0.96rem);
}

.final-score-text {
    margin-bottom: 16px;
    font-size: clamp(0.92rem, 3.7vw, 1.05rem);
    color: var(--body);
}

.final-score-text strong {
    color: var(--primary);
    font-size: 1.15em;
}

/* ============================================
   INPUTS
   ============================================ */
.game-input {
    width: 100%;
    min-height: 50px;
    margin-bottom: 10px;
    padding: 12px 13px;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-md);
    background: var(--white);
    font-size: 1rem; /* 16px evita zoom automático no iOS */
    font-weight: 600;
    color: var(--dark);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.game-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: var(--shadow-glow-primary);
}

.game-input::placeholder { color: var(--gray); font-weight: 500; }

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 4px;
    color: var(--body);
    font-size: clamp(0.74rem, 3vw, 0.8rem);
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
}

.consent-label input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============================================
   RANKING — CARDS EM MOBILE (sem tabela larga)
   ============================================ */
.ranking-card {
    width: 100%;
    max-width: 720px;
    margin: auto;
    padding: 20px 14px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.table-scroll {
    max-height: 60dvh;
    margin: 14px 0;
    overflow-y: auto;
    overflow-x: hidden;
    text-align: left;
    border-radius: var(--radius-md);
    -webkit-overflow-scrolling: touch;
}

/* Tabela para telas grandes */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

th {
    position: sticky;
    top: 0;
    padding: 11px 9px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: var(--white);
    text-align: left;
    font-weight: 900;
    letter-spacing: 0.03em;
    font-size: 0.76rem;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    padding: 11px 9px;
    border-bottom: 1px solid var(--light-gray);
    color: var(--body);
    font-weight: 600;
    font-size: 0.84rem;
}

tr:nth-child(even) td { background: #F8FAFC; }

tr:first-child td {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    font-weight: 800;
}

td small, th small {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.76rem;
}

.empty-ranking {
    padding: 30px 10px;
    color: var(--muted);
    text-align: center;
    font-style: italic;
}

/* ============================================
   CÓDIGO COMPROVANTE
   ============================================ */
.codigo-box {
    margin: 14px 0 8px;
    padding: 14px 12px;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    border: 3px dashed var(--success);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15);
    word-break: break-all;
}

.codigo-label {
    font-size: clamp(0.7rem, 2.9vw, 0.78rem);
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--success-hover);
    margin-bottom: 8px;
}

.codigo-valor {
    font-size: clamp(1.5rem, 7vw, 2rem);
    font-weight: 900;
    letter-spacing: 0.18em;
    color: #065F46;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    text-shadow: 0 2px 6px rgba(5, 150, 105, 0.2);
    word-break: break-all;
}

.codigo-data {
    margin-top: 6px;
    font-size: clamp(0.76rem, 3.1vw, 0.85rem);
    color: var(--success-hover);
    font-weight: 700;
}

.codigo-aviso {
    margin-top: 10px;
    font-size: clamp(0.72rem, 2.9vw, 0.78rem);
    color: var(--muted);
    line-height: 1.4;
}

/* ============================================
   PREMIAÇÃO
   ============================================ */
.premiacao-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    text-align: left;
}

.premiacao-list li {
    padding: 11px 12px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: clamp(0.84rem, 3.4vw, 0.94rem);
    color: var(--body);
    font-weight: 600;
}

.premiacao-list li strong { color: var(--primary); font-weight: 900; }

/* ============================================
   UTILITÁRIOS
   ============================================ */
.mt-4 { margin-top: 1rem; }
.mt-2 { margin-top: 0.5rem; }

.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;
}

/* ============================================
   RESPONSIVO
   ============================================ */

/* Telas MUITO estreitas (320px) */
@media (max-width: 360px) {
    :root {
        --cell-size: clamp(20px, calc((100vw - 71px) / 12), 28px);
    }

    .screen { padding-left: 10px; padding-right: 10px; }

    .topic-grid { gap: 8px; }
    .topic-btn { min-height: 70px; padding: 10px; }

    .game-header { gap: 6px; }
    .phase-pill { padding: 5px 9px; }
    .btn-exit { padding: 5px 10px; }

    .clues-panel { gap: 8px; padding: 8px; }
    .clue-item { font-size: 0.7rem; padding: 7px 8px; }
}

/* Telas pequenas comuns (360-480px): 1 coluna só para dicas */
@media (max-width: 480px) {
    .clues-panel {
        grid-template-columns: 1fr;
    }

    .clues-list {
        max-height: 150px;
    }

    /* Ranking em formato de cards empilhados */
    .ranking-card table,
    .ranking-card thead,
    .ranking-card tbody,
    .ranking-card th,
    .ranking-card td,
    .ranking-card tr {
        display: block;
        width: 100%;
    }

    .ranking-card thead { display: none; }

    .ranking-card tr {
        margin-bottom: 10px;
        padding: 12px;
        background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
        border-left: 4px solid var(--primary);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        position: relative;
    }

    .ranking-card tr:first-child {
        background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
        border-left-color: #D97706;
    }

    .ranking-card td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
        border: none;
        font-size: 0.85rem;
        background: transparent !important;
    }

    .ranking-card tr:nth-child(even) td { background: transparent; }

    .ranking-card td::before {
        content: attr(data-label);
        font-weight: 800;
        color: var(--primary);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        flex: 0 0 auto;
        margin-right: 10px;
    }

    .ranking-card td:first-child {
        font-size: 1.1rem;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--light-gray);
        margin-bottom: 6px;
    }

    .ranking-card td:first-child::before { content: none; }
}

/* Tablet / Desktop */
@media (min-width: 560px) {
    .screen { padding-left: 22px; padding-right: 22px; }
    .topic-grid { gap: 12px; }
    .topic-btn { min-height: 88px; }
}

@media (min-width: 760px) {
    :root {
        --cell-size: clamp(26px, 3.6vw, 42px);
    }

    .screen { padding-left: 28px; padding-right: 28px; }

    .game-layout {
        flex-direction: row;
        align-items: flex-start;
    }

    .grid-wrapper {
        flex: 1 1 auto;
        padding: 12px;
    }

    .clues-panel {
        flex: 0 0 320px;
        grid-template-columns: 1fr;
    }

    .clues-list { max-height: 220px; }

    .topic-btn { min-height: 96px; }
}

/* Telas baixas em mobile */
@media (max-height: 700px) and (max-width: 560px) {
    .screen { padding-top: 10px; }

    .hint-box {
        min-height: 74px;
        padding: 10px 12px;
        margin-bottom: 8px;
    }

    .clues-list { max-height: 120px; }

    .progress-bar-container {
        padding: 8px 10px;
        margin-top: 8px;
    }

    .game-header { margin-bottom: 8px; }
    .topic-tag { margin-bottom: 8px; }
}

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

/* ============================================
   ANIMAÇÕES
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes popIn {
    0% { transform: scale(1); }
    50% { transform: scale(1.16); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-3px); }
}

@keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}