/* ==========================================================================
   NEON TACTICS - CUSTOM STYLING SHEET (VANILLA CSS)
   ========================================================================== */

:root {
    --bg-dark: #07040f;
    --bg-card: rgba(13, 9, 28, 0.65);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-focus: rgba(255, 255, 255, 0.2);
    
    /* Neon Palettes */
    --neon-blue: #00f0ff;
    --neon-blue-glow: rgba(0, 240, 255, 0.4);
    --neon-pink: #ff007f;
    --neon-pink-glow: rgba(255, 0, 127, 0.4);
    --neon-purple: #a855f7;
    --neon-purple-glow: rgba(168, 85, 247, 0.4);
    --neon-green: #39ff14;
    --neon-green-glow: rgba(57, 255, 20, 0.4);
    --neon-orange: #ff5e00;
    --neon-orange-glow: rgba(255, 94, 0, 0.4);

    --text-primary: #f3f1f7;
    --text-muted: #9f9baa;
    --font-cyber: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-cyber);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* ==========================================================================
   BACKGROUND VISUALS & ANIMATIONS
   ========================================================================== */

/* Full-Screen Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99;
}

/* Animated Ambient Glowing Orbs */
.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.25;
    pointer-events: none;
    mix-blend-mode: screen;
}

.blob-1 {
    width: 450px;
    height: 450px;
    background: var(--neon-blue);
    top: -50px;
    left: -100px;
    animation: floatBlob 20s infinite alternate ease-in-out;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--neon-pink);
    bottom: -150px;
    right: -100px;
    animation: floatBlob 25s infinite alternate-reverse ease-in-out 2s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: var(--neon-purple);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: floatBlob 18s infinite alternate ease-in-out 4s;
}

@keyframes floatBlob {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(80px, 50px) scale(1.15);
    }
    100% {
        transform: translate(-40px, -60px) scale(0.9);
    }
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */

.app-container {
    width: 100%;
    max-width: 850px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 90vh;
    justify-content: center;
    position: relative;
    z-index: 10;
}

/* HEADER STYLE */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 15px;
}

.logo {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cyber-tag {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--neon-green);
    letter-spacing: 0.25em;
    text-shadow: 0 0 5px var(--neon-green-glow);
}

.logo h1 {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.header-controls {
    display: flex;
    gap: 10px;
}

/* MAIN GLASS CARD */
.main-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 35px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 
                inset 0 0 30px rgba(255, 255, 255, 0.02);
    min-height: 480px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* SCREEN MANAGEMENT */
.screen {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
                opacity 0.4s ease;
    flex-direction: column;
    width: 100%;
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.screen-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 25px;
    color: var(--text-primary);
    border-bottom: 1px dashed var(--border-glass);
    padding-bottom: 12px;
}

.section-lead {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: -10px;
    margin-bottom: 25px;
}

/* ==========================================================================
   SCREEN 1: MAIN MENU SECTIONS
   ========================================================================== */

.hero-section {
    text-align: center;
    margin-bottom: 35px;
}

.hero-glow {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.x-accent {
    color: var(--neon-blue);
    text-shadow: 0 0 20px var(--neon-blue-glow);
}

.o-accent {
    color: var(--neon-pink);
    text-shadow: 0 0 20px var(--neon-pink-glow);
}

.divider {
    font-size: 3rem;
    color: var(--border-glass-focus);
    font-weight: 300;
}

.subtitle {
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

/* BUTTON SYSTEM */
.btn-primary {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    transition: all 0.3s ease;
}

.btn-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btn-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.btn-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.btn-arrow {
    opacity: 0.5;
    transform: translateX(-5px);
    transition: all 0.3s ease;
}

/* Colors & Glows */
.btn-primary.neon-blue::before { background: var(--neon-blue); }
.btn-primary.neon-blue:hover {
    border-color: var(--neon-blue);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.15), inset 0 0 10px rgba(0, 240, 255, 0.05);
}

.btn-primary.neon-purple::before { background: var(--neon-purple); }
.btn-primary.neon-purple:hover {
    border-color: var(--neon-purple);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.15), inset 0 0 10px rgba(168, 85, 247, 0.05);
}

.btn-primary.neon-pink::before { background: var(--neon-pink); }
.btn-primary.neon-pink:hover {
    border-color: var(--neon-pink);
    box-shadow: 0 0 20px rgba(255, 0, 127, 0.15), inset 0 0 10px rgba(255, 0, 127, 0.05);
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-primary:hover .btn-arrow {
    opacity: 1;
    transform: translateX(0);
}

.btn-accent {
    background: var(--text-primary);
    color: var(--bg-dark);
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.25);
    background: #fff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-glass-focus);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.btn-back {
    margin-top: 10px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-glass-focus);
    transform: scale(1.05);
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   SCREEN 1.5: AI DIFFICULTY SELECTOR
   ========================================================================== */

.difficulty-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 480px;
    margin: 0 auto 30px auto;
    width: 100%;
}

.diff-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 16px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
    transition: all 0.3s ease;
}

