/* ═══════════════════════════════════════════════════════
   pp.tools Premium - design system
   Adapted from pp.tools/css/chart.css to stay on-brand.
   ═══════════════════════════════════════════════════════ */

:root {
    --bg-base: #07070e;
    --bg-surface: #0f0f1a;
    --bg-card: #161625;
    --bg-card-hover: #1e1e32;
    --bg-elevated: #222240;
    --bg-input: #12121f;

    --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-primary: #ededf0;
    --text-secondary: #8888a4;
    --text-muted: #55556e;

    --green: #00d4aa;
    --green-dim: rgba(0, 212, 170, 0.12);
    --blue: #5298ff;
    --red: #ff6b6b;
    --red-dim: rgba(255, 107, 107, 0.12);

    --border: rgba(255, 255, 255, 0.06);
    --border-brand: rgba(187, 134, 252, 0.15);

    --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-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

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

h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; }

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

/* ─────────────────────────── NAV ─────────────────────────── */

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}
.nav-brand:hover { color: var(--brand); }
.nav-brand .tag {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand);
    border: 1px solid var(--border-brand);
    padding: 2px 7px;
    border-radius: 999px;
}

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}
.nav-links a:hover { color: var(--text-primary); background: var(--bg-card); }
.nav-links a.active { color: var(--brand); }

.nav-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border-brand);
    object-fit: cover;
}
.nav-avatar--fallback {
    display: grid; place-items: center;
    background: var(--brand-gradient);
    color: var(--bg-base);
    font-weight: 700;
    font-size: 0.8rem;
}

/* ── User menu (hover on avatar) ── */
.nav-user {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 4px;
    cursor: pointer;
    outline: none;
}
.nav-user .nav-avatar {
    transition: box-shadow var(--transition);
}
.nav-user:hover .nav-avatar,
.nav-user:focus-within .nav-avatar {
    box-shadow: 0 0 0 2px var(--brand-glow);
}
.nav-user-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 190px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
    z-index: 200;
}
/* Invisible bridge so hover doesn't drop in the gap above the menu. */
.nav-user-menu::before {
    content: '';
    position: absolute;
    top: -10px; left: 0; right: 0;
    height: 10px;
}
.nav-user:hover .nav-user-menu,
.nav-user:focus-within .nav-user-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-user-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    padding: 2px 4px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    white-space: nowrap;
}
.nav-user-name strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}
.nav-user-handle {
    display: block;
    margin-top: 3px;
    font-size: 0.78rem;
    color: var(--brand);
}
.nav-user-link {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}
.nav-user-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.nav-user-link.active { color: var(--brand); }
.nav-user-sep {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}
.nav-user-signout {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--red);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background var(--transition), border-color var(--transition);
}
.nav-user-signout:hover {
    color: var(--red);
    background: var(--red-dim);
    border-color: rgba(255, 107, 107, 0.3);
}

/* ───────────────────────── LAYOUT ───────────────────────── */

.app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 88px 24px 64px;
}
.app--narrow { max-width: 720px; }

.page-head { margin-bottom: 32px; }
.page-head h1 { font-size: 2rem; font-weight: 700; margin-bottom: 6px; }
.page-head p { color: var(--text-secondary); }

.hero {
    text-align: center;
    padding: 64px 16px 40px;
    position: relative;
}
.hero-glow {
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 500px; height: 400px;
    background: radial-gradient(circle, rgba(187, 134, 252, 0.10) 0%, transparent 70%);
    pointer-events: none;
}
.hero h1 { font-size: 3rem; font-weight: 800; margin-bottom: 16px; position: relative; }
.hero p { color: var(--text-secondary); max-width: 540px; margin: 0 auto 28px; font-size: 1.05rem; }

/* ───────────────────────── BUTTONS ───────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.btn--block { width: 100%; }
.btn--primary {
    background: var(--brand-gradient);
    color: var(--bg-base);
    box-shadow: var(--shadow-glow);
}
.btn--primary:hover { color: var(--bg-base); filter: brightness(1.08); transform: translateY(-1px); }
.btn--ghost {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn--ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-brand); }
.btn--discord { background: #5865f2; color: #fff; }
.btn--discord:hover { background: #4752e0; color: #fff; transform: translateY(-1px); }
.btn--danger { background: var(--red-dim); color: var(--red); border-color: rgba(255,107,107,0.3); }
.btn--danger:hover { background: rgba(255,107,107,0.18); color: var(--red); }
.btn svg { width: 18px; height: 18px; }

/* ───────────────────────── CARDS ───────────────────────── */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 20px; }
.card h2 { font-size: 1.15rem; margin-bottom: 4px; }
.card .card-sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 18px; }

/* ─────────────────────── AUTH / LOGIN ─────────────────────── */

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 80px 20px 40px;
    position: relative;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: 4px; }
