/* ============================================================
   XO — Neon Dark CSS (Mobile-First)
   ============================================================ */

:root {
    --bg:           #0a0a1a;
    --card-bg:      rgba(255, 255, 255, 0.05);
    --border:       rgba(255, 255, 255, 0.1);
    --cyan:         #00f3ff;
    --fuchsia:      #ff00e0;
    --emerald:      #00f3aa;
    --white:        #ffffff;
    --font:         'Outfit', 'Readex Pro', sans-serif;

    --glow-c: 0 0 6px #00f3ff, 0 0 18px #00f3ff, 0 0 40px rgba(0,243,255,0.6);
    --glow-f: 0 0 6px #ff00e0, 0 0 18px #ff00e0, 0 0 40px rgba(255,0,224,0.6);
    --glow-emerald: 0 0 6px #00f3aa, 0 0 18px #00f3aa, 0 0 40px rgba(0,243,170,0.6);

    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' style='font-size: 18px;'><text y='18'>🦁</text></svg>"), auto;
}

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse at 15% 20%, rgba(88, 28, 220, 0.13) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 80%, rgba(0, 200, 255, 0.09) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 0, 200, 0.04) 0%, transparent 70%),
        linear-gradient(135deg, #0d0d2b 0%, #0a0a1a 40%, #12071e 100%);
    color: var(--white);
    font-family: var(--font);
    touch-action: manipulation;
    position: relative;
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' style='font-size: 18px;'><text y='18'>🦁</text></svg>"), auto;
}

button, a, .cell, .avatar-opt, .nav-btn, .auth-top-btn {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' style='font-size: 18px;'><text y='18'>🦁</text></svg>"), pointer !important;
}

/* ── Floating ambient orbs (subtle) ── */
body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(100px);
    animation: orb-drift 14s ease-in-out infinite alternate;
}
body::before {
    width: 360px; height: 360px;
    top: -100px; left: -100px;
    background: radial-gradient(circle, rgba(100, 0, 255, 0.1) 0%, transparent 70%);
}
body::after {
    width: 300px; height: 300px;
    bottom: -80px; right: -80px;
    background: radial-gradient(circle, rgba(0, 200, 255, 0.08) 0%, transparent 70%);
    animation-delay: -7s;
    animation-name: orb-drift-2;
}

@keyframes orb-drift {
    0%   { transform: translate(0, 0) scale(1); opacity: 0.5; }
    50%  { transform: translate(35px, 50px) scale(1.1); opacity: 0.75; }
    100% { transform: translate(18px, 25px) scale(0.95); opacity: 0.6; }
}
@keyframes orb-drift-2 {
    0%   { transform: translate(0, 0) scale(1); opacity: 0.4; }
    50%  { transform: translate(-40px, -35px) scale(1.08); opacity: 0.65; }
    100% { transform: translate(-20px, -18px) scale(1.03); opacity: 0.5; }
}

body > * { position: relative; z-index: 1; }

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    transition: opacity 0.4s cubic-bezier(0.4,0,0.2,1),
                transform 0.4s cubic-bezier(0.4,0,0.2,1);
    overflow-y: auto;
    z-index: 1;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95) translateY(12px);
}

/* ============================================================
   HOME SCREEN
   ============================================================ */
.home-container {
    width: 100%; max-width: 420px;
    padding: clamp(1.2rem, 5vh, 2.5rem) 1.4rem;
    display: flex; flex-direction: column;
    gap: 1.4rem; align-items: center;
}

/* Logo */
.logo-area { text-align: center; }

.logo-letters {
    display: flex; justify-content: center;
    gap: 0.5rem;
    font-size: clamp(4rem, 18vw, 5.5rem);
    font-weight: 900; line-height: 1;
    margin-bottom: 0.2rem;
}

.logo-x {
    color: var(--cyan); text-shadow: var(--glow-c);
    animation: pulse-x 2.5s ease-in-out infinite;
}
.logo-o {
    color: var(--fuchsia); text-shadow: var(--glow-f);
    animation: pulse-o 2.5s ease-in-out infinite 1.25s;
}

