/* ============================================
   SNAPFREAKS - Dark Chat Game
   AAA Photo-Real Snapchat-Like UI
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --snap-yellow: #FFFC00;
    --snap-dark: #0b0b0f;
    --snap-bg: #000000;
    --snap-card: #1a1a2e;
    --snap-card-light: #222244;
    --snap-accent: #ff3b5c;
    --snap-accent2: #a855f7;
    --snap-accent3: #06d6a0;
    --snap-text: #ffffff;
    --snap-text-dim: #8888aa;
    --snap-bubble-player: #3b82f6;
    --snap-bubble-npc1: #7c3aed;
    --snap-bubble-npc2: #ec4899;
    --snap-bubble-npc3: #10b981;
    --snap-input-bg: #16162a;
    --snap-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --snap-gradient2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --glass: rgba(255,255,255,0.05);
    --glass-border: rgba(255,255,255,0.08);
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%; height: 100%;
    font-family: var(--font);
    background: var(--snap-bg);
    color: var(--snap-text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== SCREEN MANAGEMENT ===== */
.screen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1;
}
.screen.active { display: flex; }

/* ===== MAIN MENU ===== */
.menu-bg {
    width: 100%; height: 100%;
    background: linear-gradient(180deg, #0a0a1a 0%, #1a0a2e 40%, #0a0a1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.menu-particles {
    position: absolute; inset: 0;
    pointer-events: none;
}
.menu-particles .particle {
    position: absolute;
    border-radius: 50%;
    animation: float-particle linear infinite;
    opacity: 0.3;
}
@keyframes float-particle {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 0.4; }
    90% { opacity: 0.4; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

.menu-content {
    text-align: center;
    z-index: 2;
    padding: 20px;
    max-width: 460px;
    width: 100%;
}
.logo-container { margin-bottom: 30px; }
.logo-ghost {
    font-size: 72px;
    animation: ghost-bob 3s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(255,252,0,0.4));
}
@keyframes ghost-bob {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}
.game-title {
    font-size: 52px;
    font-weight: 900;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #fff 0%, #FFFC00 50%, #ff3b5c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    line-height: 1.1;
}
.title-accent { font-style: italic; }
.game-subtitle {
    font-size: 16px;
    color: var(--snap-text-dim);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-top: 8px;
}

/* Menu Avatars */
.menu-avatars {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 30px 0;
}
.menu-avatar {
    width: 80px;
    text-align: center;
    animation: avatar-pop 0.6s ease-out backwards;
    animation-delay: var(--delay);
}
@keyframes avatar-pop {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.menu-avatar img {
    width: 70px; height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--snap-accent);
    box-shadow: 0 0 20px rgba(255,59,92,0.3);
}
.menu-avatar.no-img {
    width: 70px; height: 70px;
    margin: 0 auto;
    border-radius: 50%;
    background: var(--snap-gradient);
    border: 3px solid var(--snap-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
}
.menu-avatar.no-img::before {
    content: '?';
    font-size: 28px;
}
.avatar-name {
    display: block;
    font-size: 12px;
    color: var(--snap-text-dim);
    margin-top: 8px;
    font-weight: 500;
}

/* Menu Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}
.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    color: var(--snap-text);
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.menu-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}
.menu-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.menu-btn:hover::before { opacity: 1; }
.menu-btn:active { transform: translateY(0); }

.primary-btn {
    background: linear-gradient(135deg, #3b82f6, #7c3aed) !important;
    border-color: rgba(124,58,237,0.5) !important;
    font-size: 18px;
    padding: 18px 24px;
    box-shadow: 0 4px 20px rgba(124,58,237,0.3);
}
.primary-btn:hover {
    box-shadow: 0 8px 40px rgba(124,58,237,0.5) !important;
}

.exit-btn { border-color: rgba(255,59,92,0.3) !important; }
.exit-btn:hover { border-color: var(--snap-accent) !important; background: rgba(255,59,92,0.1) !important; }

.btn-icon { font-size: 20px; }
.menu-footer {
    margin-top: 30px;
    font-size: 12px;
    color: rgba(255,255,255,0.2);
    letter-spacing: 2px;
}

/* ===== INFO SCREENS (How To Play / Credits) ===== */
.info-screen {
    width: 100%; height: 100%;
    background: linear-gradient(180deg, #0a0a1a 0%, #1a0a2e 40%, #0a0a1a 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.info-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.info-header h2 {
    font-size: 20px;
    font-weight: 700;
}
.back-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.back-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}
.info-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.info-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
}
.info-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--snap-yellow);
}
.info-card p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--snap-text-dim);
}
.info-card b { color: white; }

/* Credits */
.credits-content {
    align-items: center;
    text-align: center;
}
.credits-logo {
    font-size: 80px;
    margin-bottom: 16px;
    animation: ghost-bob 3s ease-in-out infinite;
}
.credits-studio {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, #FFFC00, #ff3b5c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.credits-tagline {
    color: var(--snap-text-dim);
    font-size: 14px;
    font-style: italic;
    margin-top: 8px;
}
.credits-divider {
    width: 60px;
    height: 2px;
    background: var(--snap-gradient);
    margin: 24px 0;
    border-radius: 1px;
}
.credits-roles {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 320px;
}
.credit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
}
.credit-role {
    font-size: 13px;
    color: var(--snap-text-dim);
    font-weight: 500;
}
.credit-name {
    font-size: 13px;
    color: white;
    font-weight: 600;
}
.credits-disclaimer {
    font-size: 12px;
    color: var(--snap-text-dim);
    line-height: 1.6;
}
.credits-year {
    font-size: 11px;
    color: rgba(255,255,255,0.15);
    margin-top: 8px;
}

