/*
 * GhostShow.Win shared theme: tokens, animated gradient background, and components
 * used by every page. Dark mode is the `dark-mode` class on <html>, set by theme.js
 * before first paint. Page-specific styles stay inline and should use these tokens.
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    --bg: #f6f4ff;
    --text: #1e1b4b;
    --text-muted: #57537d;
    --surface: rgba(255, 255, 255, 0.62);
    --surface-strong: rgba(255, 255, 255, 0.86);
    --surface-hover: rgba(255, 255, 255, 0.97);
    --border: rgba(124, 58, 237, 0.16);
    --border-strong: rgba(168, 85, 247, 0.5);
    --shadow: 0 1px 2px rgba(30, 27, 75, 0.04), 0 12px 40px -12px rgba(109, 40, 217, 0.24);
    --glow: 0 10px 30px -10px rgba(168, 85, 247, 0.65);
    --glow-strong: 0 16px 44px -10px rgba(236, 72, 153, 0.6);
    --focus-ring: 0 0 0 4px rgba(168, 85, 247, 0.22);
    --accent: #7c3aed;
    --grad: linear-gradient(120deg, #4f46e5 0%, #9333ea 50%, #db2777 100%);
    --grad-text: linear-gradient(100deg, #4f46e5 0%, #9333ea 45%, #db2777 100%);
    --grad-success: linear-gradient(120deg, #047857 0%, #0e7490 100%);
    --grad-danger: linear-gradient(120deg, #be123c 0%, #ea580c 100%);
    --grad-warn: linear-gradient(120deg, #b45309 0%, #be185d 100%);
    --blob-1: rgba(139, 92, 246, 0.30);
    --blob-2: rgba(236, 72, 153, 0.24);
    --blob-3: rgba(6, 182, 212, 0.22);
    --dots: rgba(76, 29, 149, 0.10);
    --radius: 24px;
    --radius-sm: 14px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
}

html.dark-mode {
    --bg: #07061a;
    --text: #ece9ff;
    --text-muted: #a9a5cf;
    --surface: rgba(26, 22, 60, 0.55);
    --surface-strong: rgba(34, 29, 76, 0.82);
    --surface-hover: rgba(48, 41, 104, 0.92);
    --border: rgba(167, 139, 250, 0.16);
    --border-strong: rgba(192, 132, 252, 0.55);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 50px -16px rgba(0, 0, 0, 0.75);
    --glow: 0 10px 34px -10px rgba(168, 85, 247, 0.8);
    --glow-strong: 0 18px 50px -10px rgba(236, 72, 153, 0.7);
    --focus-ring: 0 0 0 4px rgba(192, 132, 252, 0.3);
    --accent: #c4b5fd;
    --grad-text: linear-gradient(100deg, #a5b4fc 0%, #d8b4fe 45%, #f9a8d4 100%);
    --blob-1: rgba(124, 58, 237, 0.38);
    --blob-2: rgba(219, 39, 119, 0.26);
    --blob-3: rgba(8, 145, 178, 0.26);
    --dots: rgba(196, 181, 253, 0.07);
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
    background-color: var(--bg);
    color-scheme: light;
    transition: background-color 0.3s ease;
}
html.dark-mode { color-scheme: dark; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: transparent;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: color 0.3s ease;
}

/* Floating gradient blobs */
body::before {
    content: '';
    position: fixed;
    inset: -20vmax;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(38vmax 38vmax at 18% 22%, var(--blob-1), transparent 62%),
        radial-gradient(34vmax 34vmax at 84% 16%, var(--blob-2), transparent 62%),
        radial-gradient(44vmax 44vmax at 68% 86%, var(--blob-3), transparent 62%);
    animation: ghost-drift 26s ease-in-out infinite alternate;
}

/* Dot grid overlay, faded toward the edges */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: radial-gradient(var(--dots) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
}

@keyframes ghost-drift {
    0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
    50% { transform: translate3d(3%, -2%, 0) rotate(7deg) scale(1.07); }
    100% { transform: translate3d(-3%, 2%, 0) rotate(-5deg) scale(1); }
}

a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
img { max-width: 100%; height: auto; }

/* ---------- Type helpers ---------- */

.gradient-text {
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.page-heading {
    font-size: clamp(2rem, 1.2rem + 3.5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    margin: 14px 0 12px;
    text-align: center;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 620px;
    margin: 0 auto 28px;
    text-align: center;
}

/* ---------- Layout ---------- */

.page {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 72px 16px 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ---------- Components ---------- */

.glass {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px 5px 6px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.badge-pill {
    background: var(--grad);
    color: #fff;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

button {
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    color: #fff;
    background: var(--grad);
    background-size: 180% 180%;
    background-position: 0% 50%;
    border: 0;
    border-radius: 999px;
    padding: 11px 22px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--glow);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-position 0.4s ease, background-color 0.2s ease;
}
button:hover {
    transform: translateY(-2px);
    background-position: 100% 50%;
    box-shadow: var(--glow-strong);
}
button:active { transform: translateY(0) scale(0.98); }
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.secondary-btn {
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--border), var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.secondary-btn:hover {
    background: var(--surface-hover);
    box-shadow: inset 0 0 0 1px var(--border-strong), var(--glow);
}
.success-btn { background: var(--grad-success); background-size: 180% 180%; box-shadow: 0 10px 28px -10px rgba(4, 120, 87, 0.7); }
.danger-btn { background: var(--grad-danger); background-size: 180% 180%; box-shadow: 0 10px 28px -10px rgba(225, 29, 72, 0.7); }
.warn-btn { background: var(--grad-warn); background-size: 180% 180%; box-shadow: 0 10px 28px -10px rgba(217, 119, 6, 0.7); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 16px 34px; font-size: 1.15rem; }

input,
select {
    font: inherit;
    color: var(--text);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 9px 14px;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.3s;
}
input:focus,
select:focus {
    outline: none;
    border-color: var(--border-strong);
    box-shadow: var(--focus-ring);
}

/* Dark mode toggle (inserted by theme.js) */
.theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    width: 46px;
    height: 46px;
    padding: 0;
    font-size: 1.2rem;
    color: var(--text);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.theme-toggle:hover {
    transform: translateY(-2px) rotate(-12deg);
    border-color: var(--border-strong);
    box-shadow: var(--glow);
}

/* Floating "back to homepage" pill */
.back-home {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 16px;
    margin: 0;
    padding-inline: 16px;
    text-align: center;
    z-index: 1001;
    pointer-events: none;
}
.back-home-link {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.back-home-link:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--glow);
}

.site-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 32px 16px;
}

/* ---------- Motion / print ---------- */

@media (prefers-reduced-motion: reduce) {
    body::before { animation: none; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    html, body { background: #fff !important; color: #000 !important; }
    body::before, body::after, .theme-toggle, .back-home { display: none !important; }
    .glass, .badge {
        background: #fff !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        border-color: #000 !important;
    }
    .gradient-text {
        background: none !important;
        color: #000 !important;
        -webkit-text-fill-color: #000 !important;
    }
}