@keyframes pulse-x {
    0%,100% { text-shadow: 0 0 6px #00f3ff, 0 0 16px rgba(0,243,255,0.5); transform: scale(1); }
    50%      { text-shadow: 0 0 10px #00f3ff, 0 0 28px rgba(0,243,255,0.4); transform: scale(1.04); }
}
@keyframes pulse-o {
    0%,100% { text-shadow: 0 0 6px #ff00e0, 0 0 16px rgba(255,0,224,0.5); transform: scale(1); }
    50%      { text-shadow: 0 0 10px #ff00e0, 0 0 28px rgba(255,0,224,0.4); transform: scale(1.04); }
}

/* LEO brand label */
.logo-brand {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.55), rgba(255,255,255,0.85), rgba(255,255,255,0.55));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 0.1rem;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    direction: ltr;
    animation: leo-shine 3.5s linear infinite;
}
@keyframes leo-shine {
    0%   { background-position: 100% center; }
    100% { background-position: -100% center; }
}

/* Logo entrance */
.logo-area {
    text-align: center;
    animation: logo-enter 0.7s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes logo-enter {
    from { opacity: 0; transform: translateY(-30px) scale(0.85); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Buttons stagger */
.home-btn:nth-child(1) { animation: btn-enter 0.5s 0.15s cubic-bezier(0.34,1.3,0.64,1) both; }
.home-btn:nth-child(2) { animation: btn-enter 0.5s 0.25s cubic-bezier(0.34,1.3,0.64,1) both; }
.home-btn:nth-child(3) { animation: btn-enter 0.5s 0.35s cubic-bezier(0.34,1.3,0.64,1) both; }
.diff-option-btn:nth-child(1) { animation: btn-enter 0.45s 0.05s cubic-bezier(0.34,1.3,0.64,1) both; }
.diff-option-btn:nth-child(2) { animation: btn-enter 0.45s 0.12s cubic-bezier(0.34,1.3,0.64,1) both; }
.diff-option-btn:nth-child(3) { animation: btn-enter 0.45s 0.19s cubic-bezier(0.34,1.3,0.64,1) both; }
.diff-option-btn:nth-child(4) { animation: btn-enter 0.45s 0.26s cubic-bezier(0.34,1.3,0.64,1) both; }
@keyframes btn-enter {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

.logo-title {
    font-size: 2.2rem; font-weight: 800;
    letter-spacing: 8px;
    background: linear-gradient(90deg, var(--cyan), #a855f7, var(--fuchsia));
    background-size: 200% auto;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: title-shine 4s linear infinite;
}
@keyframes title-shine {
    0%   { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.logo-sub {
    margin-top: 0.3rem; font-size: 0.9rem;
    font-weight: 400; color: rgba(255,255,255,0.38);
    letter-spacing: 1.5px;
    animation: fade-up 0.6s 0.4s ease both;
}
@keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   HOME BUTTONS
   ============================================================ */
.home-buttons { display: flex; flex-direction: column; gap: 0.85rem; width: 100%; }

.home-btn {
    display: flex; align-items: center; gap: 1.1rem;
    padding: clamp(1rem, 3.5vw, 1.3rem) 1.3rem;
    border-radius: var(--radius-lg);
    border: 1.5px solid rgba(255,255,255,0.13);
    background: rgba(255,255,255,0.055);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    color: var(--white); font-family: var(--font);
    cursor: pointer; text-align: right; width: 100%;
    transition: transform 0.2s cubic-bezier(0.4,0,0.2,1),
                box-shadow 0.2s ease,
                background 0.2s ease,
                border-color 0.2s ease;
    position: relative; overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.08);
    -webkit-tap-highlight-color: transparent;
}
.home-btn::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, transparent 55%);
    opacity: 0; transition: opacity 0.2s ease;
    border-radius: inherit;
}
.home-btn:hover::before { opacity: 1; }

/* Primary — اللعب مع صديق */
.primary-btn {
    border-color: rgba(0,243,255,0.45);
    background: rgba(0,243,255,0.07);
    box-shadow: 0 4px 28px rgba(0,0,0,0.3),
                inset 0 1px 0 rgba(0,243,255,0.15),
                0 0 0 0 rgba(0,243,255,0);
}
.primary-btn:hover {
    border-color: rgba(0,243,255,0.75);
    background: rgba(0,243,255,0.1);
    box-shadow: 0 6px 32px rgba(0,0,0,0.3), 0 0 18px rgba(0,243,255,0.18);
    transform: translateY(-2px);
}
.primary-btn:active {
    background: rgba(0,243,255,0.13);
    transform: scale(0.97);
}

/* Friend — اللعب ضد الروبوت */
.friend-btn {
    border-color: rgba(168,85,247,0.4);
    background: rgba(168,85,247,0.07);
    box-shadow: 0 4px 28px rgba(0,0,0,0.3),
                inset 0 1px 0 rgba(168,85,247,0.12);
}
.friend-btn:hover {
    border-color: rgba(168,85,247,0.7);
    background: rgba(168,85,247,0.1);
    box-shadow: 0 6px 32px rgba(0,0,0,0.3), 0 0 18px rgba(168,85,247,0.18);
    transform: translateY(-2px);
}
.friend-btn:active {
    background: rgba(168,85,247,0.13);
    transform: scale(0.97);
}

.secondary-btn {
    border-color: rgba(255,0,224,0.3);
    background: rgba(255,0,224,0.04);
    opacity: 0.45; cursor: not-allowed;
}

.btn-icon { font-size: 2.2rem; flex-shrink: 0; }
.btn-text { display: flex; flex-direction: column; gap: 0.2rem; }
.btn-title { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.2px; }
.btn-desc { font-size: 0.82rem; font-weight: 400; color: rgba(255,255,255,0.5); }
.btn-soon { color: var(--fuchsia) !important; text-shadow: 0 0 8px var(--fuchsia); }

/* Home Screen Warning */
.login-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 171, 0, 0.1);
    border: 1px solid rgba(255, 171, 0, 0.3);
    color: #ffab00;
    padding: 0.6rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-top: 0.8rem;
    animation: fadeInWarning 0.5s ease;
}

.warning-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

@keyframes fadeInWarning {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   DIFFICULTY SCREEN
   ============================================================ */
.difficulty-options { display: flex; flex-direction: column; gap: 0.85rem; width: 100%; }

.diff-option-btn {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem 1.2rem;
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.04);
    border: 1.5px solid var(--border);
    color: var(--white); font-family: var(--font);
    cursor: pointer; text-align: right; width: 100%;
    transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    position: relative;
}

.lock-icon {
    position: absolute;
    left: 1.2rem;
    top: 0.8rem;
    font-size: 1.1rem;
    opacity: 0.8;
    display: none; /* Hidden by default */
}

.diff-option-btn.is-locked {
    opacity: 0.6;
    filter: grayscale(0.5);
    cursor: not-allowed;
}

.diff-option-btn.is-locked .lock-icon {
    display: block;
}

.diff-option-btn.is-locked:hover {
    transform: none;
    border-color: var(--border);
    background: rgba(255,255,255,0.04);
    box-shadow: none;
}
.diff-option-btn .opt-icon { font-size: 1.8rem; flex-shrink: 0; }
.opt-info { display: flex; flex-direction: column; gap: 0.15rem; }
.opt-name { font-size: 1.1rem; font-weight: 700; }
.opt-desc { font-size: 0.78rem; font-weight: 300; color: rgba(255,255,255,0.4); }

.diff-option-btn:hover {
    transform: translateX(-4px);
    border-color: rgba(0,243,255,0.4);
    background: rgba(0,243,255,0.05);
    box-shadow: 0 0 16px rgba(0,243,255,0.1);
}
.diff-option-btn:active {
    transform: scale(0.97);
    border-color: var(--cyan);
    background: rgba(0,243,255,0.09);
    box-shadow: 0 0 20px rgba(0,243,255,0.2);
}

/* ============================================================
   PLAYER NAME SCREEN
   ============================================================ */
.names-form { display: flex; flex-direction: column; gap: 1.2rem; width: 100%; }

.name-input-group { display: flex; flex-direction: column; gap: 0.5rem; }

.name-label {
    display: flex; align-items: center; gap: 0.7rem;
    font-size: 0.9rem; font-weight: 600;
    color: rgba(255,255,255,0.6);
}

.name-sym {
    font-size: 1.4rem; font-weight: 900;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
}
.x-sym {
    color: var(--cyan); text-shadow: var(--glow-c);
    background: rgba(0,243,255,0.08);
    border: 1px solid rgba(0,243,255,0.3);
}
.o-sym {
    color: var(--fuchsia); text-shadow: var(--glow-f);
    background: rgba(255,0,224,0.08);
    border: 1px solid rgba(255,0,224,0.3);
}

.name-input {
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-md);
    color: var(--white); font-family: var(--font);
    font-size: 1.1rem; font-weight: 600;
    padding: 0.9rem 1rem;
    outline: none; width: 100%;
    text-align: right;
    transition: border-color 0.2s, box-shadow 0.2s;
    user-select: text;
}
.name-input::placeholder { color: rgba(255,255,255,0.25); font-weight: 300; }
.name-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0,243,255,0.12);
}

/* ============================================================
   GAME SCREEN
   ============================================================ */
.app-container {
    width: 100%; max-width: 480px; height: 100%;
    display: flex; flex-direction: column;
    padding: 1.2rem 1rem 1.2rem;
}

.top-bar {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.game-title {
    font-size: 1.5rem; font-weight: 900; letter-spacing: 4px;
    background: linear-gradient(90deg, var(--cyan), var(--fuchsia));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--white); font-size: 1.4rem;
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease; backdrop-filter: blur(8px);
}
.icon-btn:active { background: rgba(255,255,255,0.12); transform: scale(0.9); }

/* Status Panel */
.status-panel {
    display: flex; justify-content: space-between;
    align-items: center; gap: 0.6rem;
    margin-bottom: 1rem;
}

.player-card {
    flex: 1; display: flex; align-items: center; gap: 0.6rem;
    padding: 0.7rem 0.8rem;
    border-radius: var(--radius-md);
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    min-width: 0;
}

.player-x.active {
    border-color: var(--cyan);
    box-shadow: inset 0 0 12px rgba(0,243,255,0.12), 0 0 15px rgba(0,243,255,0.2);
}
.player-o.active {
    border-color: var(--fuchsia);
    box-shadow: inset 0 0 12px rgba(255,0,224,0.12), 0 0 15px rgba(255,0,224,0.2);
}

.player-sym { font-size: 1.5rem; font-weight: 900; line-height: 1; flex-shrink: 0; }
.player-x .player-sym { color: var(--cyan); text-shadow: var(--glow-c); }
.player-o .player-sym { color: var(--fuchsia); text-shadow: var(--glow-f); }

.player-details { display: flex; flex-direction: column; min-width: 0; }
.player-details.align-left { align-items: flex-end; }

.player-name {
    font-size: 0.78rem; font-weight: 600;
    color: rgba(255,255,255,0.7);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 80px;
}
.player-score { font-size: 1.4rem; font-weight: 800; }

.turn-indicator {
    font-size: 0.75rem; font-weight: 600;
    color: rgba(255,255,255,0.4);
    text-align: center; letter-spacing: 1px;
    min-width: 40px; flex-shrink: 0;
}

/* ============================================================
   GAME BOARD
   ============================================================ */
main {
    flex: 1; display: flex;
    justify-content: center; align-items: center;
    padding: 0.3rem 0;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px; width: 100%;
    aspect-ratio: 1/1; max-width: 340px;
    position: relative;
    animation: board-enter 0.5s cubic-bezier(0.34,1.3,0.64,1) both;
}
@keyframes board-enter {
    from { opacity: 0; transform: scale(0.88); }
    to   { opacity: 1; transform: scale(1); }
}

.game-board.locked {
    pointer-events: none;
    cursor: not-allowed;
    filter: brightness(0.9);
}

.cell {
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid rgba(255,255,255,0.09);
    border-radius: var(--radius-md);
    display: flex; justify-content: center; align-items: center;
    font-size: clamp(2.5rem, 10vw, 3.5rem);
    font-weight: 900; cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
    position: relative; overflow: hidden;
}
.cell:empty:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.2);
    transform: scale(1.04);
}
.cell:active { transform: scale(0.92); }