.auth-card .sub { color: var(--text-secondary); font-size: 0.92rem; margin-bottom: 28px; }

.divider {
    display: flex; align-items: center; gap: 14px;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 22px 0;
}
.divider::before, .divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

.field { margin-bottom: 14px; }
.field label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 7px;
    font-weight: 500;
}
.input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    padding: 12px 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus {
    outline: none;
    border-color: var(--brand-dim);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.notice {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    margin-bottom: 20px;
    line-height: 1.5;
}
.notice--ok { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,212,170,0.25); }
.notice--err { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,107,107,0.25); }
.notice--info { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border); }

/* ─────────────────────── TOOLS GRID ─────────────────────── */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.tool-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    overflow: hidden;
    transition: all var(--transition);
}
.tool-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--brand-gradient); opacity: 0.85;
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--border-brand); box-shadow: var(--shadow-md); }
.tool-card.locked { opacity: 0.62; }
.tool-card.locked::before { background: var(--border); }
.tool-card h3 { font-size: 1.05rem; }
.tool-card p { color: var(--text-secondary); font-size: 0.88rem; flex: 1; }
.tool-card .tool-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.tool-link { font-weight: 600; font-size: 0.9rem; }

.lock-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.75rem; font-weight: 600;
    color: var(--text-muted);
}

/* ───────────────────────── BADGES ───────────────────────── */

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.badge--tier { color: var(--bg-base); }

/* ──────────────────────── TIER CARDS ──────────────────────── */

.tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 12px;
}
.tier-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 26px 22px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    overflow: hidden;
    transition: all var(--transition);
}
.tier-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--accent, var(--brand));
    transition: height var(--transition);
}
.tier-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent, var(--brand)) 55%, var(--border));
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--accent, var(--brand)) 50%, transparent),
        0 14px 44px color-mix(in srgb, var(--accent, var(--brand)) 22%, transparent),
        var(--shadow-md);
}
.tier-card:hover::before { height: 5px; }
.tier-card.current { border-color: var(--accent, var(--brand)); box-shadow: 0 0 0 1px var(--accent, var(--brand)); }

/* Featured tier - lifted, outlined in its accent so it stands out from the row. */
.tier-card--featured {
    border-color: color-mix(in srgb, var(--accent, var(--brand)) 60%, var(--border));
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--accent, var(--brand)) 45%, transparent),
        0 10px 34px color-mix(in srgb, var(--accent, var(--brand)) 16%, transparent);
}
.tier-card--featured::before { height: 5px; }

/* Little ribbon in the top-right corner. */
.tier-badge {
    position: absolute; top: 14px; right: 14px;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    padding: 4px 9px; border-radius: 999px;
    color: var(--accent, var(--brand));
    background: color-mix(in srgb, var(--accent, var(--brand)) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent, var(--brand)) 40%, transparent);
}
/* The joke tier gets a knowingly absurd treatment. */
.tier-card--joke { opacity: 0.9; }
.tier-card--joke .tier-price { text-decoration: line-through wavy color-mix(in srgb, var(--accent) 60%, transparent); }
.tier-card--joke:hover { opacity: 1; }
.tier-name { font-size: 1.3rem; font-weight: 700; margin-bottom: 2px; }
.tier-price { font-size: 1.9rem; font-weight: 800; margin: 10px 0 2px; }
.tier-price span { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }
.tier-blurb { color: var(--text-secondary); font-size: 0.9rem; min-height: 40px; }
.tier-perks { list-style: none; margin: 16px 0 20px; display: flex; flex-direction: column; gap: 9px; }
.tier-perks li { display: flex; gap: 9px; font-size: 0.9rem; color: var(--text-primary); }
.tier-perks li svg { flex-shrink: 0; margin-top: 3px; color: var(--accent, var(--brand)); }
.tier-card .btn { margin-top: auto; }

/* ──────────────────────── KV / LISTS ──────────────────────── */

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 14px 20px; }
.kv dt { color: var(--text-secondary); font-size: 0.9rem; }
.kv dd { color: var(--text-primary); font-size: 0.95rem; word-break: break-word; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 4px 0; } .kv dd { margin-bottom: 12px; } }

.session-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.session-row:last-child { border-bottom: none; }
.session-row .meta { color: var(--text-muted); font-size: 0.8rem; }

/* ──────────────────────── FOOTER ──────────────────────── */

.foot {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 40px 0 8px;
}
.foot a { color: var(--text-secondary); }

.gated {
    text-align: center;
    padding: 48px 24px;
    border: 1px dashed var(--border-brand);
    border-radius: var(--radius-xl);
    background: var(--bg-surface);
}
.gated .lock-icon {
    width: 56px; height: 56px;
    display: grid; place-items: center;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--brand-glow);
    color: var(--brand);
}