.diff-level {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
}

.diff-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.diff-btn[data-diff="easy"]:hover {
    border-color: var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.1);
}
.diff-btn[data-diff="easy"]:hover .diff-level {
    color: var(--neon-blue);
}

.diff-btn[data-diff="medium"]:hover {
    border-color: var(--neon-orange);
    box-shadow: 0 0 15px rgba(255, 94, 0, 0.1);
}
.diff-btn[data-diff="medium"]:hover .diff-level {
    color: var(--neon-orange);
}

.diff-btn[data-diff="unbeatable"]:hover {
    border-color: var(--neon-purple);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.15);
}
.diff-btn[data-diff="unbeatable"]:hover .diff-level {
    color: var(--neon-purple);
}

.screen-footer {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

/* ==========================================================================
   SCREEN 2: ONLINE LOBBY DOCKING
   ========================================================================== */

.lobby-panels {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 25px;
}

.lobby-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 250px;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.lobby-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.025);
}

.lobby-card h3 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.lobby-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.lobby-divider {
    color: var(--text-muted);
    font-weight: 800;
    font-size: 0.85rem;
    text-shadow: 0 0 5px rgba(255,255,255,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.width-100 {
    width: 100%;
}

/* Host Panel Code Display */
.hidden-panel {
    display: none;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s ease;
}

.hidden-panel.visible {
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 1;
    transform: translateY(0);
}

.panel-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.code-display-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass-focus);
    padding: 10px 15px;
    border-radius: 10px;
}

#lobby-code-val {
    font-family: monospace;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue-glow);
}

.icon-btn-inline {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
}

.icon-btn-inline:hover {
    color: #fff;
    transform: scale(1.1);
}

.status-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.pulses {
    animation: textPulse 2s infinite ease-in-out;
}

@keyframes textPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid var(--neon-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Join Panel Code Input */
.input-group {
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 6px;
    transition: border-color 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--neon-pink);
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.1);
}

#join-code-input {
    background: transparent;
    border: none;
    flex: 1;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 1rem;
    font-weight: 700;
    padding-left: 10px;
    outline: none;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#join-code-input::placeholder {
    font-family: var(--font-cyber);
    text-transform: none;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Alternative connection & manual WebRTC styling */
.alternative-connection-toggle {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
}

.link-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.3s ease;
}

.link-btn:hover {
    color: var(--neon-blue);
}

.manual-panel {
    border: 1px dashed var(--border-glass-focus);
    background: rgba(0,0,0,0.25);
    border-radius: 16px;
    padding: 20px;
    margin-top: 15px;
}

.manual-panel h3 {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    color: var(--neon-purple);
}

.manual-steps {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.manual-steps .step {
    flex: 1;
    display: flex;
    gap: 8px;
}

.step-num {
    background: var(--neon-purple);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    flex-shrink: 0;
}

.manual-steps p {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.textarea-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.textarea-container label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

textarea {
    width: 100%;
    height: 60px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 8px;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.75rem;
    resize: none;
    outline: none;
    transition: border-color 0.3s ease;
}

textarea:focus {
    border-color: var(--neon-purple);
}

.manual-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.size-small {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 8px;
}

.textarea-copy-wrapper {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.textarea-copy-wrapper textarea {
    flex: 1;
    height: 40px;
}

.textarea-copy-wrapper button {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* ==========================================================================
   SCREEN 3: GAME PLAY BOARD
   ========================================================================== */

.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 12px 24px;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
}

.player-panel {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    opacity: 0.55;
    transition: all 0.3s ease;
}

.player-panel.active {
    opacity: 1;
}

.player-panel.player-o {
    justify-content: flex-end;
    text-align: right;
}

.avatar-glow {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 900;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-glass);
    transition: all 0.3s ease;
}

.player-panel.active .avatar-glow.x-glow {
    border-color: var(--neon-blue);
    background: rgba(0, 240, 255, 0.05);
    color: var(--neon-blue);
    box-shadow: 0 0 10px var(--neon-blue-glow);
}

.player-panel.active .avatar-glow.o-glow {
    border-color: var(--neon-pink);
    background: rgba(255, 0, 127, 0.05);
    color: var(--neon-pink);
    box-shadow: 0 0 10px var(--neon-pink-glow);
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-name {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.player-panel.active .player-name {
    color: #fff;
}

.player-score {
    font-size: 1.5rem;
    font-weight: 900;
}

.vs-badge {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--text-muted);
    padding: 5px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    letter-spacing: 0.05em;
}

/* Turn status announcer */
.turn-announcer {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--neon-blue);
    margin-bottom: 20px;
    height: 18px;
    transition: all 0.3s ease;
}

/* BOARD MATRIX */
.board-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.tic-tac-toe-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 14px;
    width: 290px;
    height: 290px;
    position: relative;
}

.cell {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.01);
}

.cell:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.15);
}

/* Cell hover glow states based on current turn */
body[data-turn="X"] .cell:not(.taken):hover {
    background: rgba(0, 240, 255, 0.02);
    border-color: rgba(0, 240, 255, 0.3);
    box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.05), 
                0 0 15px rgba(0, 240, 255, 0.08);
}

