/* ============================================================
   features.css — Chat, Daily Reward, Challenges, Tournament,
                  Share Card — Sudoku Battle
   ============================================================ */

/* ── Quick Chat ────────────────────────────────────────────── */
.chat-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    margin-top: 4px;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.15s;
    display: block;
}

.chat-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.chat-panel {
    position: fixed;
    top: 130px;
    bottom: 160px;
    /* acima do teclado numérico */
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    width: min(340px, 94vw);
    animation: fadeSlideDown 0.2s ease;
}

.chat-panel-inner {
    background: rgba(12, 16, 30, 0.97);
    border: 1px solid rgba(0, 255, 204, 0.25);
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
}

.chat-panel-header {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary, #00ffcc);
    margin-bottom: 10px;
    text-align: center;
    letter-spacing: 0.05em;
}

.chat-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.chat-opt {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #e0e5ec;
    font-size: 0.78rem;
    padding: 7px 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-opt:hover {
    background: rgba(0, 255, 204, 0.12);
    border-color: var(--primary, #00ffcc);
    transform: scale(1.04);
}

.chat-opt:active {
    transform: scale(0.97);
}

/* Balão de fala — centro do tabuleiro */
.chat-bubble {
    position: fixed;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    font-size: 1.15rem;
    font-weight: 800;
    padding: 14px 26px;
    border-radius: 20px;
    pointer-events: none;
    z-index: 800;
    text-align: center;
    white-space: nowrap;
    letter-spacing: 0.02em;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: none;
}

.chat-bubble-me {
    top: 120%;
    background: rgba(0, 255, 204, 0.22);
    border: 2px solid rgba(0, 255, 204, 0.7);
    color: #00ffee;
    text-shadow: 0 0 12px rgba(0, 255, 204, 0.8);
}

.chat-bubble-opp {
    top: 125%;
    background: rgba(255, 100, 150, 0.22);
    border: 2px solid rgba(255, 100, 150, 0.7);
    color: #ff80aa;
    text-shadow: 0 0 12px rgba(255, 100, 150, 0.8);
}

.chat-bubble.visible {
    animation: bubblePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
        bubbleFadeOut 0.4s ease 2.4s forwards;
}

/* Etiqueta de quem enviou */
.chat-bubble::before {
    content: attr(data-sender);
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 600;
    opacity: 0.7;
    white-space: nowrap;
}

@keyframes bubblePop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    60% {
        transform: translate(-50%, -50%) scale(1.08);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes bubbleFadeOut {
    from {
        opacity: 1;
        transform: translate(-50%, -55%) scale(1);
    }

    to {
        opacity: 0;
        transform: translate(-50%, -65%) scale(0.9);
    }
}

@keyframes fadeSlideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ── Daily Reward Modal ────────────────────────────────────── */
.daily-streak-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff8c00, #ff4500);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 900;
    padding: 10px 22px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(255, 80, 0, 0.5);
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}

.daily-reward-value {
    font-size: 2rem;
    font-weight: 900;
    color: gold;
    margin: 10px 0 14px;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

.daily-streak-track {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin: 8px 0;
}

.streak-day {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted, #8b9bb4);
    flex-direction: column;
    gap: 2px;
}

.streak-day.done {
    background: rgba(0, 255, 204, 0.15);
    border-color: var(--primary, #00ffcc);
    color: var(--primary, #00ffcc);
}

.streak-day.today {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.3), rgba(255, 80, 0, 0.3));
    border-color: #ff8c00;
    color: #ffaa00;
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.4);
    transform: scale(1.1);
}

/* ── Challenges Section ────────────────────────────────────── */
.challenge-item {
    background: rgba(20, 25, 45, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: border-color 0.2s;
}

.challenge-item.completed {
    border-color: rgba(0, 255, 204, 0.3);
}

.challenge-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.challenge-info {
    flex: 1;
    min-width: 0;
}

.challenge-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #e0e5ec;
}

.challenge-desc {
    font-size: 0.72rem;
    color: #8b9bb4;
}

.challenge-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.challenge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ffcc, #00b8ff);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.challenge-reward {
    font-size: 0.72rem;
    font-weight: 700;
    color: gold;
    flex-shrink: 0;
}

.challenge-claim-btn {
    background: linear-gradient(135deg, #00ffcc, #00b8ff);
    color: #0a0e1a;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.challenge-claim-btn:hover {
    transform: scale(1.05);
}

/* ── Tournament Modal ──────────────────────────────────────── */
.tournament-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 4px;
    font-size: 0.83rem;
}

.tournament-entry:first-child {
    background: rgba(255, 215, 0, 0.08);
}

.tournament-entry:nth-child(2) {
    background: rgba(192, 192, 192, 0.08);
}

.tournament-entry:nth-child(3) {
    background: rgba(205, 127, 50, 0.08);
}

.tournament-entry .t-rank {
    font-weight: 900;
    width: 20px;
    flex-shrink: 0;
}

.tournament-entry .t-name {
    flex: 1;
    font-weight: 600;
}

.tournament-entry .t-time {
    color: var(--primary, #00ffcc);
    font-weight: 700;
}

.tournament-me {
    background: rgba(0, 255, 204, 0.1) !important;
    border: 1px solid rgba(0, 255, 204, 0.3);
}

/* ── Share Card Preview ────────────────────────────────────── */
#share-preview {
    width: 100%;
    max-height: 240px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    display: block;
}

/* ── Lobby Extra Buttons ───────────────────────────────────── */
#lobby-extra-btns {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ── Células do Torneio Diário ──────────────────────────────────────────── */
.cell.user-correct {
    color: #00ffcc;
    background: rgba(0, 255, 204, 0.12);
    border-color: rgba(0, 255, 204, 0.4);
    transition: background 0.2s, color 0.2s;
}

.cell.error {
    color: #ff4466;
    background: rgba(255, 60, 80, 0.15);
    border-color: rgba(255, 60, 80, 0.5);
    animation: cellShake 0.35s ease;
}

@keyframes cellShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

/* ====================================================================
   SISTEMA DE AVATARES
   ==================================================================== */

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 6px 0;
    max-height: 280px;
    overflow-y: auto;
}