/* ===== GAME SCREEN - SNAPCHAT UI ===== */
.snap-container {
    width: 100%;
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: var(--snap-dark);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: -1px 0 0 rgba(255,255,255,0.05), 1px 0 0 rgba(255,255,255,0.05);
}

/* Snap Header */
.snap-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1a1a3e 0%, #2a1a4e 100%);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    z-index: 10;
}
.snap-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}
.snap-back-btn:hover { background: rgba(255,255,255,0.1); }

.snap-header-avatars {
    display: flex;
    margin-left: 4px;
}
.snap-avatar-mini {
    width: 32px; height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--snap-dark);
    margin-left: -8px;
    background: var(--snap-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
}
.snap-avatar-mini:first-child { margin-left: 0; }
.snap-avatar-mini img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.snap-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.snap-header-title {
    font-size: 16px;
    font-weight: 700;
}
.snap-header-status {
    font-size: 11px;
    color: var(--snap-accent3);
    font-weight: 500;
}
.snap-header-actions { display: flex; gap: 4px; }
.snap-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
    opacity: 0.7;
    display: flex;
    align-items: center;
}
.snap-action-btn:hover {
    background: rgba(255,255,255,0.1);
    opacity: 1;
}

/* Chat Area */
.snap-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scroll-behavior: smooth;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(236,72,153,0.05) 0%, transparent 50%),
        var(--snap-dark);
}
.snap-chat-area::-webkit-scrollbar { width: 4px; }
.snap-chat-area::-webkit-scrollbar-track { background: transparent; }
.snap-chat-area::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.chat-date-divider {
    text-align: center;
    margin: 12px 0;
}
.chat-date-divider span {
    background: rgba(255,255,255,0.06);
    padding: 4px 16px;
    border-radius: 12px;
    font-size: 11px;
    color: var(--snap-text-dim);
    font-weight: 500;
}

/* Chat Messages */
.chat-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: msg-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-bottom: 2px;
}
@keyframes msg-pop {
    0% { opacity: 0; transform: translateY(10px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-msg.player { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.npc { align-self: flex-start; }

.msg-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    align-self: flex-end;
    background: var(--snap-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}
.msg-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.msg-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.msg-name {
    font-size: 11px;
    font-weight: 600;
    padding: 0 8px;
}
.msg-name.raven { color: #a78bfa; }
.msg-name.candy { color: #f472b6; }
.msg-name.viper { color: #34d399; }

.msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}
.player .msg-bubble {
    background: var(--snap-bubble-player);
    border-bottom-right-radius: 4px;
    color: white;
}
.npc.raven-msg .msg-bubble {
    background: linear-gradient(135deg, #4c1d95, #6d28d9);
    border-bottom-left-radius: 4px;
}
.npc.candy-msg .msg-bubble {
    background: linear-gradient(135deg, #831843, #be185d);
    border-bottom-left-radius: 4px;
}
.npc.viper-msg .msg-bubble {
    background: linear-gradient(135deg, #064e3b, #047857);
    border-bottom-left-radius: 4px;
}

.msg-time {
    font-size: 10px;
    color: var(--snap-text-dim);
    padding: 0 8px;
    align-self: flex-end;
}

/* System messages */
.chat-system {
    text-align: center;
    margin: 8px 0;
    animation: msg-pop 0.3s ease-out;
}
.chat-system span {
    background: rgba(255,255,255,0.06);
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--snap-text-dim);
    font-style: italic;
}

/* Typing indicator */
.typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.06);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}
.typing-dots span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--snap-text-dim);
    animation: typing-bounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* NPC Status Bar */
.npc-status-bar {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 8px 16px;
    background: rgba(0,0,0,0.3);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.npc-status {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}
.status-avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--snap-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}
.status-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.status-mood {
    font-size: 14px;
}

/* Chat Input */
.snap-input-area {
    padding: 10px 16px 16px;
    background: rgba(0,0,0,0.4);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.snap-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--snap-input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 4px 4px 4px 18px;
    transition: border-color 0.2s;
}
.snap-input-container:focus-within {
    border-color: rgba(124,58,237,0.5);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.snap-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: white;
    font-size: 15px;
    font-family: var(--font);
    padding: 8px 0;
}
.snap-input::placeholder { color: var(--snap-text-dim); }

.snap-send-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--snap-gradient);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.snap-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(124,58,237,0.4);
}
.snap-send-btn:active { transform: scale(0.95); }

/* ===== SCROLLBAR FIX ===== */
.info-content::-webkit-scrollbar { width: 4px; }
.info-content::-webkit-scrollbar-track { background: transparent; }
.info-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
    .game-title { font-size: 38px; }
    .menu-avatar img, .menu-avatar.no-img { width: 60px; height: 60px; }
    .snap-container { max-width: 100%; }
}

/* ===== NPC-to-NPC marker ===== */
.npc-to-npc .msg-bubble::after {
    content: '👀';
    font-size: 10px;
    position: absolute;
    top: -4px;
    right: -4px;
}

/* ===== Glow effects ===== */
.glow-purple { box-shadow: 0 0 20px rgba(124,58,237,0.3); }
.glow-pink { box-shadow: 0 0 20px rgba(236,72,153,0.3); }
.glow-green { box-shadow: 0 0 20px rgba(16,185,129,0.3); }

/* ===== Learning notification ===== */
.learn-notification {
    position: fixed;
    top: 60px;
    right: 20px;
    background: linear-gradient(135deg, rgba(124,58,237,0.9), rgba(236,72,153,0.9));
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    z-index: 100;
    animation: notif-slide 3s ease-in-out forwards;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}
@keyframes notif-slide {
    0% { transform: translateX(120%); opacity: 0; }
    10% { transform: translateX(0); opacity: 1; }
    80% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(120%); opacity: 0; }
}