.cell.x {
    color: var(--cyan); text-shadow: var(--glow-c);
    border-color: rgba(0,243,255,0.4);
    box-shadow: inset 0 0 18px rgba(0,243,255,0.12), 0 0 10px rgba(0,243,255,0.1);
    animation: pop-in 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.cell.o {
    color: var(--fuchsia); text-shadow: var(--glow-f);
    border-color: rgba(255,0,224,0.4);
    box-shadow: inset 0 0 18px rgba(255,0,224,0.12), 0 0 10px rgba(255,0,224,0.1);
    animation: pop-in 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes pop-in {
    0%   { transform: scale(0.3) rotate(-15deg); opacity: 0; }
    70%  { transform: scale(1.1) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Winning Line */
.winning-line {
    position: absolute; height: 6px;
    border-radius: 10px; display: none; z-index: 10;
    transform-origin: left center;
}
.winning-line.active {
    display: block;
    animation: line-appear 0.5s cubic-bezier(0.34,1.3,0.64,1) both,
               pulse-line 1.6s 0.5s ease-in-out infinite;
}
@keyframes line-appear {
    from { transform: translateY(-50%) rotate(var(--angle, 0deg)) scaleX(0); opacity: 0; }
    to   { transform: translateY(-50%) rotate(var(--angle, 0deg)) scaleX(1); opacity: 1; }
}
@keyframes pulse-line {
    0%,100% { opacity: 0.75; filter: brightness(1); }
    50%      { opacity: 1;    filter: brightness(1.6) blur(0.5px); }
}

/* ============================================================
   FOOTER BADGE
   ============================================================ */
footer { padding-top: 0.6rem; display: flex; justify-content: center; }

.game-mode-badge {
    padding: 0.45rem 1.2rem;
    border-radius: 50px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    font-size: 0.8rem; font-weight: 600;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.5px;
}

/* ============================================================
   OVERLAYS & MODALS
   ============================================================ */
.overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(10px);
    display: none; justify-content: center; align-items: center;
    z-index: 200; padding: 1.5rem;
}
.overlay.active { display: flex; }

.modal {
    width: 100%; max-width: 320px;
    background: rgba(10, 8, 28, 0.96);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.8rem;
    text-align: center;
    display: flex; flex-direction: column;
    align-items: center; gap: 1rem;
    box-shadow: 0 0 80px rgba(0,0,0,0.7),
                0 0 40px rgba(88,28,220,0.12),
                inset 0 1px 0 rgba(255,255,255,0.07);
    backdrop-filter: blur(20px);
    animation: modal-pop 0.4s cubic-bezier(0.34,1.4,0.64,1) both;
}
@keyframes modal-pop {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.confirm-modal { gap: 0.8rem; }
.confirm-modal .modal-icon { font-size: 2.5rem; }
.confirm-msg {
    font-size: 0.9rem; font-weight: 300;
    color: rgba(255,255,255,0.5); line-height: 1.5;
}

.modal-icon { font-size: 3.5rem; }

.modal h2 {
    font-size: 1.8rem; font-weight: 800;
    background: linear-gradient(135deg, var(--cyan), var(--fuchsia));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    line-height: 1.3;
}

.modal-actions {
    display: flex;
    flex-direction: column !important;
    gap: 0.9rem;
    width: 100%;
    margin-top: 1rem;
}

.modal-actions button {
    width: 100% !important;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.neon-button {
    width: 100%; background: var(--cyan);
    color: #000; border: none;
    padding: 1rem; font-size: 1rem; font-weight: 800;
    border-radius: var(--radius-md); cursor: pointer;
    font-family: var(--font);
    box-shadow: 0 0 18px rgba(0,243,255,0.45);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}
.neon-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0,243,255,0.65), 0 0 45px rgba(0,243,255,0.2);
    filter: brightness(1.1);
}
.neon-button:active { transform: scale(0.96); box-shadow: 0 0 10px var(--cyan); }

/* Ultra-Luxury Shine Effect */
.neon-button::after {
    content: '';
    position: absolute;
    top: 0; left: -110%;
    width: 120%; height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0) 25%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 255, 255, 0) 75%,
        transparent
    );
    transition: none;
    animation: lux-shine 2.8s cubic-bezier(0.23, 1, 0.32, 1) infinite;
    z-index: 2;
}

