:root {
    color-scheme: light dark;
    --accent: #c78755;
    --accent-strong: #c78755;
    --accent-soft: rgba(241, 228, 218, 0.62);
    --wordmark-book: #c78755;
    --bg-top: #f5eee8;
    --bg-bottom: #e1d6ce;
    --surface: rgba(252, 247, 243, 0.76);
    --surface-strong: rgba(245, 238, 232, 0.94);
    --surface-muted: rgba(249, 244, 239, 0.72);
    --surface-chip: rgba(255, 255, 255, 0.5);
    --text: #312822;
    --text-soft: #5c4b42;
    --text-muted: #856f63;
    --stroke: rgba(128, 104, 89, 0.22);
    --hairline: rgba(255, 255, 255, 0.54);
    --shadow: rgba(31, 18, 11, 0.14);
    --danger: #b84548;
    --success: #2f7b5a;
    --focus-ring: rgba(199, 135, 85, 0.32);
    --max-width: 1120px;
    --font-stack: "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --accent: #c78755;
        --accent-strong: #c78755;
        --accent-soft: rgba(70, 48, 35, 0.62);
        --bg-top: #131114;
        --bg-bottom: #080709;
        --surface: rgba(31, 27, 29, 0.76);
        --surface-strong: rgba(38, 33, 35, 0.9);
        --surface-muted: rgba(24, 20, 22, 0.66);
        --surface-chip: rgba(255, 255, 255, 0.06);
        --text: #f4e2d7;
        --text-soft: #d0bbb0;
        --text-muted: #a78f84;
        --stroke: rgba(233, 200, 181, 0.14);
        --hairline: rgba(255, 255, 255, 0.08);
        --shadow: rgba(0, 0, 0, 0.45);
        --danger: #ff8f88;
        --success: #76c39d;
        --focus-ring: rgba(199, 135, 85, 0.28);
    }
}

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

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--font-stack);
    color: var(--text);
    background: linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
    position: relative;
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button,
a.button,
.nav-link {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(199, 135, 85, 0.08);
}

.skip-link {
    position: absolute;
    left: 16px;
    top: 12px;
    transform: translateY(-150%);
    background: var(--surface-strong);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--stroke);
    z-index: 10;
}

.skip-link:focus-visible {
    transform: translateY(0);
}

.scene-glow {
    position: fixed;
    width: 24rem;
    height: 24rem;
    border-radius: 999px;
    filter: blur(90px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.glow-left {
    left: -8rem;
    top: -10rem;
    background: rgba(199, 135, 85, 0.24);
}

.glow-right {
    right: -6rem;
    top: 4rem;
    background: rgba(255, 255, 255, 0.22);
}

.scene-noise {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.2), transparent 34%),
        linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.10));
    pointer-events: none;
    z-index: 0;
}

.shell {
    position: relative;
    z-index: 1;
    width: min(var(--max-width), calc(100% - 20px));
    margin: 0 auto;
    padding: 12px 0 48px;
}

.content-stack,
.content {
    display: grid;
    gap: 18px;
}

.glass-card {
    background: var(--surface);
    border: 1px solid var(--stroke);
    box-shadow: 0 22px 56px var(--shadow);
    border-radius: 30px;
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    position: relative;
    padding: 20px;
    overflow: hidden;
}

.glass-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid var(--hairline);
    pointer-events: none;
}

.masthead {
    display: grid;
    gap: 18px;
    padding-top: 18px;
}

.masthead-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.wordmark {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-size: clamp(2rem, 6vw, 2.4rem);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-top: 10px;
}

.wordmark-prompt {
    color: #000;
}

.wordmark-book {
    color: var(--wordmark-book);
    font-style: normal;
}

@media (prefers-color-scheme: dark) {
    .wordmark-prompt {
        color: #fff;
    }
}