body[data-turn="O"] .cell:not(.taken):hover {
    background: rgba(255, 0, 127, 0.02);
    border-color: rgba(255, 0, 127, 0.3);
    box-shadow: inset 0 0 10px rgba(255, 0, 127, 0.05), 
                0 0 15px rgba(255, 0, 127, 0.08);
}

.cell.taken {
    cursor: not-allowed;
}

/* SVG SYMBOLS */
.symbol-svg {
    width: 65%;
    height: 65%;
}

.svg-x line {
    stroke: var(--neon-blue);
    stroke-width: 8px;
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px var(--neon-blue-glow));
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawStroke 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.svg-x line:nth-child(2) {
    animation-delay: 0.12s;
}

.svg-o circle {
    stroke: var(--neon-pink);
    stroke-width: 8px;
    fill: none;
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px var(--neon-pink-glow));
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawStroke 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes drawStroke {
    to {
        stroke-dashoffset: 0;
    }
}

/* SVG Laser Winning Slash Overlay */
.win-line-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
}

.hidden-line {
    opacity: 0;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: opacity 0.1s ease;
}

.draw-line {
    opacity: 1;
    animation: drawStroke 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* Match actions styling */
.game-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* ==========================================================================
   FLOATING CHAT DRAWER
   ========================================================================== */

.chat-drawer {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5),
                inset 0 0 10px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.08) translateY(-2px);
    border-color: var(--neon-pink);
    box-shadow: 0 12px 30px rgba(255, 0, 127, 0.2);
}

.chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--neon-pink);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px var(--neon-pink-glow);
    border: 2px solid var(--bg-dark);
}

.chat-container {
    width: 320px;
    height: 380px;
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-glass-focus);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 70px;
    right: 0;
    transform: scale(0.9) translateY(15px);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-drawer.open .chat-container {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.chat-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-glass);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h4 {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--neon-pink);
    text-shadow: 0 0 8px var(--neon-pink-glow);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Scrollbar customizations */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.05);
    border-radius: 2px;
}

.chat-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.3;
    animation: msgFade 0.25s ease forwards;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.chat-msg.sent {
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.15);
    color: var(--text-primary);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-msg.received {
    background: rgba(255, 0, 127, 0.08);
    border: 1px solid rgba(255, 0, 127, 0.15);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-msg.system {
    align-self: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-align: center;
    max-width: 95%;
}

.msg-sender {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.chat-msg.sent .msg-sender { color: var(--neon-blue); }
.chat-msg.received .msg-sender { color: var(--neon-pink); }

.msg-text {
    word-break: break-word;
}

/* Chat preset rapid reply buttons */
.chat-presets {
    display: flex;
    gap: 5px;
    padding: 8px 15px;
    background: rgba(0,0,0,0.1);
    border-top: 1px solid rgba(255,255,255,0.02);
}

.preset-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
}

.preset-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-glass-focus);
}

/* Chat submission form */
.chat-form {
    display: flex;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid var(--border-glass);
    gap: 8px;
}

#chat-input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-primary);
    outline: none;
}

#chat-input:focus {
    border-color: var(--neon-pink);
}

#chat-send {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
}

/* ==========================================================================
   TOASTS AND SYSTEM NOTIFICATIONS
   ========================================================================== */

.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-50px);
    background: rgba(13, 9, 28, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-glass-focus);
    border-top: 2px solid var(--neon-blue);
    padding: 12px 28px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#toast-text {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.toast.toast-blue { border-top-color: var(--neon-blue); }
.toast.toast-pink { border-top-color: var(--neon-pink); }
.toast.toast-green { border-top-color: var(--neon-green); }
.toast.toast-orange { border-top-color: var(--neon-orange); }

/* ==========================================================================
   RESPONSIVENESS (MOBILE DEVICES)
   ========================================================================== */

@media (max-width: 768px) {
    .lobby-panels {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .lobby-divider {
        padding: 5px 0;
    }
    
    .lobby-card {
        min-height: 200px;
    }
    
    .app-container {
        padding: 10px;
        min-height: 98vh;
    }
    
    .main-card {
        padding: 20px 15px;
    }
    
    .chat-drawer {
        bottom: 20px;
        right: 20px;
    }
    
    .chat-container {
        width: 280px;
        height: 340px;
        bottom: 65px;
    }
}

@media (max-width: 480px) {
    .hero-glow {
        font-size: 3.5rem;
    }
    
    .logo h1 {
        font-size: 1.3rem;
    }
    
    .scoreboard {
        padding: 10px 15px;
    }
    
    .player-score {
        font-size: 1.2rem;
    }
    
    .tic-tac-toe-board {
        width: 250px;
        height: 250px;
        gap: 10px;
    }
    
    .game-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .game-actions button {
        width: 100%;
    }
    
    .manual-steps {
        flex-direction: column;
        gap: 8px;
    }
    
    .manual-buttons {
        flex-direction: column;
    }
}