@keyframes lux-shine {
    0% { left: -110%; }
    35% { left: 110%; }
    100% { left: 110%; }
}

.neon-button:hover::after {
    animation-duration: 1.5s;
}

.muted-neon-button {
    width: 100%;
    background: rgba(0, 243, 255, 0.08);
    color: var(--cyan);
    border: 1.5px solid rgba(0, 243, 255, 0.3);
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.3s ease;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.3);
}

.muted-neon-button:hover {
    background: rgba(0, 243, 255, 0.12);
    border-color: var(--cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.1);
    transform: translateY(-2px);
}

.muted-neon-button:active {
    transform: scale(0.97);
}

.danger-button {
    background: #ff3d5a;
    box-shadow: 0 0 18px rgba(255,61,90,0.45);
}
.danger-button:active { box-shadow: 0 0 6px #ff3d5a; }
.danger-button:disabled {
    background: rgba(255, 61, 90, 0.3);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.5;
}
.danger-button:not(:disabled) {
    animation: danger-pulse 1s ease-in-out infinite;
}
@keyframes danger-pulse {
    0%, 100% {
        box-shadow: 0 0 18px rgba(255,61,90,0.45);
    }
    50% {
        box-shadow: 0 0 30px rgba(255,61,90,0.8);
    }
}

.ghost-button {
    width: 100%; background: transparent;
    color: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 0.9rem; font-size: 0.95rem; font-weight: 400;
    border-radius: var(--radius-md); cursor: pointer;
    font-family: var(--font); transition: all 0.2s ease;
}
.ghost-button:active { background: rgba(255,255,255,0.07); transform: scale(0.97); }

.ghost-fuchsia {
    border-color: rgba(255,0,224,0.25);
    color: rgba(255,255,255,0.75);
    background: rgba(255,0,224,0.03);
}
.ghost-fuchsia:active {
    background: rgba(255,0,224,0.08);
    border-color: var(--fuchsia);
    box-shadow: 0 0 12px rgba(255,0,224,0.18);
}

#names-back-btn, #diff-back-btn {
    width: auto; font-size: 0.9rem;
    padding: 0.6rem 1.5rem;
    color: rgba(255,255,255,0.4);
    border-color: rgba(255,255,255,0.08);
}

/* ============================================================
   AUTH BUTTON (Home Screen floating)
   ============================================================ */
.home-auth-btn {
    position: absolute;
    top: 1.1rem; left: 1.1rem;
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    color: var(--white); font-family: var(--font);
    font-size: 0.88rem; font-weight: 600;
    cursor: pointer; backdrop-filter: blur(12px);
    transition: all 0.25s ease; z-index: 10;
    white-space: nowrap;
}
.home-auth-btn:hover {
    background: rgba(0,243,255,0.1);
    border-color: rgba(0,243,255,0.4);
    box-shadow: 0 0 14px rgba(0,243,255,0.15);
}
.home-auth-btn:active { transform: scale(0.95); }
#auth-btn-avatar { font-size: 1.1rem; line-height: 1; }

