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

:root {
    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-elevated: #010409;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --accent-glow: rgba(88, 166, 255, 0.15);
    --danger: #f85149;
    --success: #3fb950;
    --warning: #d29922;
    --code-bg: #0d1117;
    --radius: 10px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

code {
    font-family: var(--mono);
    font-size: 0.9em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    border: 1px solid var(--border);
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1rem 0;
}
pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.7;
}

/* Nav */
header {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
nav {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}
.logo {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    letter-spacing: 0.05em;
}
.logo:hover {
    color: var(--text);
    text-decoration: none;
}
.nav-version {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 0.1rem 0.5rem;
    letter-spacing: 0.02em;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.nav-icon {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.nav-icon:hover {
    color: var(--text);
    text-decoration: none;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}
.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* Main */
main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text);
    background: var(--bg-card);
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.btn:hover {
    border-color: var(--text-muted);
    text-decoration: none;
}
.btn-primary {
    background: #238636;
    border-color: #2ea043;
    color: #fff;
}
.btn-primary:hover {
    background: #2ea043;
    color: #fff;
}
.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}
.btn-small {
    padding: 0.25rem 0.625rem;
    font-size: 0.8rem;
}
.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Hero (default — used by non-home pages if needed) */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}
.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    font-weight: 800;
}
.tagline {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.subtitle {
    color: var(--text-muted);
    max-width: 640px;
    margin: 0 auto 2rem;
}
.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Features (default) */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 3rem 0;
}
.feature {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}
.feature h3 {
    margin-bottom: 0.5rem;
}
.feature p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Install */
.install {
    margin: 2rem 0;
}
.install h2 {
    margin-bottom: 0.5rem;
}

/* Dashboard */
.tokens-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}
.tokens-table th,
.tokens-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.tokens-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Token created */
.token-created {
    max-width: 640px;
}
.token-created .warning {
    color: var(--warning);
    font-weight: 600;
    margin-bottom: 1.5rem;
}
.token-display {
    background: var(--bg-card);
    border: 2px solid var(--warning);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    word-break: break-all;
}
.token-display code {
    flex: 1;
    background: none;
    border: none;
    font-size: 0.85rem;
}

/* Create token form */
.create-token {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}
.create-token h2 {
    margin-bottom: 1rem;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 600;
    font-size: 0.9rem;
}
.form-group small {
    color: var(--text-muted);
    font-size: 0.8rem;
}
.input-prefix {
    display: flex;
    align-items: center;
    margin-bottom: 0.375rem;
}
.input-prefix .prefix {
    background: var(--bg);
    border: 1px solid var(--border);
    border-right: none;
    padding: 0.5rem 0.625rem;
    border-radius: 6px 0 0 6px;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.85rem;
}
.input-prefix input {
    flex: 1;
    padding: 0.5rem 0.625rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0 6px 6px 0;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.85rem;
}
.input-prefix input:focus {
    outline: none;
    border-color: var(--accent);
}

.usage-info {
    margin: 2rem 0;
}
.usage-info h2,
.usage-info h3 {
    margin-bottom: 0.5rem;
}

.empty {
    color: var(--text-muted);
    padding: 2rem 0;
}

/* Error page */
.error-page {
    text-align: center;
    padding: 4rem 0;
}
.error-message {
    color: var(--danger);
    margin: 1rem 0 2rem;
    font-size: 1.1rem;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    text-align: center;
}
footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.footer-inner {
    max-width: 960px;
    margin: 0 auto;
}
.footer-tagline {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--border);
    margin-top: 0.5rem;
    letter-spacing: 0.05em;
}

/* Responsive (shared) */
@media (max-width: 640px) {
    .hero h1 { font-size: 1.75rem; }
    .features { grid-template-columns: 1fr; }
    .cta-buttons { flex-direction: column; align-items: center; }
    header { padding: 0.75rem 1rem; }
    main { padding: 1.5rem 1rem; }
}

/* ============================================================
   HOME PAGE — scoped to body.page-home
   ============================================================ */

