/* pp.tools theme. Every page loads this first: tokens, reset, browser surfaces,
   and the pieces that must look identical everywhere (top nav, back-to-home
   link, author credit, buttons, inputs). Page stylesheets add layout and their
   own components on top. The rules behind these values are in THEME.md. */

:root {
    /* Surfaces, back to front */
    --bg-base: #07070e;
    --bg-surface: #0f0f1a;
    --bg-card: #161625;
    --bg-card-hover: #1e1e32;
    --bg-elevated: #222240;
    --bg-input: #12121f;

    /* Brand */
    --brand: #bb86fc;
    --brand-dim: #9a6adf;
    --brand-bright: #d4b0ff;
    --brand-gradient: linear-gradient(135deg, #bb86fc 0%, #8b5cf6 50%, #6366f1 100%);
    --brand-glow: rgba(187, 134, 252, 0.12);

    /* Text */
    --text-primary: #ededf0;
    --text-secondary: #8888a4;
    --text-muted: #55556e;

    /* Signal */
    --green: #00d4aa;
    --green-dim: rgba(0, 212, 170, 0.12);
    --red: #ff6b6b;
    --red-dim: rgba(255, 107, 107, 0.12);
    --gold: #f2b84b;

    /* Platforms */
    --kalshi: #00d4aa;
    --polymarket: #5298ff;
    --hyperliquid: #ff9f43;

    /* Lines */
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);
    --border-brand: rgba(187, 134, 252, 0.15);
    --border-brand-strong: rgba(187, 134, 252, 0.45);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(187, 134, 252, 0.08);

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    --nav-height: 56px;

    color-scheme: dark;
}

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

html {
    background: var(--bg-base);
}

/* Column flex so .site-footer can sit at the bottom of short pages. Page
   wrappers need width: 100% alongside their max-width and auto margins. */
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Browser surfaces */
::selection {
    background: rgba(187, 134, 252, 0.35);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Firefox has no ::-webkit-scrollbar. Scoped so Chrome keeps the rules above. */
@supports not selector(::-webkit-scrollbar) {
    html {
        scrollbar-color: var(--bg-elevated) transparent;
        scrollbar-width: thin;
    }
}

a {
    color: var(--brand);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--brand-bright);
}

button {
    font-family: inherit;
}

.icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    vertical-align: -0.125em;
}

/* ═══════════════════════════════════════════════════════
   TOP NAV
   Sized in px so it is identical on every app, whatever the root font size.
   ═══════════════════════════════════════════════════════ */

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 32px;
    height: var(--nav-height);
    background: rgba(7, 7, 14, 0.8);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

/* Back to home. Negative margin keeps the label on the nav's left edge while
   the padding gives the hover wash and the tap target some room. */
.nav-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: -10px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    color: var(--brand);
    white-space: nowrap;
    transition: color var(--transition), background var(--transition);
}
.nav-home svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform var(--transition);
}
.nav-home:hover {
    color: var(--brand-bright);
    background: var(--brand-glow);
}
.nav-home:hover svg {
    transform: translateX(-2px);
}

/* Disclaimer. Wraps to two balanced lines when the bar gets narrow. */
.nav-hint {
    min-width: 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
    text-align: right;
    text-wrap: balance;
}

/* ═══════════════════════════════════════════════════════
   AUTHOR CREDIT
   ═══════════════════════════════════════════════════════ */

/* "Made by Foster": bright and underlined so it reads as a link. */
.author-link {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--brand);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
    transition: color var(--transition);
}
.author-link:hover {
    color: var(--brand);
}

.site-footer {
    margin-top: auto;
    padding: 20px 24px 28px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: center;
}
.site-footer p {
    margin: 0;
}

/* ═══════════════════════════════════════════════════════
   BRAND TEXT
   ═══════════════════════════════════════════════════════ */

/* Page titles and the pp.tools wordmark only. */
.gradient-text {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

/* Primary: the one thing this view is for. */
.btn-brand {
    background: var(--brand-gradient);
    color: #fff;
}
.btn-brand:hover {
    color: #fff;
    opacity: 0.9;
    box-shadow: 0 4px 16px rgba(187, 134, 252, 0.3);
}

/* Secondary: real actions that sit beside a primary. */
.btn-outline {
    background: transparent;
    color: var(--brand);
    border: 1px solid var(--border-brand);
}
.btn-outline:hover {
    background: var(--brand-glow);
}

/* Tertiary: reset, cancel, back. */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════════ */

.input {
    padding: 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: border-color var(--transition);
    outline: none;
}
.input:focus {
    border-color: var(--brand-dim);
}
.input::placeholder {
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .top-nav { padding: 0 16px; gap: 12px; }
    .nav-home { flex-shrink: 0; }
    .nav-hint { font-size: 11px; line-height: 1.3; }
}

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