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

:root {
    /* Sophisticated Midnight Palette */
    --bg: #000000;
    --surface: #0a0a0a;
    --surface-raised: #111111;
    --accent: #6366f1;
    /* Indigo */
    --accent-soft: rgba(99, 102, 241, 0.1);
    --success: #10b981;
    --danger: #ef4444;

    /* Elegant Borders & Glass */
    --border: rgba(255, 255, 255, 0.08);
    --border-bright: rgba(255, 255, 255, 0.15);
    --glass: rgba(10, 10, 10, 0.8);

    /* Shadows - Soft & Deep */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Radii - Product Modern */
    --radius-full: 9999px;
    --radius-xl: 16px;
    --radius-lg: 12px;
    --radius-md: 8px;
}

* {
    -webkit-tap-highlight-color: transparent;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg);
    color: #ededed;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

/* Subtle Gradient Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% -20%, #1a1a1a 0%, #000000 70%);
    z-index: -1;
}

/* App Shell */
.neo-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.max-nexus {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.view-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.view-content::-webkit-scrollbar {
    display: none;
}

/* Clean Header */
.glass-header {
    backdrop-filter: blur(16px);
    background: var(--glass);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding-top: env(safe-area-inset-top);
}

/* Modern Components */
.neo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    transition: all 0.2s ease;
}

.neo-card-gradient {
    background: linear-gradient(to bottom right, var(--surface-raised), var(--surface));
}

.neo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    user-select: none;
    text-decoration: none;
}

.neo-btn-primary {
    background: #ffffff;
    color: #000000;
}

.neo-btn-primary:active {
    transform: scale(0.97);
    background: #e5e5e5;
}

.neo-btn-secondary {
    background: var(--surface-raised);
    color: #ffffff;
    border-color: var(--border);
}

.neo-btn-secondary:active {
    background: #1a1a1a;
    transform: scale(0.97);
}

.neo-btn-accent {
    background: var(--accent);
    color: #ffffff;
}

.neo-btn-accent:active {
    transform: scale(0.97);
}

.neo-input {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    color: #ffffff;
    font-size: 16px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s ease;
}

.neo-input:focus {
    border-color: var(--accent);
}

.neo-input::placeholder {
    color: #525252;
}

/* Avatar System */
.avatar-node {
    width: 64px;
    height: 64px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-node.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* Chips & Selectors */
.neo-chip {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #a3a3a3;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.neo-chip.active {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
}

/* Modal Bottom Sheets */
.neo-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.neo-modal.active {
    visibility: visible;
    opacity: 1;
}

.neo-modal-content {
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    padding: 32px 24px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.neo-modal.active .neo-modal-content {
    transform: translateY(0);
}

.sheet-handle {
    width: 32px;
    height: 4px;
    background: var(--border-bright);
    border-radius: var(--radius-full);
    margin: -16px auto 24px;
}

/* Typography */
.heading-premium {
    font-family: 'Geist', sans-serif;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.text-subtle {
    color: #737373;
    font-size: 14px;
}

/* Transitions */
.view-transition {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.v-hidden {
    opacity: 0;
    transform: translateY(8px);
}

.v-visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

.animate-slide-up {
    animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.animate-fade-out {
    animation: fadeOut 0.3s ease forwards;
}

/* Game Elements */
.player-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-row.is-me {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* Ghost Frequencies */
.ghost-shell {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: 24px;
    max-width: 432px;
    margin: 0 auto;
    z-index: 60;
    pointer-events: none;
}

.ghost-trigger {
    width: 65px;
    height: 65px;
    background: var(--surface-raised);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.ghost-trigger:active {
    transform: scale(0.9);
}

.ghost-notif {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--surface-raised);
    display: none;
}

.ghost-panel {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-bright);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 12px;
    display: none;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
    pointer-events: auto;
    max-height: 440px;
    animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ghost-panel.active {
    display: flex;
}

.ghost-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 8px;
    min-height: 100px;
}

.ghost-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fadeIn 0.3s ease;
}

.ghost-msg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #525252;
}

.ghost-msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    color: #ededed;
    border: 1px solid rgba(255, 255, 255, 0.05);
    line-height: 1.4;
    width: fit-content;
}

.ghost-reaction-bubble {
    font-size: 24px;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
}

.ghost-input-wrap {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.ghost-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 18px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.ghost-input:focus {
    border-color: var(--accent);
}

.ghost-send {
    width: 48px;
    height: 48px;
    background: var(--accent);
    color: #fff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.ghost-send:active {
    transform: scale(0.9);
}

.ghost-emoji-grid {
    display: grid;
    grid-template-cols: repeat(5, 1fr);
    gap: 10px;
}

.ghost-emoji-btn {
    font-size: 22px;
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ghost-emoji-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}