/* Hero badge */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}
.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Home hero */
.home-hero {
    text-align: center;
    padding: 5rem 0 3rem;
    position: relative;
    overflow: hidden;
}
.home-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(88, 166, 255, 0.1) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: radial-gradient(ellipse 70% 50% at 50% 30%, black 10%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 70% 50% at 50% 30%, black 10%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.home-hero::after {
    content: '';
    position: absolute;
    top: -10%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(88, 166, 255, 0.07) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.home-hero > * {
    position: relative;
    z-index: 1;
}
.home-hero h1 {
    font-size: clamp(2.75rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 0.75rem;
}
.hero-gradient {
    background: linear-gradient(135deg, #58a6ff, #a78bfa, #58a6ff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 4s ease-in-out infinite;
}
@keyframes gradient-shift {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}
.hero-standard {
    font-family: var(--mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
    margin-bottom: 1.5rem;
    opacity: 0.8;
}
.hero-tagline {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}
.hero-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.6;
}
.hero-subtitle code {
    color: var(--text);
}

/* Home page primary button override — accent blue */
.page-home .btn-primary {
    background: linear-gradient(135deg, #58a6ff, #388bfd);
    border: 1px solid rgba(88, 166, 255, 0.4);
    color: #fff;
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.2);
}
.page-home .btn-primary:hover {
    background: linear-gradient(135deg, #79c0ff, #58a6ff);
    box-shadow: 0 0 30px rgba(88, 166, 255, 0.35);
    transform: translateY(-1px);
    color: #fff;
}

/* Ghost button */
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-ghost:hover {
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

/* Terminal */
.home-terminal {
    padding: 2rem 0 3rem;
}
.terminal {
    max-width: 620px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-elevated);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.terminal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
}
.terminal-dots {
    display: flex;
    gap: 6px;
}
.terminal-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.terminal-dots span:nth-child(1) { background: #f85149; }
.terminal-dots span:nth-child(2) { background: #d29922; }
.terminal-dots span:nth-child(3) { background: #3fb950; }
.terminal-title {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}
.terminal-body {
    margin: 0;
    padding: 1.25rem;
    border: none;
    background: transparent;
    border-radius: 0;
}
.terminal-body code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.7;
}
.t-comment { color: #6e7681; }
.t-prompt { color: var(--success); user-select: none; }
.t-string { color: #a5d6ff; }

/* Section label (shared by anatomy + features) */
.section-label {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

/* Anatomy section */
.home-anatomy {
    text-align: center;
    padding: 3rem 0;
}
.home-anatomy h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}
.home-anatomy h2 code {
    font-size: 0.85em;
    color: var(--accent);
    background: rgba(88, 166, 255, 0.08);
    border-color: rgba(88, 166, 255, 0.2);
}
.anatomy-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 520px;
    margin: 0 auto;
}
.anatomy-tree {
    max-width: 520px;
    margin: 2rem auto 0;
    text-align: left;
}
.tree-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    font-size: 0.85rem;
    line-height: 1.8;
    margin: 0;
}
.tree-block code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.8;
}
.tree-dir { color: var(--accent); font-weight: 600; }
.tree-file { color: var(--text); }
.tree-ann { color: #6e7681; }

/* Features (home page) */
.home-features {
    text-align: center;
    padding: 3rem 0;
}
.home-features h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 2.5rem;
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    text-align: left;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.feature-card:hover {
    border-color: rgba(88, 166, 255, 0.3);
    box-shadow: 0 0 24px rgba(88, 166, 255, 0.06);
}
.feature-icon {
    color: var(--accent);
    margin-bottom: 1rem;
    line-height: 1;
}
.feature-icon svg {
    width: 36px;
    height: 36px;
}
.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.feature-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.6;
}
.feature-card p code {
    font-size: 0.8em;
}

/* Bottom CTA */
.home-cta {
    text-align: center;
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}
.cta-line {
    color: var(--text-muted);
    font-size: 0.95rem;
}
.cta-line code {
    color: var(--text);
    background: var(--bg-card);
}

/* ============================================================
   HOME PAGE — Responsive
   ============================================================ */

@media (max-width: 768px) {
    .home-hero {
        padding: 4rem 0 2.5rem;
    }
    .home-hero h1 {
        font-size: clamp(2rem, 6vw, 2.5rem);
    }
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .terminal {
        margin: 0 0.5rem;
    }
    .anatomy-tree {
        margin: 1.5rem 0.5rem 0;
    }
    .tree-block {
        padding: 1rem 1.25rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .home-hero h1 {
        font-size: 1.75rem;
    }
    .home-hero .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    .hero-tagline br,
    .hero-subtitle br,
    .home-hero h1 br {
        display: none;
    }
    .nav-version {
        display: none;
    }
}