.home-auth-btn.is-logged-in {
    padding: 0.45rem 0.9rem;
    width: auto; height: auto;
    border-radius: 50px;
    justify-content: center;
    border-color: rgba(0,243,255,0.4);
    background: rgba(0, 243, 255, 0.08);
    box-shadow: 0 0 15px rgba(0,243,255,0.1);
}
.home-auth-btn.is-logged-in #auth-btn-label { 
    display: block; 
    font-size: 0.82rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-auth-btn.is-logged-in #auth-btn-avatar { font-size: 1.3rem; }

/* ============================================================
   AUTH MODAL (Redesigned)
   ============================================================ */
.auth-modal { position: relative; gap: 0.5rem; padding-top: 2.5rem; padding-bottom: 2rem; }

/* Controller Emoji Premium Effect */
.auth-modal .modal-icon {
    font-size: 4.5rem;
    margin-bottom: 0.8rem;
    filter: drop-shadow(0 0 15px rgba(0, 243, 255, 0.7)) 
            drop-shadow(0 0 35px rgba(168, 85, 247, 0.4));
    animation: auth-emoji-float 3s ease-in-out infinite;
    display: block;
}

@keyframes auth-emoji-float {
    0%, 100% { transform: translateY(0) rotate(-4deg) scale(1); }
    50% { transform: translateY(-15px) rotate(4deg) scale(1.05); }
}
.auth-close-x {
    position: absolute; top: 0.75rem; right: 0.75rem;
    background: none; border: none;
    color: rgba(255,255,255,0.35); font-size: 1.1rem;
    cursor: pointer; width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: all 0.2s;
}
.auth-close-x:hover { color: white; background: rgba(255,255,255,0.1); }

.auth-page {
    display: flex; flex-direction: column; gap: 0.8rem; width: 100%;
    animation: auth-page-enter 0.3s ease both;
}
.auth-page.hidden { display: none; }

@keyframes auth-page-enter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-page-title {
    font-size: 1.6rem; font-weight: 800; color: var(--white);
    margin-bottom: 0.2rem;
}
.auth-page-sub {
    font-size: 0.85rem; color: rgba(255,255,255,0.5);
    margin-bottom: 0.8rem;
}

.auth-field-wrap {
    display: flex; flex-direction: column; gap: 0.3rem; width: 100%; position: relative;
}
.auth-input.error {
    border-color: #ff003c;
    box-shadow: 0 0 10px rgba(255,0,60,0.3), inset 0 0 8px rgba(255,0,60,0.2);
}
.auth-input.error:focus {
    box-shadow: 0 0 15px rgba(255,0,60,0.5), inset 0 0 10px rgba(255,0,60,0.3);
}

.field-err {
    font-size: 0.75rem; color: #ff003c; text-align: right;
    min-height: 14px; margin-top: -2px; text-shadow: 0 0 5px rgba(255,0,60,0.5);
}

.password-wrap { position: relative; display: flex; width: 100%; }
.eye-btn {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: rgba(255,255,255,0.4);
    font-size: 1.1rem; cursor: pointer; padding: 0.3rem;
}
.eye-btn:hover { color: var(--white); }

.auth-msg {
    font-size: 0.85rem; text-align: center;
    padding: 0.5rem 0.8rem; border-radius: var(--radius-sm);
    min-height: 1.5rem; transition: all 0.3s; width: 100%;
    margin-top: 0.3rem;
}
.auth-msg.error {
    color: #ff5577;
    background: rgba(255,60,90,0.1);
    border: 1px solid rgba(255,60,90,0.25);
}
.auth-msg.success {
    color: #00f3aa;
    background: rgba(0,243,170,0.1);
    border: 1px solid rgba(0,243,170,0.25);
}
.auth-msg.loading { color: rgba(255,255,255,0.5); font-style: italic; }
.auth-msg.info {
    color: var(--cyan);
    background: rgba(0,243,255,0.05);
    border: 1px solid rgba(0,243,255,0.2);
}

.auth-switch-text {
    font-size: 0.85rem; color: rgba(255,255,255,0.4); margin-top: 0.5rem;
    text-align: center; width: 100%;
}
.auth-switch-link {
    background: none; border: none; color: var(--cyan);
    font-family: var(--font); font-size: 0.85rem; font-weight: 700;
    cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.auth-switch-link:hover { color: var(--white); text-shadow: var(--glow-c); }

.rules-hint-btn {
    position: absolute; 
    top: 1.2rem; 
    left: 1.2rem;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    background: rgba(0, 243, 255, 0.08); 
    border: 1px solid rgba(0, 243, 255, 0.25);
    color: var(--cyan); 
    font-size: 0.75rem;
    font-weight: 700; 
    font-family: var(--font); 
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}
.rules-hint-btn:hover { 
    background: rgba(0, 243, 255, 0.15); 
    border-color: var(--cyan); 
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    transform: translateY(-2px);
}

/* ============================================================
   RULES MODAL
   ============================================================ */
.rules-modal { gap: 1rem; align-items: flex-start; text-align: right; padding-top: 3rem; }
.rules-modal .modal-icon { font-size: 2.5rem; margin: 0 auto; }
.rules-title { font-size: 1.4rem; color: var(--cyan); margin-bottom: 0.5rem; text-align: center; width: 100%; }
.rules-list {
    list-style: none; display: flex; flex-direction: column; gap: 0.8rem;
    font-size: 0.9rem; color: rgba(255,255,255,0.8); width: 100%;
}
.rules-list li { display: flex; align-items: center; gap: 0.6rem; background: rgba(255,255,255,0.03); padding: 0.6rem; border-radius: var(--radius-sm); }
.rule-icon { font-size: 1.2rem; }
.rules-list strong { color: var(--fuchsia); font-weight: 700; }
#rules-ok-btn { margin-top: 1rem; }

/* ============================================================
   PROFILE SCREEN
   ============================================================ */
.profile-container { 
    gap: 1rem; 
    padding-top: 45rem; /* تنزيل الكل لأقصى حد ممكن */
}
.profile-hero {
    display: flex; flex-direction: column;
    align-items: center; gap: 1.5rem; /* مسافة أكبر لضمان عدم التداخل مع الأسد أو العلم */
}
.profile-avatar-big {
    font-size: 4rem; line-height: 1;
    width: 90px; height: 90px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 2px solid rgba(0,243,255,0.3);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0,243,255,0.15);
}

