*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0; height: 100%;
    background: #0d1117;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

#app { height: 100%; }

#blazor-error-ui {
    background: #cf6679; color: white; padding: 8px 16px;
    text-align: center; font-size: 14px;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
}

.mud-typography { font-family: 'Inter', sans-serif !important; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(230,237,243,0.15); border-radius: 2px; }

/* ===== APP SHELL ===== */
.app-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.app-content { flex: 1; overflow-y: auto; overflow-x: hidden; }
.bottom-nav {
    display: flex; background: #161b22;
    border-top: 1px solid rgba(230,237,243,0.08);
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 8px 0; color: rgba(230,237,243,0.4);
    text-decoration: none; font-size: 11px; gap: 2px;
    transition: color 0.15s;
}
.bottom-nav .nav-item:hover { color: rgba(230,237,243,0.7); }
.bottom-nav .nav-item.active { color: #2ECC71; }

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex; align-items: center; gap: 8px;
    padding: 16px 16px 8px;
    position: sticky; top: 0; z-index: 10;
    background: #0d1117;
}

/* ===== HOME ===== */
.home-page { padding-bottom: 16px; }
.home-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px;
}
.home-user-info { display: flex; align-items: center; gap: 10px; }
.online-badge {
    display: flex; align-items: center; gap: 6px;
    background: rgba(46,204,113,0.1); border: 1px solid rgba(46,204,113,0.2);
    border-radius: 20px; padding: 4px 10px;
    font-size: 12px; color: #2ECC71;
}
.online-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #2ECC71;
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%,100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}
.modes-section { margin-bottom: 8px; }
.section-title { color: rgba(230,237,243,0.4); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.modes-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-tile {
    border-radius: 16px; padding: 20px 16px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer; user-select: none;
    transition: transform 0.12s, filter 0.12s;
}
.mode-tile:active { transform: scale(0.96); }
.mode-tile-green { background: #2ECC71; }
.mode-tile-amber { background: #F39C12; }
.mode-tile-title { color: #0d1117; font-weight: 700; font-size: 15px; }
.mode-tile-sub { color: rgba(0,0,0,0.5); font-size: 12px; }
.join-panel {
    background: #161b22; border-radius: 16px; padding: 16px;
    border: 1px solid rgba(230,237,243,0.08);
}
.code-inputs { display: flex; gap: 8px; margin: 8px 0 12px; }
.code-char {
    flex: 1; height: 48px; border-radius: 10px;
    border: 2px solid rgba(230,237,243,0.15);
    background: rgba(255,255,255,0.04);
    color: #e6edf3; font-size: 20px; font-weight: 700;
    text-align: center; outline: none;
}
.code-char:focus { border-color: #2ECC71; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; align-items: flex-end; z-index: 100;
}
.modal-card {
    background: #161b22; border-radius: 20px 20px 0 0;
    padding: 24px; width: 100%;
    border-top: 1px solid rgba(230,237,243,0.1);
}

/* ===== RANKING ===== */
.ranking-page { padding-bottom: 16px; }
.my-stats-card {
    background: linear-gradient(135deg, #161b22 0%, #1c2333 100%);
    border-radius: 16px; padding: 16px;
    border: 1px solid rgba(46,204,113,0.15);
}
.my-stats-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.my-stats-name { flex: 1; }
.elo-badge { display: flex; align-items: center; gap: 4px; }
.my-rank-circle {
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(46,204,113,0.1); border: 2px solid rgba(46,204,113,0.3);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.my-stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.stat-cell { display: flex; flex-direction: column; align-items: center; }
.stat-val { font-size: 18px; font-weight: 700; color: #e6edf3; }
.stat-lbl { font-size: 10px; color: rgba(230,237,243,0.4); text-transform: uppercase; }

.tab-pills { display: flex; gap: 8px; }
.pill {
    flex: 1; padding: 8px 12px; border-radius: 20px;
    border: 1px solid rgba(230,237,243,0.15);
    background: transparent; color: rgba(230,237,243,0.5);
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.pill.active { background: #2ECC71; border-color: #2ECC71; color: #0d1117; }
.pill-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: #E74C3C; color: white; font-size: 10px; margin-left: 4px;
}

.ranking-list { display: flex; flex-direction: column; gap: 6px; }
.rank-row {
    display: flex; align-items: center; gap: 10px;
    background: #161b22; border-radius: 12px; padding: 10px 12px;
    border: 1px solid rgba(230,237,243,0.05);
}
.rank-row-me { border-color: rgba(46,204,113,0.3); background: rgba(46,204,113,0.05); }
.rank-pos { width: 28px; display: flex; justify-content: center; }
.pos-number { color: rgba(230,237,243,0.4); font-weight: 600; font-size: 14px; }
.rank-info { flex: 1; display: flex; flex-direction: column; }
.rank-name { font-size: 14px; font-weight: 600; color: #e6edf3; }
.rank-sub { font-size: 11px; color: rgba(230,237,243,0.4); }
.rank-score { display: flex; flex-direction: column; align-items: flex-end; }
.score-val { font-size: 16px; font-weight: 700; color: #F39C12; }
.score-lbl { font-size: 10px; color: rgba(230,237,243,0.4); }

.loading-center { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; }
.empty-state { display: flex; flex-direction: column; align-items: center; }

/* ===== SETTINGS ===== */
.settings-page { padding-bottom: 32px; }
.avatar-section { display: flex; flex-direction: column; align-items: center; padding: 16px; }
.avatar-wrapper { position: relative; cursor: pointer; }
.avatar-edit-badge {
    position: absolute; bottom: 0; right: 0;
    width: 26px; height: 26px; border-radius: 50%;
    background: #2ECC71; display: flex; align-items: center; justify-content: center;
    border: 2px solid #0d1117;
}
.section-card { background: #161b22 !important; border-radius: 16px !important; padding: 16px !important; }
.section-label { color: rgba(230,237,243,0.4) !important; font-size: 11px !important; display: block; margin-bottom: 12px; }
.sub-info { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

/* ===== SOCIAL ===== */
.social-page { padding-bottom: 16px; }
.requests-badge {
    width: 20px; height: 20px; border-radius: 50%;
    background: #E74C3C; color: white; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    margin-left: auto;
}
.search-bar { }
.user-list { display: flex; flex-direction: column; gap: 4px; }
.user-row {
    display: flex; align-items: center; gap: 10px;
    background: #161b22; border-radius: 12px; padding: 10px 12px;
    border: 1px solid rgba(230,237,243,0.05);
}
.user-info-col { flex: 1; display: flex; flex-direction: column; }
.user-name { font-size: 14px; font-weight: 600; color: #e6edf3; }
.user-sub { font-size: 11px; color: rgba(230,237,243,0.4); }
.request-actions { display: flex; gap: 4px; }

/* ===== LOBBY ===== */
.lobby-wait-page {
    height: 100vh; height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    background: #0d1117;
}

/* Queue screen — fallback */
.queue-screen { display: flex; flex-direction: column; align-items: center; padding: 32px; text-align: center; }

/* Queue V2 — two avatar slots */
.queue-v2-screen {
    display: flex; flex-direction: column; align-items: center;
    padding: 32px 24px; text-align: center; width: 100%; max-width: 360px;
}
.queue-v2-slots {
    display: flex; align-items: center; gap: 16px; margin-bottom: 28px; width: 100%;
    justify-content: center;
}
.queue-slot-filled, .queue-slot-empty {
    display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1;
}
.queue-avatar-circle {
    width: 80px; height: 80px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 700;
    border: 3px solid rgba(46,204,113,0.4);
}
.queue-avatar-empty {
    width: 80px; height: 80px; border-radius: 50%;
    border: 2px dashed rgba(230,237,243,0.2);
    display: flex; align-items: center; justify-content: center;
}
.queue-slot-name { font-size: 14px; font-weight: 600; color: #e6edf3; }
.queue-searching-text { color: rgba(230,237,243,0.35) !important; }
.queue-slot-ready {
    font-size: 11px; color: #2ECC71; background: rgba(46,204,113,0.1);
    border-radius: 8px; padding: 2px 10px; font-weight: 600;
}
.queue-wait-secs { font-size: 12px; color: rgba(230,237,243,0.3); }
.queue-vs-divider {
    font-size: 22px; font-weight: 900; color: rgba(230,237,243,0.25);
    flex-shrink: 0;
}
.queue-mode-label {
    font-size: 13px; font-weight: 600; color: rgba(230,237,243,0.5);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px;
}

/* Queue V2 — 4-slot (2v2) layout */
.queue-v2-slots-4 {
    display: flex; align-items: center; gap: 12px; margin-bottom: 20px; width: 100%;
    justify-content: center;
}
.queue-team-column {
    display: flex; flex-direction: column; gap: 12px; flex: 1;
}

/* Private room V2 */
.private-v2-screen {
    display: flex; flex-direction: column; align-items: center;
    padding: 24px 20px; width: 100%; max-width: 400px;
}
.private-slots-grid {
    display: grid; gap: 12px; width: 100%; margin-bottom: 20px;
}
.private-slots-grid.grid-2 { grid-template-columns: 1fr 1fr; }
.private-slots-grid.grid-4 { grid-template-columns: 1fr 1fr; }

.private-slot-filled {
    background: rgba(255,255,255,0.04); border-radius: 16px;
    padding: 16px 12px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    border: 1px solid rgba(46,204,113,0.2);
}
.private-slot-invite {
    background: rgba(255,255,255,0.02); border-radius: 16px;
    padding: 16px 12px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    border: 1px dashed rgba(230,237,243,0.12);
    text-align: center;
}
.private-avatar-circle {
    width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700;
}
.private-slot-name { font-size: 13px; font-weight: 600; color: #e6edf3; }
.private-slot-badge {
    font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 8px;
}
.private-slot-badge.host { color: #F39C12; background: rgba(243,156,18,0.1); }
.invite-prompt-text { font-size: 10px; color: rgba(230,237,243,0.35); line-height: 1.3; }
.invite-room-code {
    font-size: 20px; font-weight: 700; letter-spacing: 4px; color: #F39C12;
    margin: 4px 0;
}
.invite-copy-btn {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; color: rgba(230,237,243,0.4);
    background: none; border: 1px solid rgba(230,237,243,0.1);
    border-radius: 8px; padding: 4px 10px; cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.invite-copy-btn:hover { color: #e6edf3; border-color: rgba(230,237,243,0.3); }
.private-actions {
    display: flex; flex-direction: column; gap: 8px; width: 100%;
}

/* Invite sheet */
.invite-sheet { max-height: 80vh; overflow-y: auto; }

/* VS screen — portrait cards */
.vs-full-screen {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100vh; height: 100dvh; padding: 32px;
    background: #0d1117; gap: 0;
}
.vs-header-text {
    font-size: 16px; font-weight: 600; color: rgba(230,237,243,0.55);
    margin-bottom: 16px; letter-spacing: 0.5px;
}
.vs-cards-row {
    display: flex; align-items: center; justify-content: center;
    gap: 16px; margin-bottom: 48px;
}
.vs-portrait-card {
    width: 140px; min-height: 200px;
    background: #161b22;
    border-radius: 20px; padding: 20px 16px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    border: 1px solid rgba(230,237,243,0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.vs-portrait-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.vs-initial { font-size: 32px; font-weight: 700; color: #0d1117; }
.vs-portrait-name {
    font-size: 15px; font-weight: 700; color: #e6edf3;
    text-align: center; word-break: break-word;
}
.vs-red-badge {
    font-size: 28px; font-weight: 900; color: #E74C3C;
    text-shadow: 0 0 20px rgba(231,76,60,0.5);
    flex-shrink: 0;
}

@keyframes countdown-pulse {
    0%,100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.95); opacity: 0.7; }
}

/* ===== GAME ===== */
.game-page {
    height: 100vh; height: 100dvh;
    display: flex; flex-direction: column;
    background: #0d1117;
    position: relative; overflow: hidden;
}

/* Slim header */
.game-header-slim {
    display: flex; align-items: center;
    padding: 4px 8px;
    background: rgba(13,17,23,0.97);
    border-bottom: 1px solid rgba(230,237,243,0.06);
    z-index: 10; gap: 4px;
}
.header-score-chips {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.score-chip {
    font-size: 12px; font-weight: 700; border-radius: 8px;
    padding: 2px 10px; letter-spacing: 0.3px;
}
.score-nos {
    color: #2ECC71; background: rgba(46,204,113,0.12);
    border: 1px solid rgba(46,204,113,0.25);
}
.score-eles {
    color: #E74C3C; background: rgba(231,76,60,0.12);
    border: 1px solid rgba(231,76,60,0.25);
}
.score-sep { color: rgba(230,237,243,0.3); font-size: 12px; font-weight: 700; }

/* Table wrapper */
.game-table-wrapper {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at center, #0f2318 0%, #0d1117 100%);
    padding: 8px; overflow: hidden;
}

/* Rectangular wooden table — uses MesaJogo.png */
.rect-table {
    width: min(300px, 88vw);
    aspect-ratio: 3/4;
    border-radius: 14px;
    background-image: url('/MesaJogo.png');
    background-size: cover;
    background-position: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 2px rgba(255,255,255,0.06);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 12px;
    position: relative;
    flex-shrink: 0;
}

/* Opponent zone — top of table */
.opp-zone {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    transition: all 0.2s;
}
.opp-avatar-row { display: flex; align-items: center; gap: 8px; }
.opp-avatar-ring {
    border-radius: 50%;
    transition: box-shadow 0.2s;
}
.opp-avatar-ring.ring-active {
    box-shadow: 0 0 0 3px #2ECC71, 0 0 12px rgba(46,204,113,0.4);
}
.turn-indicator-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #2ECC71;
    animation: pulse-dot 1s ease-in-out infinite;
}
.opp-cards-row { display: flex; gap: 4px; }
.card-back-sm {
    width: 28px; height: 40px; border-radius: 5px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8e 100%);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}

/* Table center: deck + trick */
.table-center {
    display: flex; align-items: center; justify-content: center;
    gap: 20px; flex: 1; width: 100%;
}

/* Deck stack */
.deck-stack {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    position: relative;
}
.deck-cards { position: relative; width: 44px; height: 60px; }
.deck-card-back {
    position: absolute;
    width: 44px; height: 60px; border-radius: 6px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8e 100%);
    border: 1px solid rgba(255,255,255,0.12);
}
.deck-count {
    font-size: 11px; font-weight: 600; color: rgba(230,237,243,0.5);
    margin-top: 4px;
}

/* Trump card on table */
.trump-card-on-table {
    width: 44px; height: 60px; border-radius: 6px;
    border: 1px solid rgba(243,156,18,0.6);
    background: #f8f4e8;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; position: relative;
    box-shadow: 0 0 8px rgba(243,156,18,0.3);
}
.trump-card-on-table.red { color: #c0392b; }
.trump-card-on-table.black { color: #1a1a1a; }
.trump-label {
    position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
    font-size: 9px; color: #F39C12; white-space: nowrap; font-weight: 600;
}

/* Trick area */
.trick-area {
    display: flex; align-items: center; justify-content: center;
    gap: 12px;
}
.trick-card-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trick-player-name { font-size: 10px; color: rgba(230,237,243,0.5); }

/* Playing cards — PNG image based */
.playing-card {
    width: 52px; height: 76px; border-radius: 6px;
    border: 3px solid transparent;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 2px 4px 10px rgba(0,0,0,0.55);
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    position: relative;
    background: transparent;
}
.playing-card img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    border-radius: 4px;
}

/* Trick card: pointer-events disabled */
.playing-card.trick-card {
    cursor: default;
    pointer-events: none;
}

/* Card back (deck, opponent fan) */
.card-back-img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    border-radius: 4px;
}

/* Hand — no green background, only card borders */
.card-rank-tl, .card-rank-br, .card-suit-center { display: none; }

/* My hand — no green background, only card borders change when it's my turn */
.my-hand {
    display: flex; justify-content: center; gap: 6px;
    padding: 10px 8px 12px;
    flex-wrap: nowrap; overflow-x: auto;
    border-radius: 0;
}

.swap-banner {
    display: flex; align-items: center; gap: 8px;
    background: rgba(243,156,18,0.12); border: 1px solid rgba(243,156,18,0.25);
    border-radius: 10px; margin: 0 8px 4px;
    padding: 8px 12px; cursor: pointer; font-size: 13px; color: #F39C12;
}

.play-confirm {
    display: flex; gap: 8px; justify-content: center;
    padding: 4px 16px 4px;
}

/* Emoji bar — bottom only */
.emoji-bar {
    display: flex; justify-content: center; gap: 8px;
    padding: 8px 16px;
    background: rgba(22,27,34,0.9);
    border-top: 1px solid rgba(230,237,243,0.06);
}
.emoji-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(230,237,243,0.1);
    color: rgba(230,237,243,0.7); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.1s;
}
.emoji-btn:hover { background: rgba(255,255,255,0.12); }
.emoji-btn:active { transform: scale(0.88); }

/* Emoji flash */
.emoji-flash {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    pointer-events: none; z-index: 200;
    animation: emoji-pop 0.3s ease-out;
    background: rgba(22,27,34,0.9); border-radius: 16px;
    padding: 16px 24px; border: 1px solid rgba(230,237,243,0.1);
}
.emoji-flash span { font-size: 12px; color: rgba(230,237,243,0.6); }
@keyframes emoji-pop {
    from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Chat panel */
.chat-panel {
    position: fixed; right: 0; top: 0; bottom: 0;
    width: min(320px, 100vw);
    background: #161b22;
    border-left: 1px solid rgba(230,237,243,0.1);
    display: flex; flex-direction: column;
    z-index: 50;
    animation: slide-in 0.2s ease-out;
}
@keyframes slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(230,237,243,0.1);
}
.chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { display: flex; flex-direction: column; gap: 2px; }
.msg-user { font-size: 11px; color: #2ECC71; font-weight: 600; }
.msg-text { font-size: 13px; color: rgba(230,237,243,0.8); }
.chat-input { padding: 12px; border-top: 1px solid rgba(230,237,243,0.08); }

/* ===== Admin Dashboard ===== */
.admin-page {
    min-height: 100vh; background: #0d1117;
    padding: 20px 16px 40px; max-width: 1100px; margin: 0 auto;
}
.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; padding-bottom: 16px;
    border-bottom: 1px solid rgba(230,237,243,0.08);
}
.admin-stats-row {
    display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 24px;
}
@media (max-width: 600px) { .admin-stats-row { grid-template-columns: repeat(2,1fr); } }
.admin-stat-card {
    background: rgba(255,255,255,0.04); border-radius: 12px; padding: 16px;
    border: 1px solid rgba(230,237,243,0.08); text-align: center;
}
.admin-stat-card.stat-green { border-color: rgba(46,204,113,0.2); }
.admin-stat-card.stat-yellow { border-color: rgba(243,156,18,0.2); }
.admin-stat-card.stat-red { border-color: rgba(231,76,60,0.2); }
.admin-stat-value { font-size: 2rem; font-weight: 800; color: #e6edf3; }
.admin-stat-card.stat-green .admin-stat-value { color: #2ECC71; }
.admin-stat-card.stat-yellow .admin-stat-value { color: #F39C12; }
.admin-stat-card.stat-red .admin-stat-value { color: #E74C3C; }
.admin-stat-label { font-size: 11px; color: rgba(230,237,243,0.4); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.admin-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid rgba(230,237,243,0.08); }
.admin-table { width: 100%; border-collapse: collapse; background: rgba(255,255,255,0.02); }
.admin-table th {
    background: rgba(255,255,255,0.04); color: rgba(230,237,243,0.4);
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
    padding: 12px 14px; text-align: left; font-weight: 600;
}
.admin-table td { padding: 12px 14px; border-top: 1px solid rgba(230,237,243,0.05); vertical-align: middle; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
.admin-table tr.row-suspect td { background: rgba(231,76,60,0.04); }
.admin-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.admin-badge {
    font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-admin    { background: rgba(243,156,18,0.15); color: #F39C12; border: 1px solid rgba(243,156,18,0.3); }
.badge-subscribed { background: rgba(46,204,113,0.12); color: #2ECC71; border: 1px solid rgba(46,204,113,0.25); }
.badge-trial    { background: rgba(52,152,219,0.12); color: #3498DB; border: 1px solid rgba(52,152,219,0.25); }
.badge-expired  { background: rgba(231,76,60,0.12); color: #E74C3C; border: 1px solid rgba(231,76,60,0.25); }

/* SAIU overlay */
.saiu-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.82);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}
.saiu-card {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; padding: 32px 24px;
}
.saiu-title {
    font-size: 52px; font-weight: 900; color: #e6edf3;
    letter-spacing: 4px; line-height: 1;
    margin-bottom: 12px;
}
.saiu-msg {
    font-size: 15px; color: rgba(230,237,243,0.55);
    max-width: 260px; line-height: 1.5;
}

/* Game result overlay */
.result-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.result-card {
    background: rgba(22,27,34,0.92);
    border-radius: 20px; padding: 28px 24px;
    border: 1px solid rgba(230,237,243,0.12);
    text-align: center;
    max-width: 340px; width: 90%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.result-label {
    font-size: 40px; font-weight: 900; letter-spacing: 2px;
}
.result-won {
    color: #F1C40F;
    text-shadow: 0 0 30px rgba(241,196,15,0.5);
}
.result-capote-win {
    color: #F39C12;
    text-shadow: 0 0 30px rgba(243,156,18,0.5);
}
.result-lost {
    color: #E74C3C;
}
.result-solfa {
    color: #3498DB;
    text-shadow: 0 0 20px rgba(52,152,219,0.4);
}
.result-solfao {
    color: #9B59B6;
    text-shadow: 0 0 20px rgba(155,89,182,0.4);
}
.result-label-sub {
    font-size: 16px; color: rgba(230,237,243,0.6); margin-top: 6px; font-weight: 600;
}
.result-scores { display: flex; gap: 32px; justify-content: center; margin: 16px 0 12px; }
.score-block { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.score-big { font-size: 28px; font-weight: 700; }
.score-tiny { font-size: 11px; color: rgba(230,237,243,0.4); }
.elo-change {
    font-size: 20px; font-weight: 700; margin: 8px 0 12px;
    border-radius: 10px; padding: 4px 16px; display: inline-block;
}
.elo-positive { color: #2ECC71; background: rgba(46,204,113,0.1); }
.elo-negative { color: #E74C3C; background: rgba(231,76,60,0.1); }
.result-buttons {
    display: flex; flex-direction: column; gap: 8px;
    align-items: stretch; margin-top: 12px;
}

/* Eaten cards horizontal strip (game over card) */
.eaten-strip-label {
    font-size: 10px; font-weight: 600; letter-spacing: 0.8px;
    color: rgba(230,237,243,0.35); text-transform: uppercase;
    text-align: left; margin-bottom: 6px;
}
.eaten-strip-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(192,57,43,0.4) transparent;
    border: 2px solid rgba(192,57,43,0.65);
    border-radius: 12px;
    background: rgba(0,0,0,0.25);
    padding: 8px 10px;
    margin-bottom: 12px;
}
.eaten-strip-wrap::-webkit-scrollbar { height: 3px; }
.eaten-strip-wrap::-webkit-scrollbar-thumb { background: rgba(192,57,43,0.5); border-radius: 2px; }
.eaten-strip {
    display: flex;
    flex-direction: row;
    width: max-content;
}
.eaten-strip-card {
    width: 50px; height: 70px;
    border-radius: 5px;
    flex-shrink: 0;
    margin-left: -22px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.12);
    object-fit: contain;
    background: white;
}
.eaten-strip-card:first-child { margin-left: 0; }

/* Mode select card (Home modal) */
.mode-select-card {
    background: rgba(255,255,255,0.04); border-radius: 16px;
    padding: 20px 12px; border: 1px solid rgba(46,204,113,0.2);
    display: flex; flex-direction: column; align-items: center;
    cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.mode-select-card:hover { background: rgba(46,204,113,0.08); border-color: rgba(46,204,113,0.4); }
.mode-select-card:active { transform: scale(0.96); }

/* Auth pages */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: #0d1117; padding: 24px;
}
.auth-card {
    background: #161b22; border-radius: 20px; padding: 32px;
    width: 100%; max-width: 380px;
    border: 1px solid rgba(230,237,243,0.08);
}

/* ===== GAME LAYOUT V2 ===== */
.game-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: radial-gradient(ellipse at center, #0a1f0f 0%, #0d1117 100%);
    padding: 4px 8px;
    gap: 8px;
    overflow: hidden;
}

/* Turn timer — top-left of game body, per diagram */
.turn-timer-wrap {
    position: absolute;
    left: 6px;
    top: 8px;
    width: 52px;
    height: 52px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.timer-svg {
    position: absolute;
    inset: 0;
    width: 52px;
    height: 52px;
}
.timer-number {
    font-size: 13px;
    font-weight: 700;
    color: rgba(230,237,243,0.85);
    position: relative;
    z-index: 2;
}

/* Opponent zone — portrait card + card fan above oval */
.opp-zone-top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
    z-index: 2;
}
.opp-back-fan {
    position: relative;
    width: 88px;
    height: 54px;
    flex-shrink: 0;
}
.opp-fan-card {
    position: absolute;
    width: 32px;
    height: 48px;
    border-radius: 5px;
    object-fit: contain;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.5);
    transform-origin: bottom center;
    left: 50%;
    margin-left: -16px;
}
.opp-portrait-card {
    width: 72px;
    background: rgba(13,17,23,0.9);
    border-radius: 12px;
    padding: 8px 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(230,237,243,0.08);
    box-shadow: 0 4px 14px rgba(0,0,0,0.5);
    transition: border-color 0.25s, box-shadow 0.25s;
    flex-shrink: 0;
}
.opp-portrait-card.opp-active {
    border-color: rgba(46,204,113,0.6);
    box-shadow: 0 0 0 2px rgba(46,204,113,0.3), 0 4px 14px rgba(0,0,0,0.5);
    animation: opp-turn-pulse 1.5s ease-in-out infinite;
}
@keyframes opp-turn-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(46,204,113,0.25), 0 4px 14px rgba(0,0,0,0.5); }
    50%       { box-shadow: 0 0 0 3px rgba(46,204,113,0.5),  0 4px 18px rgba(0,0,0,0.6); }
}
.opp-portrait-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.opp-portrait-initials {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}
.opp-portrait-name {
    font-size: 9px;
    font-weight: 600;
    color: rgba(230,237,243,0.5);
    text-align: center;
    max-width: 56px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== PLAYED CARD SLOTS — absolute inside rect-table ===== */
.played-slot {
    position: absolute;
    width: 52px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Opponent slot — upper center */
.played-slot-opp {
    top: 18%;
    left: calc(50% - 26px);
}
/* My slot — lower center */
.played-slot-me {
    top: 62%;
    left: calc(50% - 26px);
}

/* ===== DECK ZONE — dead center of table ===== */
.deck-zone-center {
    position: absolute;
    top: calc(50% - 44px);
    left: calc(50% - 40px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 3;
}

/* Face-up trump card shown on deck top */
.deck-trump-top {
    border: 2px solid rgba(243,156,18,0.7) !important;
    box-shadow: 0 0 10px rgba(243,156,18,0.35) !important;
}

/* Card hidden during lerp animation */
.card-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Swap button positioned near deck top */
.swap-deck-top-btn {
    z-index: 16;
}

/* Table center v2 — legacy, keep for compatibility */
.table-center-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    width: 100%;
    padding: 4px 0;
}

/* Trick zone — vertical card stack (legacy) */
.trick-zone-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-height: 36px;
}
.playing-card.trick-card {
    cursor: default;
    pointer-events: none;
}
.trick-zone-v2 > .playing-card + .playing-card {
    margin-top: -50px;
    transform: rotate(4deg);
}

/* Deck zone v2 */
.deck-zone-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.deck-stack-v2 {
    position: relative;
    width: 52px;
    height: 72px;
}
.deck-back-v2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 52px;
    height: 76px;
    border-radius: 6px;
    object-fit: contain;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.4);
    display: block;
}
.playing-card.deck-top-card {
    position: absolute;
    top: 0;
    left: 0;
    cursor: default;
}
.playing-card.deck-top-card:hover { transform: none; box-shadow: none; }
.playing-card.deck-top-card.deck-swappable {
    border-color: rgba(243,156,18,0.7);
    box-shadow: 0 0 12px rgba(243,156,18,0.35);
}
.swap-circle-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #F39C12;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: 15;
    transition: transform 0.15s, background 0.15s;
}
.swap-circle-btn:hover { background: #e67e22; transform: scale(1.15); }
.swap-circle-btn:active { transform: scale(0.9); }
.deck-count-lbl {
    font-size: 10px;
    font-weight: 600;
    color: rgba(230,237,243,0.4);
    text-align: center;
}

/* Eaten card corners — absolute inside rect-table */
.eaten-corner {
    position: absolute;
    width: 46px;
    height: 50px;
}
/* Opponent pile: top-LEFT — Mine pile: bottom-RIGHT */
.eaten-opp  { top: 8px;    left: 8px;  }
.eaten-mine { bottom: 8px; right: 8px; }
.eaten-mini-card {
    position: absolute;
    width: 26px;
    height: 38px;
    border-radius: 4px;
    background: url('/cards/back-blue.png') center/contain no-repeat;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}
.eaten-count-badge {
    position: absolute;
    bottom: 0;
    right: -6px;
    background: #E74C3C;
    color: white;
    font-size: 8px;
    font-weight: 700;
    border-radius: 6px;
    padding: 1px 4px;
    z-index: 10;
    white-space: nowrap;
}

/* Hand cards — pointer-events blocked by default, only active when hand-playable */
.playing-card {
    pointer-events: none;
    cursor: default;
}
.playing-card.hand-playable {
    pointer-events: auto;
    cursor: pointer;
    border-color: #2ECC71;
    animation: card-turn-pulse 1.5s ease-in-out infinite;
}
@keyframes card-turn-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
    50% { box-shadow: 0 0 10px 3px rgba(46,204,113,0.35); }
}

/* Deal card fly-in — Lerp from center deck outward to hand (no modal/overlay) */
@keyframes deal-card-arrive {
    0%   { opacity: 0; transform: translateY(-210px) scale(0.3)  rotate(-12deg); }
    55%  { opacity: 1; transform: translateY(7px)   scale(1.06) rotate(1.5deg); }
    100% { opacity: 1; transform: translateY(0)     scale(1)    rotate(0deg);   }
}
.dealing-card-arrive {
    animation: deal-card-arrive 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Card played to center — Lerp with bouncy cubic-bezier (from bisca-saotome reference) */
.trick-from-opp {
    animation: trick-enter-opp 0.48s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.trick-from-me {
    animation: trick-enter-me 0.48s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes trick-enter-opp {
    from { opacity: 0; transform: translateY(-64px) scale(0.55) rotate(-10deg); }
    to   { opacity: 1; transform: translateY(0)     scale(1)    rotate(0deg);   }
}
@keyframes trick-enter-me {
    from { opacity: 0; transform: translateY(64px)  scale(0.55) rotate(10deg);  }
    to   { opacity: 1; transform: translateY(0)     scale(1)    rotate(0deg);   }
}

/* Chat backdrop */
.chat-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 49;
}

/* ===== NEW OPPONENT PORTRAIT — square card (no card fan) ===== */
.opp-portrait-sq {
    background: rgba(13,17,23,0.92);
    border-radius: 14px;
    padding: 8px 12px 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    border: 2px solid rgba(230,237,243,0.08);
    box-shadow: 0 4px 14px rgba(0,0,0,0.5);
    transition: border-color 0.25s, box-shadow 0.25s;
    min-width: 72px;
    position: relative;
}
.opp-portrait-sq.opp-sq-active {
    border-color: rgba(46,204,113,0.65);
    animation: opp-sq-pulse 1.4s ease-in-out infinite;
}
@keyframes opp-sq-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(46,204,113,0.2), 0 4px 14px rgba(0,0,0,0.5); }
    50%       { box-shadow: 0 0 0 4px rgba(46,204,113,0.45), 0 4px 18px rgba(0,0,0,0.6); }
}
.opp-avatar-sq {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.opp-avatar-img-sq {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.opp-initials-sq {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 700;
}
.opp-name-lbl {
    font-size: 10px;
    font-weight: 600;
    color: rgba(230,237,243,0.75);
    text-align: center;
    max-width: 66px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.opp-cardcount-badge {
    font-size: 9px;
    font-weight: 700;
    color: rgba(230,237,243,0.4);
    background: rgba(255,255,255,0.07);
    border-radius: 6px;
    padding: 1px 7px;
    letter-spacing: 0.3px;
}

/* ===== DECK + BOLÓ (horizontal trump card) ===== */
.deck-and-bolo {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
}
/* Container for trump card rotated 90° — sized to account for the rotation */
.bolo-wrap {
    width: 76px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-left: -5px;
}
/* The trump card itself, rotated to appear horizontal (landscape) */
.bolo-card {
    width: 52px !important;
    height: 76px !important;
    border: 2px solid rgba(243,156,18,0.4) !important;
    transform: rotate(90deg);
    transform-origin: center center;
    pointer-events: none;
}
.bolo-wrap.bolo-swappable .bolo-card {
    border-color: rgba(243,156,18,0.9) !important;
    box-shadow: 0 0 14px rgba(243,156,18,0.5) !important;
}
/* Pulsing swap button above the boló */
.swap-bolo-btn {
    position: absolute;
    top: -11px;
    right: -4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #F39C12;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: 15;
    animation: swap-pulse 1.1s ease-in-out infinite;
    padding: 0;
}
.swap-bolo-btn:active { transform: scale(0.88); }
@keyframes swap-pulse {
    0%, 100% { box-shadow: 0 0 0 0   rgba(243,156,18,0);    }
    50%       { box-shadow: 0 0 0 6px rgba(243,156,18,0.38); }
}

/* Boló shake — plays once when boló is detected */
@keyframes bolo-shake {
    0%   { transform: translateX(0);    }
    20%  { transform: translateX(-6px); }
    40%  { transform: translateX(6px);  }
    60%  { transform: translateX(-4px); }
    80%  { transform: translateX(4px);  }
    100% { transform: translateX(0);    }
}
.deck-back-v2.bolo-shaking {
    animation: bolo-shake 5s ease-in-out;
}

/* Deck flips face-up after initial distribution */
@keyframes deck-face-reveal {
    0%   { opacity: 0; transform: scaleX(0.2); }
    100% { opacity: 1; transform: scaleX(1); }
}
.deck-trump-top.deck-flipping {
    animation: deck-face-reveal 0.4s ease forwards;
}

/* Seven-swapped: the 7 left on the deck after a swap sits horizontally */
.deck-back-v2.seven-swapped {
    transform: rotate(90deg);
    transform-origin: center center;
}

/* VS countdown number — scale on each new number */
.vs-countdown-number {
    font-size: 88px; font-weight: 900; color: #F1C40F;
    text-shadow: 0 0 40px rgba(241,196,15,0.6);
    line-height: 1;
    animation: count-scale 0.85s ease-out;
}
@keyframes count-scale {
    0%   { transform: scale(2.2); opacity: 0; }
    40%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1);   opacity: 1; }
}

/* Trump declared flash banner */
.trump-declared-banner {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(243,156,18,0.12);
    border: 1px solid rgba(243,156,18,0.4);
    border-radius: 12px;
    padding: 7px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #F39C12;
    z-index: 30;
    animation: trump-appear 0.3s ease-out;
    box-shadow: 0 4px 20px rgba(243,156,18,0.2);
    white-space: nowrap;
    backdrop-filter: blur(4px);
}
@keyframes trump-appear {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}
