:root {
    --trap-green: #53AD6E;
    --dark-bg: #0B0B16;
    --font: "Instrument Sans", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: "Archivo", "Arial Black", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
    --radius: 18px;
    --radius-sm: 12px;
    --header-h: 68px;
    --on: #0C0C17;
}
[data-theme="dark"] {
    /* From the logo: crown green on blue-black ink, mint highlight, forest shadow (docs/trapgod/design.md). */
    --bg: #0B0B16; --surface: #12131F; --text: #EEF3EF; --muted: #A3ABB4;
    --primary: #4AAF6B; --primary-dark: #5FC07F; --accent: #A5D38B;
    --border: rgba(74, 175, 107, 0.22);
    --glow: 0 18px 50px rgba(74, 175, 107, 0.16);
    --hero-grid: rgba(74, 175, 107, 0.07);
    --logo-filter: none;
    --on: #06120B;
}
[data-theme="light"] {
    --bg: #F2F4EF; --surface: #FFFFFF; --text: #10111C; --muted: #4B5560;
    --primary: #23704A; --primary-dark: #1B5C3C; --accent: #277359;
    --border: rgba(39, 115, 89, 0.2);
    --glow: 0 18px 50px rgba(16, 17, 28, 0.08);
    --hero-grid: rgba(39, 115, 89, 0.06);
    --logo-filter: none;
    --on: #ffffff;
}
[data-theme="metal"] {
    --bg: #040407; --surface: linear-gradient(145deg, #111114, #050507); --text: #D0D0D3; --muted: #A1A2A6;
    --primary: #D0D0D3; --primary-dark: #5E5E62; --accent: #53AD6E;
    --border: rgba(208, 208, 211, 0.22);
    --glow: 0 0 35px rgba(208, 208, 211, 0.22);
    --hero-grid: rgba(208, 208, 211, 0.06);
    --logo-filter: none;
    --on: #040407;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
    margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
    line-height: 1.5; min-height: 100vh; overflow-x: clip;
    transition: background 0.35s ease, color 0.25s ease;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 200;
    background: var(--primary); color: #0C0C17; padding: 0.5rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 1rem; }

/* Hallmark pre-emit critique: P4 H4 E4 S4 R4 V4 */
.site-header {
    position: sticky; top: 0; z-index: 100; min-height: var(--header-h);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
[data-theme="metal"] .site-header { background: #0a0a0c; }
.header-inner {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.65rem 0.85rem; padding: 0.7rem 0; min-height: var(--header-h);
}
.brand { display: flex; align-items: center; gap: 0.7rem; min-width: 0; flex: 1 1 9rem; }
.header-actions {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 0.55rem; margin-left: auto; flex: 0 1 auto;
}
.brand-logo-wrap {
    position: relative; width: 44px; height: 44px; flex-shrink: 0;
    display: grid; place-items: center; padding: 7px; box-sizing: border-box;
    border-radius: 12px; border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 72%, var(--surface));
    overflow: hidden;
}
.brand-logo {
    width: 100%; height: 100%; max-width: 100%; max-height: 100%;
    object-fit: contain; object-position: center; filter: none; animation: none;
}
.brand-fallback {
    font-weight: 800; letter-spacing: 0.04em; font-size: 0.72rem; color: var(--text);
    display: none;
}
.brand-logo-wrap.no-img .brand-fallback { display: block; }
.brand-logo-wrap.no-img .brand-logo { display: none; }
.brand-wordmark {
    font-weight: 700; font-size: 1.05rem; letter-spacing: -0.03em;
    color: var(--text); line-height: 1; white-space: nowrap;
}
.brand-tag, .nav-main { display: none; }
.theme-switcher {
    display: flex; align-items: center; gap: 0.15rem; padding: 0.15rem;
    border-radius: 12px; border: 1px solid var(--border); background: var(--bg);
}
[data-theme="metal"] .theme-switcher { background: #111114; }
.theme-btn {
    border: none; cursor: pointer; width: 36px; height: 36px; border-radius: 9px;
    font-size: 0.72rem; font-weight: 700; color: var(--muted); background: transparent;
}
.theme-btn:hover { color: var(--text); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.theme-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-btn[aria-pressed="true"] { color: var(--on); background: var(--primary); }
[data-theme="metal"] .theme-btn[aria-pressed="true"] {
    color: #040407; background: #e4e4e7;
}
a.btn, button.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.55rem 0.9rem; border-radius: 12px; font-weight: 600; font-size: 0.875rem;
    border: 1px solid transparent; cursor: pointer; white-space: nowrap;
    text-decoration: none; line-height: 1.2;
}
a.btn:hover, button.btn:hover { text-decoration: none; }
a.btn-primary, button.btn-primary { background: var(--primary); color: var(--on); }
[data-theme="metal"] a.btn-primary, [data-theme="metal"] button.btn-primary {
    background: #e4e4e7; color: #040407;
}
a.btn-primary:hover, button.btn-primary:hover { background: var(--primary-dark); color: var(--on); }
[data-theme="metal"] a.btn-primary:hover, [data-theme="metal"] button.btn-primary:hover {
    background: #c8c8cc; color: #040407;
}
a.btn:focus-visible, button.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.hero { padding: 1.5rem 0 2.5rem; position: relative; }
.hero-login .wrap { max-width: 440px; }
.auth-card {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem 1.35rem 1.35rem; background: var(--surface);
}
[data-theme="metal"] .auth-card { background: #121216; }
.auth-card h1 {
    margin: 0 0 0.35rem; text-align: left; font-size: 1.7rem; font-weight: 700;
    letter-spacing: -0.03em; font-style: normal; line-height: 1.15;
}
.auth-sub { text-align: left; color: var(--muted); margin: 0 0 1.25rem; font-size: 0.95rem; }
.auth-alert {
    margin: 0 0 1rem; padding: 0.75rem 0.9rem; border-radius: var(--radius-sm);
    border: 1px solid rgba(220, 80, 80, 0.35); background: rgba(220, 80, 80, 0.12);
    color: #f5b5b5; font-size: 0.9rem;
}
[data-theme="light"] .auth-alert { color: #8b1e1e; background: rgba(220, 80, 80, 0.08); }
.tg-ee-sso { align-items: stretch; width: 100%; margin: 0 0 0.25rem; }
.page-login .tg-ee-sso .ee-btn-id { width: 100%; max-width: none; }
a.btn-google-auth {
    display: flex; align-items: center; justify-content: center; gap: 0.65rem;
    width: 100%; padding: 0.75rem 1rem; border-radius: 12px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text);
    font-weight: 600; font-size: 0.92rem; text-decoration: none; margin: 0;
}
a.btn-google-auth:hover { border-color: var(--primary); text-decoration: none; color: var(--text); }
.auth-divider {
    display: flex; align-items: center; gap: 0.75rem;
    color: var(--muted); font-size: 0.78rem; margin: 1.05rem 0 1rem;
}
.auth-divider::before, .auth-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--border);
}
.auth-form-field { margin-bottom: 0.9rem; }
.auth-form-field label {
    display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 0.35rem;
}
.auth-form-field input[type="text"],
.auth-form-field input[type="password"],
.auth-form-field input[type="email"] {
    width: 100%; padding: 0.7rem 0.85rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 75%, transparent);
    color: var(--text); font-size: 1rem;
}
.auth-form-field input:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
.auth-check {
    display: flex; align-items: flex-start; gap: 0.55rem; margin: 0.65rem 0;
    font-size: 0.85rem; color: var(--muted);
}
.auth-check input { margin-top: 0.2rem; }
.auth-check a { color: var(--primary); }
button.auth-submit { width: 100%; margin-top: 0.85rem; padding: 0.8rem 1rem; font-size: 0.95rem; }
.auth-links {
    margin-top: 1.15rem; display: flex; flex-direction: column; gap: 0.4rem;
    text-align: left; font-size: 0.9rem; color: var(--muted);
}
.auth-links p { margin: 0; }
.auth-links a { color: var(--primary); }

.site-footer {
    border-top: 1px solid var(--border); padding: 2.5rem 0; margin-top: 2rem;
    background: color-mix(in srgb, var(--surface) 40%, var(--bg));
}
[data-theme="metal"] .site-footer { background: #040407; }
.footer-grid { display: flex; flex-direction: column; gap: 1.5rem; }
@media (min-width: 640px) {
    .footer-grid { flex-direction: row; justify-content: space-between; align-items: flex-start; }
}
.footer-brand strong { display: block; font-size: 1rem; }
.footer-brand span { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.12em; }
.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: 0.9rem; }
.footer-links a:hover { color: var(--text); }

@media (max-width: 420px) {
    .wrap { padding: 0 0.9rem; }
    .auth-card { padding: 1.2rem 1rem 1.1rem; }
    .brand-wordmark { font-size: 0.98rem; }
    .theme-btn { width: 32px; height: 32px; }
    a.btn-primary { padding: 0.5rem 0.7rem; font-size: 0.8rem; }
}
