/* ============================================================
   D4 Builds — Main Stylesheet (Diablo 4 Dark Theme)
   ============================================================ */

/* --- Self-hosted Fonts (GDPR-compliant, no external requests) --- */

/* Old Fenris — Diablo heading font */
@font-face {
    font-family: 'OldFenris';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/old-fenris.woff') format('woff');
}

/* Roboto — used for class names in build editor/view */
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/assets/fonts/roboto-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Alegreya Sans — body font */
@font-face {
    font-family: 'Alegreya Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/alegreya-sans-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Alegreya Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/alegreya-sans-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Alegreya Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/alegreya-sans-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Alegreya Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/alegreya-sans-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- CSS Custom Properties (Theme) --- */
:root {
    /* Backgrounds */
    --bg-primary: #15161a;
    --bg-secondary: #1a1b20;
    --bg-panel: #1A1B1F;
    --bg-panel-hover: #22232a;
    --bg-input: #1F2025;
    --bg-overlay: rgba(0, 0, 0, 0.85);

    /* Accent colors */
    --gold: #a50905;
    --gold-bright: #d40b06;
    --gold-dark: #7a0704;
    --gold-dim: #4e0503;
    --red: #a50905;
    --red-bright: #d40b06;
    --red-dark: #7a0704;
    --red-glow: rgba(165, 9, 5, 0.35);
    --legendary-purple: var(--rarity-legendary, #d98c3c);
    --unique-gold: var(--rarity-unique, #d1a781);
    --mythic-red: var(--rarity-mythic, #c0a1d8);
    --rare-yellow: var(--rarity-rare, #f1f25c);
    --magic-blue: var(--rarity-magic, #6d6ed9);
    --set-green: var(--rarity-set, #00ff7f);

    /* Text */
    --text-primary: #e0ddd5;
    --text-secondary: #a09d94;
    --text-dimmed: #7a7870;
    --text-dark: #4a4840;

    /* Borders */
    --border-color: #2a2a35;
    --border-panel: #252830;
    --border-gold: rgba(196, 162, 78, 0.25);
    --border-hover: #3a3a45;

    /* Functional */
    --success: #4ade80;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Fonts */
    --font-heading: 'OldFenris', 'Times New Roman', serif;
    --font-body: 'Alegreya Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

    /* Sizes */
    --header-height: 64px;
    --max-width: 1280px;
    --border-radius: 4px;
    --border-radius-lg: 8px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Editor-specific (ported from old project) */
    --editor-bg: #1a1a2e;
    --editor-surface: #16213e;
    --editor-surface-hover: #1f2b47;
    --editor-border: #2a3f5f;
    --editor-primary: #a50905;
    --editor-primary-hover: #d40b06;

    /* Rarity Colors — set by ThemeColors (admin), fallbacks only */
    /* --rarity-* variables are injected by ThemeColors::cssVars() in <head> */

    /* Spacing Scale */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Z-Index Layers */
    --z-sticky: 100;
    --z-dropdown: 200;
    --z-modal-backdrop: 1000;
    --z-modal: 1010;
    --z-toast: 2000;
    --z-tooltip: 99999;

    /* Responsive */
    --content-padding: 2rem;
    --modal-height: 650px;
    --tap-target: 44px;
}

/* Responsive Custom Property overrides */
@media (max-width: 768px) {
    :root {
        --content-padding: 0.75rem;
        --modal-height: 85vh;
    }
}
@media (max-width: 480px) {
    :root {
        --content-padding: 0.5rem;
    }
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

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

/* Subtle noise texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(196, 169, 98, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--gold-bright);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* --- Header / Navigation --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, rgba(21, 22, 26, 0.98) 0%, rgba(21, 22, 26, 0.95) 100%);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
}

.header__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.header__logo:hover {
    color: var(--text-primary);
}

.header__logo-d4 {
    color: #c83030;
}

.header__logo-icon {
    height: 28px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    margin-left: -6px;
}

.header__beta-badge {
    background: #000;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 2px 7px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    margin-left: -2px;
    align-self: center;
}

.header__nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
}

.header__nav a {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.header__nav a:hover,
.header__nav a.active {
    color: var(--red-bright);
    background: rgba(165, 9, 5, 0.1);
}

.header__nav-item--disabled {
    padding: 0.5rem 1rem;
    color: var(--text-dimmed);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: default;
    position: relative;
    user-select: none;
}

.header__soon-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    background: #000;
    color: var(--red-bright);
    padding: 1px 5px;
    border-radius: 3px;
    line-height: 1;
    position: absolute;
    top: 2px;
    right: -4px;
}

/* Menu wrapper — flex row on desktop, column dropdown on mobile */
.header__menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}
.header__profile-link {
    position: relative;
}
.header__notif-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; padding: 0 4px;
    font-size: 0.65rem; font-weight: 700; line-height: 1;
    color: #fff; background: #ef4444;
    border-radius: 8px; margin-left: 4px;
    transition: transform 0.2s;
}
.header__notif-badge--pulse {
    animation: notif-pulse 0.6s ease-in-out 3;
}
@keyframes notif-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.35); }
}

/* Hamburger — hidden on desktop */
.header__hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.header__hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: transform 0.25s, opacity 0.25s;
}
/* Animated X when open */
.header--mobile-open .header__hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.header--mobile-open .header__hamburger span:nth-child(2) {
    opacity: 0;
}
.header--mobile-open .header__hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Language Toggle */
.header__lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}
.lang-toggle__link {
    color: var(--text-muted, #7a7870);
    text-decoration: none;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    transition: color 0.15s;
}
.lang-toggle__link:hover {
    color: var(--text-primary, #e0ddd5);
}
.lang-toggle__link--active {
    color: var(--gold, #c4a24e);
    font-weight: 700;
}
.lang-toggle__sep {
    color: var(--border, #2a2a35);
    user-select: none;
}

/* Mobile lang toggle: hidden on desktop, shown on mobile next to hamburger */
.header__lang-toggle--mobile {
    display: none;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1;
}

.btn--primary {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    color: #fff;
    border-color: var(--red);
}

.btn--primary:hover {
    background: linear-gradient(135deg, var(--red-bright) 0%, var(--red) 100%);
    color: #fff;
    box-shadow: 0 0 20px var(--red-glow);
    transform: translateY(-1px);
}

.btn--secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn--secondary:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-panel);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn--ghost:hover {
    color: var(--red-bright);
    background: rgba(165, 9, 5, 0.1);
}

.btn--danger-ghost {
    color: var(--red-bright, #ef4444);
    border-color: transparent;
}

.btn--danger-ghost:hover {
    color: #fff;
    background: var(--red-bright, #ef4444);
}

.btn--sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn--icon {
    padding: 0.35rem;
    line-height: 0;
    background: transparent;
    border: 1px solid var(--border-primary, #2a2a35);
    border-radius: 4px;
    color: var(--text-dimmed, #7a7870);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.btn--icon:hover {
    color: #fff;
    border-color: #ff6b6b;
    background: #ff6b6b;
}

.btn--lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

/* --- Main Content --- */
.main-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* --- Cards / Panels --- */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}

.panel--hover:hover {
    border-color: var(--border-hover);
    background: var(--bg-panel-hover);
}

/* --- Class Selection Grid (Landing Page) --- */
.hero {
    text-align: center;
    padding: 1rem 0;
}

.hero__title {
    font-size: 3rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 40px rgba(165, 9, 5, 0.3);
}

.hero__subtitle {
    font-size: 1.1rem;
    color: var(--text-dimmed);
    max-width: 600px;
    margin: 0 auto 1rem;
}

.class-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    max-width: 900px;
    margin: 0 auto;
}

.class-card {
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
    border-radius: var(--border-radius-lg);
    padding: 2rem 1rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    overflow: hidden;
    text-decoration: none;
}

.class-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 30%, rgba(165, 9, 5, 0.06) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.class-card:hover {
    border-color: var(--gold-dark);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(165, 9, 5, 0.1);
}

.class-card:hover::before {
    opacity: 1;
}

.class-card__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    display: block;
    object-fit: contain;
    transition: all var(--transition-normal);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

/* Class-specific colors — set via inline style --class-color from DB */
.class-card[data-class] {
    background: linear-gradient(to top, color-mix(in srgb, var(--class-color, #1a1a24) 50%, black) 0%, transparent 50%) var(--bg-panel);
}

.class-card__icon--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dimmed);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
}

.class-card:hover .class-card__icon {
    filter: drop-shadow(0 0 12px rgba(165, 9, 5, 0.4));
    transform: scale(1.05);
}

.class-card__name {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.class-card__resource {
    font-size: 0.85rem;
    color: #a8a498;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.65rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--gold-dark);
    box-shadow: 0 0 0 2px rgba(165, 9, 5, 0.15);
}

.form-input::placeholder {
    color: var(--text-dark);
}

.form-input--locked {
    opacity: 0.7;
    cursor: not-allowed;
}

.form-error {
    font-size: 0.8rem;
    color: var(--error);
    margin-top: 0.25rem;
}

/* --- Auth Pages --- */
.auth-container {
    max-width: 400px;
    margin: 4rem auto;
}

.auth-container h2 {
    text-align: center;
    color: var(--gold);
    margin-bottom: 2rem;
}

.auth-container .panel {
    padding: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-dimmed);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.alert--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.alert--success {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: var(--success);
}

/* --- OAuth Buttons --- */
.auth-modal__divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--text-dimmed);
    font-size: 0.8rem;
}
.auth-modal__divider::before,
.auth-modal__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-modal__oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn--oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: #fff;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1;
}
.btn--oauth:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn--oauth img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

.btn--battlenet {
    background: #0074e0;
    border-color: #005bb5;
}
.btn--battlenet:hover {
    background: #0082fc;
}

.btn--twitch {
    background: #9146ff;
    border-color: #7c3bd4;
}
.btn--twitch:hover {
    background: #a366ff;
}

.btn--steam {
    background: #171a21;
    border-color: #2a3040;
}
.btn--steam:hover {
    background: #1e2330;
}

/* Linked accounts on profile page */
.oauth-accounts {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.oauth-account {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.oauth-account__icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.oauth-account__info {
    flex: 1;
    min-width: 0;
}

.oauth-account__provider {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.oauth-account__name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.oauth-account__status {
    font-size: 0.8rem;
    color: var(--text-dimmed);
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    color: var(--text-dark);
    font-size: 0.85rem;
}

.site-footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.site-footer__left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.site-footer__copy {
    color: var(--text-dimmed);
    margin: 0;
}

.site-footer__disclaimer {
    font-size: 0.75rem;
    color: var(--text-dark);
    margin: 0;
}

.site-footer__links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.site-footer__links a {
    color: var(--text-dimmed);
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer__links a:hover {
    color: var(--gold);
}

.site-footer__sep {
    color: var(--text-dark);
}

@media (max-width: 600px) {
    .site-footer__inner {
        flex-direction: column;
        text-align: center;
    }

    .site-footer__links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* --- Legal Pages --- */
.legal-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.legal-page__title {
    color: var(--gold);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.legal-page__content {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    color: var(--text-light);
    line-height: 1.7;
}

.legal-page__content h2 {
    color: var(--gold);
    font-size: 1.2rem;
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.legal-page__content h2:first-child {
    margin-top: 0;
}

.legal-page__content h3 {
    color: var(--text-light);
    font-size: 1rem;
    margin: 1.25rem 0 0.5rem;
}

.legal-page__content p {
    margin: 0.5rem 0;
}

.legal-page__content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.legal-page__content li {
    margin: 0.3rem 0;
}

.legal-page__content a {
    color: var(--gold);
}

.legal-page__content a:hover {
    text-decoration: underline;
}

.legal-page__content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.legal-page__content th,
.legal-page__content td {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.legal-page__content th {
    background: rgba(196, 162, 78, 0.1);
    color: var(--gold);
    font-weight: 600;
}

@media (max-width: 768px) {
    .legal-page {
        padding: 1rem 0.75rem;
    }
    .legal-page__content {
        padding: 1.25rem;
    }
    .legal-page__content table {
        font-size: 0.8rem;
    }
    .legal-page__content th,
    .legal-page__content td {
        padding: 0.4rem 0.5rem;
    }
}

/* --- Cookie Consent Banner --- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    transform: translateY(100%);
    transition: transform 0.35s ease;
}

.cookie-banner--visible {
    transform: translateY(0);
}

.cookie-banner__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.cookie-banner__text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.cookie-banner__text a {
    color: var(--gold);
    text-decoration: underline;
}

.cookie-banner__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .cookie-banner__inner {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    .cookie-banner__actions {
        width: 100%;
        justify-content: center;
    }
}

/* --- Consent Manager (Datenschutz page) --- */
.consent-manager {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.consent-manager__title { margin: 0 0 0.5rem; font-size: 1rem; color: var(--text-primary); }
.consent-manager__status { margin: 0 0 1rem; font-size: 0.875rem; color: var(--text-secondary); }
.consent-manager__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.consent-manager__actions .btn--active { outline: 2px solid var(--gold); outline-offset: 2px; }

/* --- Utility Classes --- */
.text-gold { color: var(--gold); }
.text-dimmed { color: var(--text-dimmed); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* --- Responsive --- */
@media (max-width: 768px) {
    /* Prevent horizontal overflow on whole page */
    html, body {
        overflow-x: hidden;
    }

    .hero__title {
        font-size: 2rem;
    }

    .class-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .class-card {
        padding: 1.25rem 0.75rem 1rem;
    }

    .class-card__icon {
        width: 60px;
        height: 60px;
    }

    /* --- Mobile Hamburger Menu --- */
    .header__inner {
        padding: 0 0.75rem;
    }

    .header__lang-toggle--mobile {
        display: inline-flex;
        order: 2;
        margin-left: auto;
    }

    .header__lang-toggle--desktop {
        display: none;
    }

    .header__beta-badge {
        margin-right: 0;
    }

    .header__hamburger {
        display: flex;
        order: 3;
        flex-shrink: 0;
        margin-left: 0.5rem;
    }

    .header__menu {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: #15161a;
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 0.75rem 1rem 1rem;
        gap: 0.5rem;
        z-index: 99;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
    }

    .header--mobile-open .header__menu {
        display: flex;
    }

    .header__nav {
        display: flex;
        flex-direction: column;
        gap: 0;
        flex: none;
        justify-content: flex-start;
    }

    .header__nav a {
        padding: 0.75rem 0.75rem;
        font-size: 1rem;
        text-align: center;
        border-bottom: 1px solid rgba(42, 42, 53, 0.5);
    }

    .header__nav a:last-child {
        border-bottom: none;
    }

    .header__actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-color);
    }

    .header__actions .btn {
        flex: 1 1 auto;
        min-width: 0;
        text-align: center;
        justify-content: center;
    }

    .site-header {
        position: sticky;
    }
}

@media (max-width: 480px) {
    .class-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero__title {
        font-size: 1.6rem;
    }

    .header__logo span {
        font-size: 0.85rem;
    }
}

/* --- Home: Featured & Top Sections (legacy) --- */
.home-section {
    margin-top: 3rem;
}

.home-section__title {
    font-size: 1.5rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
    margin-bottom: 1.25rem;
    position: relative;
}

.home-section__title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--gold-dark);
    margin: 0.5rem auto 0;
}

.home-section__more {
    text-align: center;
    margin-top: 1.25rem;
}

/* --- Home: Builds Tab System --- */
.home-builds {
    margin-top: 2.5rem;
}

.home-builds__tabs {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color, #2a2a35);
    padding-bottom: 0;
}

.home-builds__tab {
    position: relative;
    background: none;
    border: none;
    color: var(--text-dimmed, #7a7870);
    font-family: var(--font-heading, inherit);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.65rem 1.25rem;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.home-builds__tab:hover {
    color: var(--text-primary, #e0ddd5);
}

.home-builds__tab--active {
    color: var(--gold, #c4a24e);
    border-bottom-color: var(--gold, #c4a24e);
}

.home-builds__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: var(--bg-panel, #13151a);
    border: 1px solid var(--border-panel, #252830);
    border-radius: var(--border-radius-lg, 8px);
    margin-bottom: 1.25rem;
}

.home-builds__loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-dimmed, #7a7870);
}

.home-builds__empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-dimmed, #7a7870);
    font-size: 0.95rem;
}

.home-builds__more {
    text-align: center;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .home-builds__tabs {
        gap: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
    }
    .home-builds__tabs::-webkit-scrollbar { display: none; }

    .home-builds__tab {
        font-size: 0.8rem;
        padding: 0.5rem 0.85rem;
        white-space: nowrap;
    }

    .home-builds__filters {
        padding: 0.65rem 0.85rem;
        gap: 0.5rem;
    }
}

/* --- 404 Page --- */
.page-404 {
    text-align: center;
    padding: 6rem 2rem;
}

.page-404 h1 {
    font-size: 6rem;
    color: var(--gold-dark);
    line-height: 1;
}

.page-404 p {
    color: var(--text-dimmed);
    margin: 1rem 0 2rem;
}

/* --- 500 Page --- */
.page-500 {
    text-align: center;
    padding: 6rem 2rem;
}

.page-500 h1 {
    font-size: 6rem;
    color: #ff6b6b;
    line-height: 1;
}

.page-500 p {
    color: var(--text-dimmed);
    margin: 1rem 0 2rem;
}

.page-500__debug {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    padding: 1rem;
    margin: 1.5rem auto;
    max-width: 600px;
    text-align: left;
    font-size: 0.8rem;
    color: #ff6b6b;
    overflow-x: auto;
    border-radius: 8px;
}

/* --- Breadcrumbs --- */
/* ============ KEYFRAME ANIMATIONS ============ */

@keyframes d4-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes d4-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes d4-slide-down {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes d4-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes d4-glow-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(165, 9, 5, 0.3); }
    50% { box-shadow: 0 0 12px rgba(165, 9, 5, 0.6); }
}

/* Utility animation classes */
.animate-fade-in {
    animation: d4-fade-in 0.3s ease forwards;
}

.animate-slide-up {
    animation: d4-slide-up 0.3s ease forwards;
}

/* Tab content fade transition */
.editor-tab-content {
    animation: none;
}

.editor-tab-content--active {
    animation: d4-fade-in 0.2s ease;
}

/* ============ TOUCH DEVICE ============ */

/* iOS zoom prevention: inputs < 16px trigger auto-zoom on iOS Safari */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Larger touch targets on touch devices */
.touch-device .btn {
    min-height: 44px;
    min-width: 44px;
}

.touch-device .btn--sm {
    min-height: 36px;
}

.touch-device .filter-bar__select,
.touch-device .filter-bar__search {
    min-height: 44px;
    font-size: 1rem;
}

/* Touch-friendly interactive elements */
@media (max-width: 768px) {
    .btn {
        min-height: var(--tap-target);
    }
    .btn--sm {
        min-height: 36px;
    }
}

/* Disable hover effects on touch (avoids sticky hover states) */
@media (hover: none) {
    .btn--primary:hover {
        transform: none;
    }

    .build-card:hover {
        transform: none;
    }
}

/* ============ MOBILE IMPROVEMENTS ============ */

@media (max-width: 576px) {
    body {
        font-size: 15px;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .content-wrap {
        padding: 0.75rem;
    }

    .site-header__inner {
        padding: 0 0.75rem;
    }

    /* Stack navigation vertically on very small screens */
    .site-nav__list {
        gap: 0.25rem;
    }

    .site-nav__link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* ============ TWITCH LIVE BADGE (Header) ============ */

.header__twitch-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(145, 70, 255, 0.15);
    border: 1px solid #9146ff;
    border-radius: 4px;
    color: #d4b8ff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    margin-left: 10px;
    white-space: nowrap;
    line-height: 1;
}

.header__twitch-live:hover {
    background: rgba(145, 70, 255, 0.3);
    box-shadow: 0 0 8px rgba(145, 70, 255, 0.4);
}

.header__twitch-live__dot {
    width: 8px;
    height: 8px;
    background: #eb0400;
    border-radius: 50%;
    animation: twitch-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.header__twitch-live__icon {
    width: 14px;
    height: 14px;
    fill: #9146ff;
    flex-shrink: 0;
}

@keyframes twitch-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ============ TWITCH MINI-PLAYER ============ */

.twitch-player {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 440px;
    z-index: 500;
    background: #0e0e10;
    border: 1px solid #2a2a35;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.twitch-player--expanding {
    transition: width 0.3s ease;
}

.twitch-player--expanded {
    width: 640px;
}

.twitch-player__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #18181b;
    border-bottom: 1px solid #2a2a35;
    border-radius: 8px 8px 0 0;
}

.twitch-player__info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.twitch-player__dot {
    width: 8px;
    height: 8px;
    background: #eb0400;
    border-radius: 50%;
    animation: twitch-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.twitch-player__name {
    color: #d4b8ff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.twitch-player__actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.twitch-player__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: transparent;
    border: none;
    color: #7a7870;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    padding: 0;
}

.twitch-player__btn:hover {
    color: #e0ddd5;
    background: rgba(255, 255, 255, 0.08);
}

.twitch-player__btn svg {
    width: 14px;
    height: 14px;
}

.twitch-player__embed {
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #000;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.twitch-player__embed iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Mobile: hide mini-player, smaller badge */
@media (max-width: 767px) {
    .twitch-player {
        display: none !important;
    }

    .header__twitch-live {
        padding: 3px 6px;
        font-size: 0.65rem;
        margin-left: 6px;
        gap: 4px;
    }

    .header__twitch-live__dot {
        width: 6px;
        height: 6px;
    }

    .header__twitch-live__icon {
        width: 12px;
        height: 12px;
    }
}

/* ============ REDUCED MOTION ============ */

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

/* ---- Bug Report Modal (global) ---- */

.bug-report-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.bug-report-overlay--visible {
    opacity: 1;
    visibility: visible;
}

.bug-report-modal {
    background: var(--bg-secondary, #13151a);
    border: 1px solid var(--border-color, #2a2a35);
    border-radius: 8px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.bug-report-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #2a2a35);
}

.bug-report-modal__title {
    font-family: var(--font-heading);
    color: var(--gold, #c4a24e);
    font-size: 1.1rem;
    margin: 0;
}

.bug-report-modal__close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.bug-report-modal__close:hover {
    color: var(--text-primary);
}

.bug-report-modal__form {
    padding: 1.25rem;
}

.bug-report-modal__field {
    margin-bottom: 1rem;
    position: relative;
}

.bug-report-modal__field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bug-report-modal__field input,
.bug-report-modal__field textarea {
    width: 100%;
    background: var(--bg-primary, #0a0a0f);
    border: 1px solid var(--border-color, #2a2a35);
    border-radius: 4px;
    color: var(--text-primary, #e0ddd5);
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.bug-report-modal__field input:focus,
.bug-report-modal__field textarea:focus {
    outline: none;
    border-color: var(--gold, #c4a24e);
}

.bug-report-modal__url {
    opacity: 0.6;
    cursor: default;
}

.bug-report-modal__counter {
    position: absolute;
    right: 0.5rem;
    bottom: -1.2rem;
    font-size: 0.7rem;
    color: var(--text-dimmed, #7a7870);
}

.bug-report-modal__row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.bug-report-modal__field--grow {
    flex: 1;
    min-width: 0;
}

.bug-report-modal__toggle-group {
    display: flex;
    gap: 0;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid var(--border-color, #2a2a35);
}

.bug-report-modal__toggle {
    flex: 1;
    padding: 0.45rem 0.75rem;
    background: var(--bg-primary, #0a0a0f);
    border: none;
    color: var(--text-secondary, #7a7870);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.bug-report-modal__toggle + .bug-report-modal__toggle {
    border-left: 1px solid var(--border-color, #2a2a35);
}

.bug-report-modal__toggle:hover {
    color: var(--text-primary, #e0ddd5);
    background: rgba(255, 255, 255, 0.05);
}

.bug-report-modal__toggle--active {
    background: var(--gold, #c4a24e);
    color: #fff;
}

.bug-report-modal__toggle--active:hover {
    background: var(--gold, #c4a24e);
    color: #fff;
}

.bug-report-modal__select {
    width: 100%;
    background: var(--bg-primary, #0a0a0f);
    border: 1px solid var(--border-color, #2a2a35);
    border-radius: 5px;
    color: var(--text-primary, #e0ddd5);
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    appearance: auto;
}

.bug-report-modal__select:focus {
    outline: none;
    border-color: var(--gold, #c4a24e);
}

.bug-report-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