.avatar-option {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    margin: 0 auto;
}

.avatar-option:hover {
    border-color: var(--primary, #00ffcc);
    transform: scale(1.12);
    box-shadow: 0 0 14px rgba(0, 255, 204, 0.4);
}

.avatar-option.selected {
    border-color: var(--primary, #00ffcc);
    background: rgba(0, 255, 204, 0.15);
    box-shadow: 0 0 18px rgba(0, 255, 204, 0.5);
    transform: scale(1.08);
}

/* Avatar modal: aparece centralizado na tela, com fundo escurecido */
#avatar-modal.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 16px;
}

#avatar-modal .modal-box {
    width: 100%;
    max-width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 16px;
    border-radius: 16px;
}

#avatar-modal .avatar-grid {
    max-height: 200px;
}

/* Avatar no header do jogo */
.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(0, 255, 204, 0.5);
    background: rgba(0, 255, 204, 0.1);
    flex-shrink: 0;
}

.opp-avatar {
    border-color: rgba(255, 100, 150, 0.5);
    background: rgba(255, 100, 150, 0.1);
}

/* === TELA DE BATALHA PRE-PARTIDA === */
#prematch-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #03060f 0%, #080d1e 40%, #0a1230 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#prematch-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.prematch-title {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    margin-bottom: 30px;
}

.prematch-arena {
    width: 100%;
    max-width: 420px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
}

.prematch-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
    z-index: 2;
}

.prematch-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    font-size: 3.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.prematch-player-me .prematch-avatar {
    background: radial-gradient(circle, rgba(0, 80, 60, 0.7), rgba(0, 20, 40, 0.9));
    box-shadow: 0 0 0 3px #00ffcc, 0 0 30px rgba(0, 255, 204, 0.5);
    animation: pulseMe 1.5s ease-in-out infinite;
}

.prematch-player-opp .prematch-avatar {
    background: radial-gradient(circle, rgba(80, 0, 30, 0.7), rgba(30, 0, 20, 0.9));
    box-shadow: 0 0 0 3px #ff6496, 0 0 30px rgba(255, 100, 150, 0.5);
    animation: pulseOpp 1.5s ease-in-out infinite;
}

@keyframes pulseMe {

    0%,
    100% {
        box-shadow: 0 0 0 3px #00ffcc, 0 0 30px rgba(0, 255, 204, 0.5)
    }

    50% {
        box-shadow: 0 0 0 5px #00ffcc, 0 0 50px rgba(0, 255, 204, 0.8)
    }
}

@keyframes pulseOpp {

    0%,
    100% {
        box-shadow: 0 0 0 3px #ff6496, 0 0 30px rgba(255, 100, 150, 0.5)
    }

    50% {
        box-shadow: 0 0 0 5px #ff6496, 0 0 50px rgba(255, 100, 150, 0.8)
    }
}

.prematch-name {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    max-width: 100px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e0e5ec;
}

.prematch-trophies {
    font-size: 0.75rem;
    font-weight: 700;
    color: #FFD700;
}

.prematch-vs {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 3;
    flex-shrink: 0;
    padding: 0 10px;
}

.prematch-vs-text {
    font-size: 2.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #FFD700, #FF6B00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(255, 180, 0, 0.7));
    animation: vsPulse 0.8s ease-in-out infinite alternate;
}

@keyframes vsPulse {
    from {
        filter: drop-shadow(0 0 10px rgba(255, 180, 0, 0.5))
    }

    to {
        filter: drop-shadow(0 0 30px rgba(255, 180, 0, 0.9))
    }
}

.prematch-lightning {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 180px;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(ellipse 35% 60% at 50% 50%, rgba(255, 200, 0, 0.25) 0%, transparent 70%);
    animation: lightFlash 0.4s ease-in-out infinite alternate;
}

@keyframes lightFlash {
    from {
        opacity: 0.2
    }

    to {
        opacity: 0.45
    }
}

.prematch-divider {
    width: 75%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 204, 0.3), rgba(255, 100, 150, 0.3), transparent);
    margin: 20px auto;
}

.prematch-countdown {
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    animation: ctPulse 1s ease infinite;
}

@keyframes ctPulse {

    0%,
    100% {
        opacity: 0.5
    }

    50% {
        opacity: 1
    }
}