.identity-chip {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--surface-chip);
    border: 1px solid var(--stroke);
    color: var(--text-soft);
    font-size: 0.92rem;
    font-weight: 600;
    flex: 0 1 min(100%, 24rem);
    max-width: min(100%, 24rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    background: rgba(199, 135, 85, 0.12);
    border: 1px solid rgba(199, 135, 85, 0.15);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.sidebar-copy,
.lead,
.muted-copy {
    color: var(--text-soft);
    line-height: 1.55;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-action {
    margin: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 12px 16px;
    border-radius: 20px;
    background: var(--surface-muted);
    border: 1px solid transparent;
    color: var(--text);
    font-weight: 600;
    transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.nav-link:hover,
.nav-link.active {
    border-color: rgba(199, 135, 85, 0.24);
    background: linear-gradient(180deg, rgba(199, 135, 85, 0.14), rgba(199, 135, 85, 0.08));
    box-shadow: 0 10px 24px rgba(199, 135, 85, 0.10);
}

.hero-card h1 {
    margin: 10px 0 10px;
    font-size: clamp(2rem, 8vw, 3.25rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
    text-wrap: balance;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.stack {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 8px;
}

.field span,
.section-title,
.quota-label {
    color: var(--text-soft);
    font-weight: 700;
}

.section-title {
    margin: 0 0 12px;
    font-size: 1rem;
    line-height: 1.25;
}

.field input {
    width: 100%;
    min-height: 52px;
    padding: 15px 16px;
    border-radius: 18px;
    border: 1px solid var(--stroke);
    background: var(--surface-muted);
    color: var(--text);
}

.field input:disabled,
.field input[readonly] {
    opacity: 0.72;
    cursor: not-allowed;
}

.field input::placeholder {
    color: var(--text-muted);
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 52px;
    padding: 0 18px;
    border-radius: 20px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
    transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.button-compact {
    min-height: 44px;
    padding: 10px 16px;
    flex-shrink: 0;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: white;
    background: linear-gradient(180deg, #c78755, var(--accent-strong));
    box-shadow: 0 16px 30px rgba(199, 135, 85, 0.24);
}

.button-secondary {
    color: var(--text);
    background: var(--surface-muted);
    border-color: var(--stroke);
}

.inline-note {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    color: var(--text-soft);
}

.provider-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.grid {
    display: grid;
    gap: 18px;
}

.two-cols,
.plans-grid,
.quota-grid {
    grid-template-columns: 1fr;
}

.quota-box,
.plan-card {
    background: var(--surface-muted);
    border-radius: 22px;
    border: 1px solid var(--stroke);
    padding: 18px;
    min-width: 0;
}

.history-card {
    background: var(--surface-muted);
    border-radius: 22px;
    border: 1px solid var(--stroke);
    padding: 18px;
}

.quota-box strong,
.plan-price {
    display: block;
    margin-top: 8px;
    font-size: 1.08rem;
}

.kv {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--stroke);
}

.kv:last-of-type {
    border-bottom: 0;
}

.kv span {
    color: var(--text-muted);
}

.kv strong,
.feature-list,
.lead,
.sidebar-copy,
.muted-copy,
.identity-chip {
    min-width: 0;
    overflow-wrap: anywhere;
}

.feature-list {
    margin: 16px 0 0;
    padding-left: 18px;
    color: var(--text-soft);
    line-height: 1.6;
}

.plan-header,
.status-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.plan-title {
    margin-bottom: 0;
}

.plan-note {
    margin-top: 8px;
    max-width: 30ch;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.plan-action {
    margin-top: 22px;
}

.status-pill,
.access-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.86rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-active,
.access-pro,
.access-unlimited {
    color: #f5d76e;
    background: rgba(245, 215, 110, 0.14);
}

.status-pending {
    color: #d9a24d;
    background: rgba(217, 162, 77, 0.14);
}

.status-free,
.status-processing,
.access-free {
    color: var(--text-soft);
    background: rgba(127, 111, 99, 0.12);
}

.status-expired,
.status-failed,
.status-cancelled,
.status-danger {
    color: var(--danger);
    background: rgba(184, 69, 72, 0.12);
}

.plan-active {
    box-shadow: 0 18px 36px rgba(199, 135, 85, 0.16);
}

.banner {
    padding: 16px 18px;
}

.banner.success {
    color: var(--success);
}

.banner.danger {
    color: var(--danger);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
.nav-link:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

input:focus-visible {
    border-color: rgba(199, 135, 85, 0.45);
}

@media (min-width: 860px) {
    .shell {
        width: min(var(--max-width), calc(100% - 32px));
        padding-top: 24px;
    }

    .masthead {
        padding: 22px 24px;
    }

    .content {
        gap: 20px;
    }

    .two-cols {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .plans-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quota-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .scene-glow {
        filter: blur(70px);
    }
}