/* Username Edit Wrap (under avatar) */
.uname-edit-wrap {
    display: flex;
    align-items: center;
    position: relative;
    justify-content: center;
    margin-top: 0.2rem;
    direction: ltr; /* @username is usually LTR */
}
.at-symbol {
    color: rgba(255,255,255,0.45);
    font-size: 1.1rem;
    font-weight: 600;
    margin-right: 2px;
}
.profile-uname-input {
    background: transparent;
    border: none;
    border-bottom: 1.5px solid transparent;
    color: rgba(255,255,255,0.45);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font);
    letter-spacing: 1px;
    text-align: left;
    width: auto;
    max-width: 250px; /* مساحة أكبر للاسم الطويل */
    min-width: 100px;
    transition: all 0.3s ease;
    padding: 0.1rem 0.5rem;
    outline: none;
    text-overflow: ellipsis;
}
.profile-uname-input:disabled {
    opacity: 1;
}
.profile-uname-input:not(:disabled) {
    color: var(--white);
    border-bottom-color: var(--cyan);
    background: rgba(255,255,255,0.05);
    border-radius: 4px 4px 0 0;
    padding: 0.2rem 0.5rem;
    box-shadow: 0 2px 10px rgba(0,243,255,0.1);
}
.pencil-btn-uname {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: 0.5rem;
    opacity: 0.8;
    transition: all 0.2s ease;
    filter: drop-shadow(0 0 5px rgba(0,243,255,0.3));
}
.pencil-btn-uname:hover {
    opacity: 1;
    transform: scale(1.15) rotate(10deg);
}

.cancel-edit-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
    margin-left: 0.5rem;
}
.cancel-edit-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}
.cancel-edit-btn:active {
    transform: scale(0.9);
}

#profile-uname-err { 
    text-align: center; 
    margin-top: 8px; 
    font-size: 0.8rem;
    color: #ff2a55; /* Luxurious Red */
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 42, 85, 0.6), 0 0 15px rgba(255, 42, 85, 0.3);
    background: rgba(255, 42, 85, 0.1);
    border: 1px solid rgba(255, 42, 85, 0.25);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    display: inline-block;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
#profile-uname-err:not(:empty) {
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(255, 42, 85, 0.15);
}

.picker-label {
    font-size: 0.8rem; font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-align: center; letter-spacing: 0.5px;
}
.avatar-grid {
    display: grid; grid-template-columns: repeat(6, 1fr);
    gap: 8px; width: 100%;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}
/* Custom scrollbar for avatar grid */
.avatar-grid::-webkit-scrollbar { width: 4px; }
.avatar-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
.avatar-grid::-webkit-scrollbar-thumb { background: var(--cyan); border-radius: 10px; }
.avatar-opt {
    font-size: 1.6rem; line-height: 1; aspect-ratio: 1/1;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.18s ease;
}
.avatar-opt:hover {
    background: rgba(0,243,255,0.08);
    border-color: rgba(0,243,255,0.35);
    transform: scale(1.1);
}
.avatar-opt.selected {
    background: rgba(0,243,255,0.14);
    border-color: var(--cyan);
    box-shadow: 0 0 10px rgba(0,243,255,0.25);
}
.view-more-avatars-btn {
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
}
.view-more-avatars-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.2);
}
.view-more-avatars-btn:active {
    transform: scale(0.98);
}
.profile-field { display: flex; flex-direction: column; gap: 0.45rem; width: 100%; }

.country-field-wrap {
    display: flex; align-items: center; gap: 0.8rem;
    position: relative;
}
.selected-flag-view {
    width: 54px; height: 54px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    font-size: 2rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    animation: flag-pulse 3s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.1);
    border: 1px solid rgba(0, 243, 255, 0.3);
}
@keyframes flag-pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.08); filter: brightness(1.2); box-shadow: 0 0 25px rgba(0, 243, 255, 0.2); }
}
.country-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.4)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.8rem center;
    padding: 0.6rem 0.8rem;
    padding-left: 2.2rem; 
    font-size: 0.9rem;
    cursor: pointer;
    flex: 1;
}
.country-select option { background: #0f0f2a; color: white; }
.logout-ghost {
    border-color: rgba(255,60,90,0.25);
    color: rgba(255,100,120,0.8);
}
.logout-ghost:active {
    background: rgba(255,60,90,0.08);
    border-color: #ff3d5a;
}
.delete-account-btn {
    border-color: rgba(255, 0, 0, 0.4);
    color: rgba(255, 100, 100, 0.9);
    background: rgba(255, 0, 0, 0.05);
}
.delete-account-btn:hover {
    border-color: rgba(255, 0, 0, 0.7);
    background: rgba(255, 0, 0, 0.1);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
}
.delete-account-btn:active {
    background: rgba(255, 0, 0, 0.15);
    border-color: #ff0000;
}
/* Full-Page Change Password Screen */
.loading-animation-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 3rem 0;
}

.lux-spinner {
    width: 80px;
    height: 80px;
    border: 3px solid transparent;
    border-top-color: var(--cyan);
    border-radius: 50%;
    position: relative;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
}
.lux-spinner::before, .lux-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
}
.lux-spinner::before {
    inset: 5px;
    border-top-color: var(--fuchsia);
    animation: spin 2s linear infinite;
}
.lux-spinner::after {
    inset: 15px;
    border-top-color: #a855f7;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--white);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.dots-anim {
    display: inline-block;
    width: 1.5em;
    text-align: left;
    animation: dots 1.5s step-end infinite;
}

