:root {
    --bg: #0f1115;
    --surface: #181b21;
    --surface-2: #20242b;
    --border: #2a2e36;
    --text: #e6e8eb;
    --text-muted: #9ca3af;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 10px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

html {
    scroll-behavior: smooth;
}

/* ---- Layout shell ---- */
.shell {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding-inline: 1.25rem;
}

.skip-link {
    position: absolute;
    right: -9999px;
    top: 0;
    z-index: 100;
    background: var(--primary);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
}

.skip-link:focus {
    right: 1rem;
}

/* ---- Header ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(15, 17, 21, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 60px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}

.brand-logo {
    color: var(--primary);
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.15rem;
}

.site-nav {
    display: flex;
    gap: 1.25rem;
}

.site-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.site-nav a:hover {
    color: var(--text);
}

/* ---- Main ---- */
.site-main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding-block: 2.5rem;
}

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.site-footer-inner {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-block: 1.25rem;
    font-size: 0.85rem;
}

.site-footer .brand-name {
    color: var(--text);
}

.card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}

.card.wide {
    max-width: 560px;
}

h1 {
    font-size: 1.4rem;
    margin: 0 0 1.5rem;
    text-align: center;
}

label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0.9rem 0 0.35rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
select {
    width: 100%;
    padding: 0.65rem 0.8rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}

input:focus,
select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

button, .btn {
    display: inline-block;
    text-align: center;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.7rem 1rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

button:hover, .btn:hover {
    background: var(--primary-dark);
}

.btn.secondary {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn.secondary:hover {
    background: var(--border);
}

.btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn.ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid var(--danger);
    color: #fecaca;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.info {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid var(--primary);
    color: #bfdbfe;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.footer-link {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-link a {
    color: var(--primary);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge.trial { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.badge.paid { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.badge.pending { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.badge.expired,
.badge.blocked { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

.field-row {
    margin: 1rem 0;
}

.field-row .value {
    display: flex;
    gap: 0.5rem;
}

.token-box {
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.8rem;
    word-break: break-all;
    flex: 1;
}

.copy-btn {
    width: auto;
    margin-top: 0;
    white-space: nowrap;
}

.paypal-btn {
    background: #ffc439;
    color: #111;
}

.paypal-btn:hover {
    background: #f2b90f;
}

.muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid var(--success);
    color: #bbf7d0;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

textarea {
    width: 100%;
    padding: 0.65rem 0.8rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
}

textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.75rem 0 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.toggle-row:last-child {
    border-bottom: none;
}

.toggle-row input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.2rem;
    accent-color: var(--primary);
}

.toggle-row .toggle-label {
    flex: 1;
    margin: 0;
}

.toggle-row .toggle-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.toggle-row .toggle-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.1rem;
}

.key-status {
    font-size: 0.8rem;
    color: var(--success);
    margin-top: 0.3rem;
}

.key-status.unset {
    color: var(--text-muted);
}

.clear-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.clear-row input[type="checkbox"] {
    accent-color: var(--danger);
}

.clear-row label {
    margin: 0;
}

/* ---- Consent (register) ---- */
.consent-notice {
    margin-top: 1rem;
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-weight: normal;
    color: var(--text);
    margin: 0;
}

.consent-label input[type="checkbox"] {
    margin-top: 0.3rem;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.form-note {
    margin-top: 1.25rem;
}

/* ---- Home: logged-in panel ---- */
.panel {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
}

.status-line {
    margin: 0.75rem 0;
}

/* ---- Home: hero ---- */
.hero {
    width: 100%;
    text-align: center;
    padding-block: 1.5rem 0.5rem;
}

.hero-title {
    font-size: clamp(2.2rem, 7vw, 3.25rem);
    margin: 0 0 1rem;
    text-align: center;
    color: var(--text);
}

.hero-tagline {
    max-width: 42rem;
    margin: 0 auto 1.75rem;
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* ---- Buttons row ---- */
.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.btn-row .btn {
    width: auto;
    margin-top: 0;
    min-width: 170px;
}

/* ---- Home: features ---- */
.features {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.feature-icon {
    display: flex;
    justify-content: center;
    color: var(--primary);
    margin-bottom: 0.85rem;
}

.feature-card h2 {
    font-size: 1.05rem;
    margin: 0 0 0.5rem;
}

.feature-card p {
    margin: 0;
}

/* ---- Home: notice ---- */
.notice {
    width: 100%;
    max-width: 46rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    color: #fcd34d;
    padding: 1rem 1.15rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    text-align: center;
}

/* ---- Error page ---- */
.error-page {
    text-align: center;
    padding-block: 2rem;
}

.error-code {
    font-size: clamp(3.5rem, 14vw, 6rem);
    font-weight: 800;
    line-height: 1;
    margin: 0;
    color: var(--primary);
}

.error-heading {
    font-size: 1.4rem;
    margin: 0.5rem 0 0.75rem;
}

.error-message {
    max-width: 34rem;
    margin: 0 auto 1.5rem;
    font-size: 0.95rem;
}

/* ---- Utilities ---- */
.mt-md {
    margin-top: 1rem;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .site-nav {
        gap: 0.85rem;
    }

    .card,
    .panel {
        padding: 1.5rem;
    }

    .btn-row .btn {
        width: 100%;
    }
}
