:root {
    --bg: #09090c;
    --surface: #111118;
    --card: rgba(18,18,28,0.72);
    --border: rgba(255,255,255,0.06);
    --border-m: rgba(255,255,255,0.1);
    --border-h: rgba(255,255,255,0.16);
    --border-x: rgba(255,255,255,0.22);
    --w: #ffffff;
    --w2: #e8e8f0;
    --s: #c0c0d0;
    --m: #8888a0;
    --d: #55556e;
    --dd: #33334a;
    --accent: #3066ff;
    --accent-glow: rgba(48,102,255,0.2);
}

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

*::-webkit-scrollbar { width: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--w);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    user-select: none;
    -webkit-user-select: none;
}

input, textarea, select, [contenteditable="true"], pre, code {
    user-select: text;
    -webkit-user-select: text;
}

a { text-decoration: none; color: inherit; transition: all 0.3s ease; }

/* ===== BACKGROUND ELEMENTS ===== */
#bgC { position: fixed; inset: 0; z-index: -20; pointer-events: none; }
.bg-mesh { position: fixed; inset: 0; z-index: -19; pointer-events: none; }
.bg-mesh::before {
    content: ''; position: absolute; inset: -40%;
    background:
        radial-gradient(ellipse 1000px 600px at 10% 10%, rgba(255,255,255,0.035), transparent 55%),
        radial-gradient(ellipse 800px 700px at 90% 20%, rgba(255,255,255,0.028), transparent 50%),
        radial-gradient(ellipse 600px 500px at 50% 90%, rgba(240,240,255,0.022), transparent 45%),
        radial-gradient(ellipse 500px 400px at 75% 70%, rgba(255,255,255,0.018), transparent 40%);
    animation: mD 28s ease-in-out infinite;
}
@keyframes mD { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(2%, 1.5%) scale(1.03); } }

.bg-grid {
    position: fixed; inset: 0; z-index: -18; pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 75% 55% at 50% 50%, black 25%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 75% 55% at 50% 50%, black 25%, transparent 75%);
    animation: gB 12s ease-in-out infinite;
}
@keyframes gB { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

.bg-noise {
    position: fixed; inset: 0; z-index: -16; pointer-events: none;
    opacity: 0.016;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 180px 180px;
}

.bg-vig {
    position: fixed; inset: 0; z-index: -15; pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 22%, rgba(5,5,8,0.75) 100%);
}

.bg-top {
    position: fixed; top: -220px; left: 50%; transform: translateX(-50%);
    width: 1100px; height: 500px;
    background: radial-gradient(ellipse, rgba(255,255,255,0.04), transparent 60%);
    z-index: -14; pointer-events: none; filter: blur(50px);
    animation: tP 8s ease-in-out infinite;
}
@keyframes tP { 0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); } 50% { opacity: 1; transform: translateX(-50%) scale(1.12); } }

.fp-box { position: fixed; inset: 0; z-index: -13; pointer-events: none; overflow: hidden; }
.fp {
    position: absolute; border-radius: 50%;
    will-change: transform, opacity;
    animation: fpU linear infinite;
}
@keyframes fpU {
    0% { transform: translateY(110vh) scale(0); opacity: 0; }
    6% { opacity: var(--po); transform: translateY(94vh) scale(1); }
    50% { transform: translateY(50vh) scale(1); }
    94% { opacity: var(--po); transform: translateY(6vh) scale(1); }
    100% { transform: translateY(-10vh) scale(0); opacity: 0; }
}

/* ===== LAYOUT ===== */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(18,18,28,0.6);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-m);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--w);
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-brand img { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-h); }

.nav-links { display: flex; align-items: center; gap: 20px; }

/* ===== COMPONENTS ===== */
.card {
    background: linear-gradient(180deg, rgba(18,18,28,0.68), rgba(13,13,22,0.82));
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    border: 1px solid var(--border-m);
    border-radius: 16px;
    padding: 32px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.card .swp {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.03) 50%, transparent 75%);
    transform: translateX(-120%);
    transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    will-change: transform;
}

.card:hover .swp {
    transform: translateX(120%);
}