@keyframes dots {
    0%, 20%   { content: ''; }
    40%       { content: '.'; }
    60%       { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Fix for dots content animation */
.dots-anim::after {
    content: '...';
    animation: dots-text 1.5s step-end infinite;
}
@keyframes dots-text {
    0%   { content: ''; }
    33%  { content: '.'; }
    66%  { content: '..'; }
    100% { content: '...'; }
}

#cp-step-result .modal-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}
#cp-result-title {
    margin-bottom: 0.5rem;
}
/* ============================================================
   PROFILE SCREEN EXTRA STYLES
   ============================================================ */
.profile-hero {
    padding-top: 2.5rem;
    width: 100%;
    display: flex;
    justify-content: center;
}
.profile-avatar-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.profile-avatar-big {
    width: 120px;
    height: 120px;
    background: var(--card-bg);
    border: 3px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    transition: all 0.4s ease;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    width: 100%;
    margin: 1rem 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 0.8rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    backdrop-filter: blur(10px);
}

.stat-val {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--white);
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

/* Match History */
.match-history-section {
    width: 100%;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.8rem;
    padding-right: 0.5rem;
    border-right: 3px solid var(--cyan);
}

.history-table-wrap {
    width: 100%;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: right;
}

.history-table th {
    padding: 0.8rem;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.history-table td {
    padding: 0.8rem;
    color: var(--white);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.win-text { color: var(--cyan); font-weight: 700; }
.loss-text { color: #ff3d5a; font-weight: 700; }
.tie-text { color: #aaa; font-weight: 700; }

.player-avatar-mini {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

/* Premium View All History Button */
.view-all-history-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.8rem;
    background: rgba(0, 243, 255, 0.05);
    border: 1.5px solid rgba(0, 243, 255, 0.2);
    border-radius: var(--radius-md);
    color: var(--cyan);
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.view-all-history-btn:hover {
    background: rgba(0, 243, 255, 0.12);
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2), inset 0 0 10px rgba(0, 243, 255, 0.1);
    transform: translateY(-2px);
    color: #fff;
}

.view-all-history-btn:active {
    transform: scale(0.97);
}

.view-all-history-btn .btn-shine {
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: all 0.6s;
}

.view-all-history-btn:hover .btn-shine {
    left: 100%;
}

/* Full History Modal */
.history-modal {
    max-width: 380px;
    max-height: 80vh;
    padding: 2rem 1.2rem;
}

.history-list-container {
    width: 100%;
    overflow-y: auto;
    margin: 1rem 0;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 400px;
}

/* Custom Scrollbar for history list */
.history-list-container::-webkit-scrollbar {
    width: 4px;
}
.history-list-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
.history-list-container::-webkit-scrollbar-thumb {
    background: var(--cyan);
    border-radius: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.history-item::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 0;
    background: var(--cyan);
    transition: all 0.3s ease;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--cyan);
}

.history-item:hover {
    background: rgba(0, 243, 255, 0.05);
    border-color: rgba(0, 243, 255, 0.2);
    transform: translateX(-3px);
}

.history-item:hover::before {
    height: 70%;
}

.hist-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
}

.hist-opponent {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.3px;
}

.hist-date {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    font-family: var(--font);
}

.hist-right {
    text-align: right;
}

.hist-result {
    font-size: 0.9rem;
    font-weight: 800;
}

@media (max-width: 360px) {
    .stats-grid { gap: 0.5rem; }
    .stat-val { font-size: 1rem; }
}

#history-ok-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ============================================================
   WIN CARD
   ============================================================ */
.rewards-card {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
    width: 100%;
}

.rewards-card.hidden {
    display: none;
}

.reward-item {
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--cyan);
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
    animation: reward-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes reward-bounce {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.reward-icon {
    font-size: 2rem;
}

.reward-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.reward-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.reward-val {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--white);
}

/* Floating +1 Indicator */
.float-indicator {
    position: absolute;
    top: 10px;
    right: -20px;
    font-weight: 900;
    font-size: 1.2rem;
    color: #00ff00; /* Default Green */
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    z-index: 10;
}

.float-indicator.negative {
    color: #ff3d5a; /* Red for loss */
    text-shadow: 0 0 10px rgba(255, 61, 90, 0.5);
}

.reward-item.loss-mode {
    background: rgba(255, 61, 90, 0.1);
    border-color: #ff3d5a;
    box-shadow: 0 0 20px rgba(255, 61, 90, 0.2);
}

/* Guest Warning Style */
.guest-warning {
    position: relative;
    width: 100%;
    max-width: 280px;
    margin: 1rem 0;
    padding: 1rem 1.2rem;
    background: rgba(255, 165, 0, 0.08);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
    animation: warning-slide 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    border: 1px solid rgba(255, 165, 0, 0.2);
    backdrop-filter: blur(10px);
}

.guest-warning.hidden {
    display: none;
}

.warning-border {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #ffa500, #ff4500);
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.5);
}

.warning-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: right;
    width: 100%;
}

.warning-title {
    font-size: 0.9rem;
    font-weight: 900;
    color: #ffa500;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
    letter-spacing: 1px;
}

.warning-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    line-height: 1.4;
}

@keyframes warning-slide {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.float-indicator.animate {
    animation: floatUpReward 1.5s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes floatUpReward {
    0% { transform: translateY(10px) scale(0.7); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 0.8; }
    100% { transform: translateY(-40px) scale(1.3); opacity: 0; }
}

/* ── Sound Toggle Button ── */
.sound-toggle-btn.muted {
    color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 0, 224, 0.3);
    background: rgba(255, 0, 224, 0.03);
}

/* ── AI Floating Button ── */
.ai-floating-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(255, 0, 224, 0.2));
    border: 2px solid rgba(0, 243, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4), inset 0 0 10px rgba(255, 0, 224, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(5px);
}
.ai-floating-btn:hover {
    transform: scale(1.1) translateY(2px);
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.8), inset 0 0 15px rgba(255, 0, 224, 0.5);
    border-color: #00f3ff;
}
.ai-floating-btn .ai-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px #00f3ff);
    animation: floating-ai 3s ease-in-out infinite;
}

.lock-icon-mini {
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 0.75rem;
    background: #000;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    z-index: 5;
}

.ai-floating-btn.is-locked {
    filter: grayscale(1) brightness(0.6);
    opacity: 0.8;
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    box-shadow: none;
}

.ai-floating-btn.is-locked .lock-icon-mini {
    display: flex;
}

.ai-floating-btn.is-locked:hover {
    transform: none;
    box-shadow: none;
}

@keyframes floating-ai {
    0% { transform: translateY(0); }
    50% { transform: translateY(3px); }
    100% { transform: translateY(0); }
}
.ai-floating-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

/* ── Toast Notification ── */
.toast-notif {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff003c, #990024);
    color: white;
    padding: 1rem 2rem;
    border-radius: 15px;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 10px 30px rgba(255, 0, 60, 0.4), 0 0 20px rgba(255, 0, 60, 0.2);
    z-index: 9999;
    transition: top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s, box-shadow 0.3s;
    text-align: center;
    min-width: 280px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.toast-notif.success {
    background: linear-gradient(135deg, #00f3aa, #00a878);
    box-shadow: 0 10px 30px rgba(0, 243, 170, 0.4), 0 0 20px rgba(0, 243, 170, 0.2);
}

.toast-notif.show {
    top: 20px;
}


/* ============================================================
   AI CHAT SCREEN STYLES
   ============================================================ */

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(13, 13, 18, 0.95);
    border-bottom: 1px solid rgba(0, 243, 255, 0.15);
    z-index: 10;
    flex-shrink: 0;
    width: 100%;
}
.back-btn {
    background: none;
    border: none;
    color: #00f3ff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    transition: 0.2s;
}
.back-btn:active { transform: scale(0.9); }
.ai-title {
    font-family: 'Outfit', 'Readex Pro', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.ai-title span { color: #00f3ff; text-shadow: 0 0 10px rgba(0,243,255,0.4); }
.quota-badge {
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.3);
    color: #00f3ff;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    transition: all 0.3s;
}

/* Chat Area */
.chat-area {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    scroll-behavior: smooth;
    width: 100%;
}
.chat-area::-webkit-scrollbar { width: 5px; }
.chat-area::-webkit-scrollbar-thumb { background: rgba(0, 243, 255, 0.2); border-radius: 5px; }

.msg {
    padding: 1rem 1.2rem;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.7;
    word-wrap: break-word;
    animation: fadeIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.msg-user {
    max-width: 80%;
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(255, 0, 224, 0.15), rgba(255, 0, 224, 0.05));
    border: 1px solid rgba(255, 0, 224, 0.2);
    border-bottom-right-radius: 4px;
    color: #ffe0f5;
    text-align: right;
}

.msg-ai {
    max-width: 95%;
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.12), rgba(0, 243, 255, 0.03));
    border: 1px solid rgba(0, 243, 255, 0.25);
    border-bottom-left-radius: 4px;
    color: #e0ffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-family: 'Readex Pro', sans-serif;
    text-align: right;
}

.msg-ai strong {
    color: #00f3ff;
    font-weight: 700;
}
.msg-ai.premium-reply strong {
    color: #ffcc00;
}
.msg-ai .step {
    display: block;
    margin-top: 0.5rem;
    padding-right: 1rem;
    position: relative;
}
.msg-ai .step::before {
    content: "•";
    color: #ff00e0;
    position: absolute;
    right: 0;
    font-weight: bold;
}

.typing-indicator {
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.15);
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    color: #00f3ff;
    font-size: 0.9rem;
    animation: fadeIn 0.3s forwards;
}
.dot {
    width: 6px;
    height: 6px;
    background: #00f3ff;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* Prompts Menu Area */
.prompts-container {
    height: 35%;
    background: rgba(10, 10, 14, 0.98);
    border-top: 1px solid rgba(0, 243, 255, 0.2);
    display: flex;
    flex-direction: column;
    padding-top: 0.5rem;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
    position: relative;
    width: 100%;
}

.prompts-header {
    font-size: 0.85rem;
    color: #00f3ff;
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(0,243,255,0.4);
}

.prompts-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 1rem 1rem 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 243, 255, 0.3) transparent;
}
.prompts-scroll::-webkit-scrollbar { width: 5px; }
.prompts-scroll::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.prompts-scroll::-webkit-scrollbar-thumb { background: rgba(0, 243, 255, 0.3); border-radius: 5px; }

.prompts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
}
@media (min-width: 600px) {
    .prompts-grid { grid-template-columns: repeat(3, 1fr); }
}

.prompt-chip {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.7rem;
    border-radius: 16px;
    font-family: 'Readex Pro', sans-serif;
    font-size: 0.8rem;
    line-height: 1.4;
    cursor: pointer;
    transition: 0.25s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
    position: relative;
    overflow: hidden;
}
.prompt-chip:active {
    transform: scale(0.95);
    background: rgba(0, 243, 255, 0.1);
    border-color: #00f3ff;
    color: #00f3ff;
}
.prompt-chip.premium {
    border-color: rgba(255, 204, 0, 0.4);
    background: rgba(255, 204, 0, 0.05);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.1);
}
.prompt-chip.premium::before {
    content: "👑";
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.65rem;
    opacity: 0.8;
}

/* ============================================================
   AI CHAT SCREEN STYLES
   ============================================================ */

/* Lite Toggle Button */
.lite-toggle-btn.active {
    color: #ffeb3b !important;
    border-color: rgba(255, 235, 59, 0.45) !important;
    background: rgba(255, 235, 59, 0.05) !important;
    box-shadow: 0 0 12px rgba(255, 235, 59, 0.15) !important;
}

/* Global Lite Mode: disable transitions, animations, shadows, and backdrop filters for instant loading and zero lag */
body.lite-mode *,
body.lite-mode *::before,
body.lite-mode *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
}

body.lite-mode * {
    box-shadow: none !important;
    text-shadow: none !important;
    backdrop-filter: none !important;
}