.card::before, .card::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-style: solid;
    border-color: rgba(255,255,255,0.08);
    transition: all 0.5s ease;
    pointer-events: none;
}

.card::before { top: -1px; left: -1px; border-width: 1.5px 0 0 1.5px; border-radius: 16px 0 0 0; }
.card::after { bottom: -1px; right: -1px; border-width: 0 1.5px 1.5px 0; border-radius: 0 0 16px 0; }

.card:hover { border-color: var(--border-h); transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.card:hover::before, .card:hover::after { border-color: rgba(255,255,255,0.25); width: 22px; height: 22px; }


.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--w);
    display: flex;
    align-items: center;
    gap: 10px;
}

.fld {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0,0,0,0.3);
    border: 1.5px solid var(--border-m);
    border-radius: 10px;
    color: var(--w);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    transition: border-color 0.35s ease, box-shadow 0.35s ease, background 0.3s ease;
    outline: none;
    margin-bottom: 16px;
}

.editor-fld {
    min-height: 400px;
    max-height: 80vh;
    resize: vertical;
    line-height: 1.6;
    tab-size: 4;
    overflow-y: auto;
    white-space: pre;
    word-wrap: normal;
}

.editor-fld::-webkit-scrollbar { width: 6px; }
.editor-fld::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }
.editor-fld::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

.fld:hover { border-color: rgba(255,255,255,0.15); background: rgba(0,0,0,0.35); }
.fld:focus { border-color: rgba(255,255,255,0.3); box-shadow: 0 0 0 4px rgba(255,255,255,0.04), 0 0 28px rgba(255,255,255,0.04); background: rgba(0,0,0,0.4); }

.bt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border: 1.5px solid transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.bt.primary {
    background: rgba(255,255,255,0.09);
    color: var(--w);
    border-color: rgba(255,255,255,0.16);
    box-shadow: 0 0 20px rgba(255,255,255,0.04);
}
.bt.primary:hover { transform: translateY(-3px); background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.24); box-shadow: 0 8px 30px rgba(255,255,255,0.06); }

.bt.danger {
    background: rgba(220,55,55,0.12);
    border-color: rgba(220,55,55,0.2);
    color: #ff9999;
}
.bt.danger:hover { background: rgba(220,55,55,0.22); border-color: rgba(220,55,55,0.3); transform: translateY(-2px); }

.bt.success {
    background: rgba(34,197,94,0.12);
    border-color: rgba(34,197,94,0.2);
    color: #66eeaa;
}
.bt.success:hover { background: rgba(34,197,94,0.22); border-color: rgba(34,197,94,0.3); transform: translateY(-2px); }

.bt.full { width: 100%; }

/* ===== GRID SYSTEM ===== */
.paste-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

/* ===== ANIMATIONS ===== */
@keyframes fU { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.ani { animation: fU 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }

/* ===== AUTH SPECIFIC ===== */
.auth-container {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.logo-wrap { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 32px; }
.logo-icon { width: 48px; height: 48px; border-radius: 12px; overflow: hidden; border: 1.5px solid rgba(255,255,255,0.12); box-shadow: 0 0 22px rgba(255,255,255,0.06), 0 4px 12px rgba(0,0,0,0.4); }
.logo-icon img { width: 100%; height: 100%; object-fit: cover; }
.logo-text { font-family: 'Outfit', sans-serif; font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px; color: var(--w); }

/* ===== PRISM OVERRIDE ===== */
pre[class*="language-"] {
    background: rgba(0,0,0,0.4) !important;
    border: 1px solid var(--border-m);
    border-radius: 12px !important;
    padding: 20px !important;
}

code[class*="language-"] {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 0.85rem !important;
}

/* ===== FLASH MESSAGES ===== */
.flash-container { margin-bottom: 24px; }
.flash {
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
}
.flash.error { background: rgba(220,55,55,0.1); border-color: rgba(220,55,55,0.2); color: #ff9999; }
.flash.success { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.2); color: #66eeaa; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar { padding: 16px 20px; }
    .app-container { padding: 20px 16px; }
    .paste-grid { grid-template-columns: 1fr; }
}
