/* ============================================================
   THEME VARIABLES
   ============================================================ */
:root {
    --bg-primary: #f5efe2;
    --bg-secondary: #ece3d1;
    --bg-card: #fbf6ec;
    --bg-elevated: #fdf9f0;
    --bg-input: #f2ebdc;
    --glass-bg: rgba(251, 246, 236, 0.88);
    --glass-border: rgba(83, 20, 5, 0.10);
    --text-primary: #2b1a12;
    --text-heading: #1a0e08;
    --text-secondary: #6a5747;
    --text-muted: #9a8774;
    --border: #d8c8b0;
    --border-strong: #b8a48a;
    --primary: #531405;
    --primary-hover: #6a1a08;
    --primary-text: #f5efe2;
    --gold: #b08d4a;
    --gold-soft: #d4b878;
    --success: #2d6a3e;
    --success-soft: #e6f0e6;
    --danger: #b33a3a;
    --danger-soft: #f5e6e6;
    --warning: #c47a1a;
    --shadow-sm: 0 1px 3px rgba(83, 20, 5, 0.06);
    --shadow-md: 0 4px 14px rgba(83, 20, 5, 0.09);
    --shadow-lg: 0 12px 32px rgba(83, 20, 5, 0.13);
    --overlay: rgba(43, 26, 18, 0.55);
    --t4: #1d6a9e;
    --t5: #b33a3a;
    --t6: #b37110;
    --t7: #96720a;
    --t8: #5a4a3a;
    --t4-bg: rgba(29, 106, 158, 0.10);
    --t5-bg: rgba(179, 58, 58, 0.10);
    --t6-bg: rgba(179, 113, 16, 0.10);
    --t7-bg: rgba(150, 114, 10, 0.12);
    --t8-bg: rgba(90, 74, 58, 0.10);
    --ench1-border: #6ee7b7;
    --ench2-border: #4ab4ff;
    --ench3-border: #e07fff;
    --hero-overlay-top: rgba(245, 239, 226, 0.75);
    --hero-overlay-mid: rgba(245, 239, 226, 0.55);
    --hero-overlay-bottom: rgba(245, 239, 226, 0.92);
}

[data-theme="dark"] {
    --bg-primary: #16151a;
    --bg-secondary: #1d1c22;
    --bg-card: #1f1e25;
    --bg-elevated: #26252d;
    --bg-input: #201f26;
    --glass-bg: rgba(31, 30, 37, 0.72);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ebe6dd;
    --text-heading: #f5efe2;
    --text-secondary: #a8a29a;
    --text-muted: #79736d;
    --border: #2f2e37;
    --border-strong: #494852;
    --primary: #c44a2a;
    --primary-hover: #d65b3a;
    --primary-text: #fdf9f0;
    --gold: #d4b566;
    --gold-soft: #8a7040;
    --success: #4aa05a;
    --success-soft: rgba(74, 160, 90, 0.15);
    --danger: #d45a4a;
    --danger-soft: rgba(212, 90, 74, 0.15);
    --warning: #d49a3a;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    --overlay: rgba(0, 0, 0, 0.72);
    --t4: #5aaae0;
    --t5: #e07060;
    --t6: #e0a040;
    --t7: #e0c860;
    --t8: #c8b8a8;
    --t4-bg: rgba(90, 170, 224, 0.14);
    --t5-bg: rgba(224, 112, 96, 0.14);
    --t6-bg: rgba(224, 160, 64, 0.14);
    --t7-bg: rgba(224, 200, 96, 0.14);
    --t8-bg: rgba(200, 184, 168, 0.12);
    --hero-overlay-top: rgba(22, 21, 26, 0.75);
    --hero-overlay-mid: rgba(22, 21, 26, 0.55);
    --hero-overlay-bottom: rgba(22, 21, 26, 0.94);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.4s ease, color 0.4s ease;
}

body.landing-mode {
    overflow: hidden;
}

h1, h2, h3 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

[hidden] {
    display: none !important;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-text);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: var(--primary-text);
    transform: translateY(-1px);
}

.icon-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.icon-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.icon-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================================
   LANDING HEADER
   ============================================================ */
.landing-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    padding: 10px clamp(12px, 2.5vw, 24px);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.landing-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.landing-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 10px;
    transition: transform 0.25s ease;
}
.landing-brand:hover { transform: scale(1.03); }

.landing-brand-logo {
    width: 40px;
    height: 26px;
    flex-shrink: 0;
}
.landing-brand-logo svg {
    width: 100%;
    height: 100%;
    display: block;
}

.landing-brand-name {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-heading);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.landing-header-spacer { flex: 1 1 auto; }

.landing-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 640px) {
    .landing-brand-name { display: none; }
    .landing-header-actions .btn { padding: 8px 12px; font-size: 0.82rem; }
}

/* ============================================================
   APP HEADER
   ============================================================ */
.app-header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    padding: 10px clamp(12px, 2.5vw, 24px);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.header-inner {
    max-width: 1700px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 4px 8px;
    border-radius: 10px;
}
.brand:hover { transform: scale(1.03); }

.brand-logo {
    width: 40px;
    height: 26px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.brand-logo svg {
    width: 100%;
    height: 100%;
    display: block;
}

.brand-name {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-heading);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .brand-name { display: none; }
}

.header-spacer { flex: 1 1 auto; }

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Wallet */
.wallet-block {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.wallet-block:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(176, 141, 74, 0.15);
}
.wallet-icon {
    width: 16px;
    height: 16px;
    color: var(--gold);
    flex-shrink: 0;
}
.wallet-block input {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    width: 90px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    padding: 0;
}
.wallet-value {
    font-weight: 700;
    color: var(--gold);
    font-size: 0.9rem;
    white-space: nowrap;
    padding-left: 8px;
    border-left: 1px solid var(--border);
}

/* Tax */
.tax-block {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.tax-block label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.tax-block input {
    width: 48px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    text-align: right;
}
.tax-unit {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex: 0 0 auto;
    cursor: pointer;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.switch-track {
    position: absolute;
    inset: 0;
    background: var(--border-strong);
    border-radius: 20px;
    transition: background-color 0.25s ease;
}
.switch-track::before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    top: 3px;
    background: var(--bg-elevated);
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.switch input:checked + .switch-track {
    background: var(--primary);
}
.switch input:checked + .switch-track::before {
    transform: translateX(16px);
}

/* Avatar */
.avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, background-color 0.4s ease;
    flex-shrink: 0;
}
.avatar:hover { transform: scale(1.05); }
.avatar::after {
    content: "";
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2.5px solid var(--bg-card);
    background: var(--text-muted);
}
.avatar.status-guest::after { background: var(--warning); }
.avatar.status-connected::after { background: var(--success); }

.auth-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   LANDING - FULLSCREEN SCREENS
   ============================================================ */
#landing {
    position: fixed;
    inset: 0;
    z-index: 10;
    overflow: hidden;
}

.landing-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.landing-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url('background_market.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    transition: background-image 0.4s ease;
}

[data-theme="dark"] .landing-bg::before {
    background-image: url('background_BM.jpg');
}
.landing-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        var(--hero-overlay-top) 0%,
        var(--hero-overlay-mid) 50%,
        var(--hero-overlay-bottom) 100%);
    transition: background 0.4s ease;
}

.screens-container {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px clamp(16px, 4vw, 32px);
    opacity: 0;
    transform: translateY(0);
    pointer-events: none;
    transition:
        opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.screen.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition-delay: 0.15s;
}

.screen.exiting-up {
    opacity: 0;
    transform: translateY(-40px);
    transition-delay: 0s;
}

.screen.exiting-down {
    opacity: 0;
    transform: translateY(40px);
    transition-delay: 0s;
}

.screen.pre-enter-from-below {
    opacity: 0;
    transform: translateY(40px);
    transition: none;
}

.screen.pre-enter-from-above {
    opacity: 0;
    transform: translateY(-40px);
    transition: none;
}

.screen-inner {
    max-width: 1100px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ============================================================
   HERO
   ============================================================ */
.hero-logo {
    width: 100px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    animation: logoFloat 4.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}
.hero-logo svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 4px 14px rgba(255, 0, 0, 0.20));
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.015); }
}

.hero-title {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: clamp(1.9rem, 5vw, 3.2rem);
    color: var(--text-heading);
    margin: 0 0 16px;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.hero-sub {
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    color: var(--text-secondary);
    margin: 0 0 24px;
    max-width: 540px;
    font-weight: 400;
}

.hero-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-hero {
    padding: 14px 30px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 12px;
}
.btn-hero.btn-primary {
    box-shadow: 0 8px 24px rgba(83, 20, 5, 0.30);
}
.btn-hero.btn-primary:hover {
    transform: translateY(-2px);
}

/* ============================================================
   SECTION COMMON
   ============================================================ */
.section-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    color: var(--text-heading);
    text-align: center;
    margin: 0 0 12px;
    letter-spacing: 0.01em;
}

.section-sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 620px;
    margin: 0 auto 40px;
}

/* ============================================================
   FEATURES
   ============================================================ */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    width: 100%;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px 24px;
    box-shadow: var(--shadow-sm);
    transition:
        transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-color 0.35s ease;
    position: relative;
    overflow: hidden;
    text-align: left;
}
.feature-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--gold), var(--primary));
    background-size: 200% 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold-soft);
}
.feature-card:hover::before {
    opacity: 1;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.feature-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--t4-bg);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    transition:
        transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
        background-color 0.35s ease;
}
.feature-card:hover .feature-icon {
    transform: scale(1.12) rotate(-6deg);
    background: var(--primary);
    color: var(--primary-text);
}
.feature-icon svg {
    width: 24px;
    height: 24px;
}

.feature-title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0 0 10px;
}

.feature-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.6;
}

/* ============================================================
   STEPS (HEXAGON)
   ============================================================ */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    width: 100%;
}

.step {
    text-align: center;
    padding: 16px 12px;
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.7s cubic-bezier(0.2, 0.8, 0.2, 1),
        transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.step.animate {
    opacity: 1;
    transform: translateY(0);
}

.step:nth-child(1) { transition-delay: 0.1s; }
.step:nth-child(2) { transition-delay: 0.75s; }
.step:nth-child(3) { transition-delay: 1.4s; }

.step-number {
    position: relative;
    width: 80px;
    height: 92px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.step:hover .step-number { transform: scale(1.06); }

.hex-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.hex-track {
    fill: none;
    stroke: var(--border);
    stroke-width: 2;
    stroke-linejoin: round;
}

.hex-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.step:nth-child(1) .hex-fill { transition-delay: 0.25s; }
.step:nth-child(2) .hex-fill { transition-delay: 0.9s; }
.step:nth-child(3) .hex-fill { transition-delay: 1.55s; }

.step.animate .hex-fill { stroke-dashoffset: 0; }

.step-num-text {
    position: relative;
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    z-index: 1;
}

.step h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0 0 10px;
}

.step p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 0;
}

/* ============================================================
   STATS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 36px;
    width: 100%;
}

.stat-item {
    text-align: center;
    padding: 24px 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    transition:
        transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 0.5s ease,
        border-color 0.6s ease;
}
.stat-item:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

.stat-item.ench-1 {
    border-color: var(--ench1-border);
    box-shadow: 0 0 22px rgba(110, 231, 183, 0.20);
}
.stat-item.ench-2 {
    border-color: var(--ench2-border);
    box-shadow: 0 0 22px rgba(74, 180, 255, 0.22);
}
.stat-item.ench-3 {
    border-color: var(--ench3-border);
    box-shadow: 0 0 22px rgba(224, 127, 255, 0.22);
}

.stat-number {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 900;
    line-height: 1;
    margin: 0 0 10px;
    display: block;
    letter-spacing: -0.02em;
    transition: opacity 0.5s ease, transform 0.5s ease, color 0.6s ease;
}
.stat-number.fading {
    opacity: 0;
    transform: scale(0.85);
}

.stat-number.tier-4 { color: var(--t4); }
.stat-number.tier-5 { color: var(--t5); }
.stat-number.tier-6 { color: var(--t6); }
.stat-number.tier-7 { color: var(--t7); }
.stat-number.tier-8 { color: var(--t8); }

.stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin: 0;
}

/* ============================================================
   FAQ
   ============================================================ */
.faq-list {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    text-align: left;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.faq-item:hover {
    border-color: var(--gold-soft);
    box-shadow: var(--shadow-sm);
}
.faq-item summary {
    cursor: pointer;
    list-style: none;
    padding: 18px 22px;
    font-weight: 600;
    color: var(--text-heading);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: background-color 0.2s ease;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: "+";
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--primary);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.faq-item[open] summary::after {
    transform: rotate(45deg);
}
.faq-item[open] summary {
    background: var(--bg-secondary);
}
.faq-answer {
    padding: 0 22px 20px;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.9rem;
}

/* ============================================================
   CTA
   ============================================================ */
.cta-inner {
    max-width: 640px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: clamp(36px, 5vw, 56px) clamp(24px, 5vw, 44px);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    text-align: center;
}
.cta-inner::before {
    content: "";
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(176, 141, 74, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.cta-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.5rem, 3.2vw, 2rem);
    font-weight: 700;
    color: var(--text-heading);
    margin: 0 0 14px;
    position: relative;
}
.cta-sub {
    color: var(--text-secondary);
    font-size: 0.98rem;
    margin: 0 0 28px;
    line-height: 1.6;
    position: relative;
}
.btn-cta {
    padding: 14px 36px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(83, 20, 5, 0.25);
    position: relative;
}
.btn-cta:hover { transform: translateY(-2px); }

.landing-footer-bar {
    margin-top: 32px;
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.landing-footer-bar a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}
.landing-footer-bar a:hover { color: var(--primary); }
.landing-footer-bar .sep { color: var(--border-strong); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 88vw);
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: -12px 0 40px rgba(83, 20, 5, 0.12);
    z-index: 999;
    transform: translateX(100%);
    transition:
        transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        background-color 0.4s ease,
        border-color 0.4s ease;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    overflow-y: auto;
}
.sidebar.visible { transform: translateX(0); }

.sidebar-profile {
    padding: 24px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}
.sidebar-profile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-profile .brand {
    gap: 8px;
    padding: 0;
    cursor: default;
}
.sidebar-profile .brand-logo {
    width: 34px;
    height: 22px;
}
.sidebar-profile .brand-name { font-size: 0.85rem; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 4px;
}
.sidebar-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
    flex-shrink: 0;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.4s ease;
}
.sidebar-avatar::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid var(--bg-card);
    background: var(--text-muted);
}
.sidebar-avatar.status-guest::after { background: var(--warning); }
.sidebar-avatar.status-connected::after { background: var(--success); }

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-heading);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user-status {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 3px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.status-dot-mini {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.status-dot-mini.guest { background: var(--warning); }
.status-dot-mini.connected { background: var(--success); }

.sidebar-wallet-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.85rem;
}
.sidebar-wallet-mini svg {
    width: 16px;
    height: 16px;
    color: var(--gold);
}
.sidebar-wallet-mini .label {
    color: var(--text-secondary);
    font-weight: 500;
}
.sidebar-wallet-mini .value {
    margin-left: auto;
    font-weight: 700;
    color: var(--gold);
}

.sidebar-menu {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.2s ease, transform 0.15s ease;
}
.menu-item:hover { background: var(--bg-secondary); }
.menu-item .menu-icon {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: color 0.2s ease;
}
.menu-item:hover .menu-icon { color: var(--primary); }
.menu-item .menu-label { flex: 1; }

.menu-item.menu-danger { color: var(--danger); }
.menu-item.menu-danger .menu-icon { color: var(--danger); }
.menu-item.menu-danger:hover { background: var(--danger-soft); }

.menu-item.menu-highlight {
    background: var(--primary);
    color: var(--primary-text);
    transition: background-color 0.4s ease;
}
.menu-item.menu-highlight .menu-icon { color: var(--primary-text); }
.menu-item.menu-highlight:hover { background: var(--primary-hover); }

.menu-item .switch { margin-left: auto; }

.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 14px 6px;
}

.sidebar-footer {
    padding: 18px 22px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.sidebar-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}
.sidebar-footer a:hover { color: var(--primary); }
.sidebar-footer .sep { color: var(--border-strong); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px;
    width: min(100%, 460px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.94) translateY(10px);
    transition:
        transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        background-color 0.4s ease;
    position: relative;
}
.modal-overlay.visible .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-heading);
    margin: 0;
}
.modal-close {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.modal-close svg {
    width: 16px;
    height: 16px;
}

/* ============================================================
   TIER BLOCK
   ============================================================ */
.tier-t4 { --tier-color: var(--t4); --tier-bg: var(--t4-bg); }
.tier-t5 { --tier-color: var(--t5); --tier-bg: var(--t5-bg); }
.tier-t6 { --tier-color: var(--t6); --tier-bg: var(--t6-bg); }
.tier-t7 { --tier-color: var(--t7); --tier-bg: var(--t7-bg); }
.tier-t8 { --tier-color: var(--t8); --tier-bg: var(--t8-bg); }

.tier-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: clamp(16px, 2.2vw, 24px);
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--tier-color);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.tier-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.tier-title {
    flex: 0 0 auto;
    font-family: 'Cinzel', serif;
    font-size: clamp(1.1rem, 3vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--tier-color);
    padding: 8px 18px;
    border-radius: 10px;
    background: var(--tier-bg);
    border: 1.5px solid var(--tier-color);
    min-width: 88px;
    min-height: 44px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.tier-title:hover {
    background: var(--tier-color);
    color: var(--primary-text);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.tier-title::after {
    content: "▾";
    font-size: 0.9rem;
    margin-left: 6px;
    opacity: 0.7;
}

.tier-shared {
    flex: 1 1 320px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
}
.tier-shared label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 110px;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.tier-shared input {
    width: 100%;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
}
.tier-shared input:focus {
    border-color: var(--tier-color);
    box-shadow: 0 0 0 3px rgba(83, 20, 5, 0.08);
}
.tier-shared input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.category-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: clamp(12px, 1.8vw, 16px);
    margin-bottom: 12px;
}
.category-block:last-child { margin-bottom: 0; }

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-heading);
    flex-wrap: wrap;
}
.category-title h3 {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-heading);
}

.frag-badge {
    background: var(--tier-bg);
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.68rem;
    color: var(--tier-color);
    font-weight: 700;
    border: 1px solid var(--tier-color);
    white-space: nowrap;
}

.inputs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 105px), 1fr));
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--border);
}
.inputs-grid label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-weight: 600;
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.inputs-grid input {
    width: 100%;
    padding: 7px 9px;
    font-family: inherit;
    font-size: 0.82rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 7px;
    outline: none;
    transition: all 0.2s ease;
}
.inputs-grid input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(83, 20, 5, 0.08);
}
.inputs-grid input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}
.inputs-grid .divider {
    grid-column: 1 / -1;
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.results-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.results-line-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-top: 4px;
}
.results-line {
    display: grid;
    gap: 8px;
}
.line-costs,
.line-flips,
.line-upgrades-0,
.line-upgrades-1,
.line-upgrades-2 {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
}

.result-item {
    background: var(--bg-input);
    border-radius: 9px;
    padding: 9px 11px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1.5px solid transparent;
    position: relative;
    min-height: 56px;
    justify-content: center;
    transition: all 0.25s ease;
}
.result-item.cost {
    background: var(--t4-bg);
    border-color: rgba(83, 20, 5, 0.18);
}
.result-item.best {
    background: var(--success-soft);
    border-color: rgba(45, 106, 62, 0.45);
    box-shadow: 0 0 0 3px rgba(45, 106, 62, 0.08);
}
.result-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    padding-right: 30px;
    overflow-wrap: anywhere;
}
.result-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.result-value.positive { color: var(--success); }
.result-value.negative { color: var(--danger); }
.result-value.cost { color: var(--primary); }

.accept-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 28px;
    min-height: 28px;
    padding: 0 7px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 7px;
    background: var(--primary);
    color: var(--primary-text);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
}
.accept-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.08);
}
.accept-btn.flash { background: var(--success); }

.app-footer {
    text-align: center;
    padding: 24px 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}
.app-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}
.app-footer a:hover { color: var(--primary); }
.app-footer .sep { color: var(--border-strong); }

/* ============================================================
   TIER POPUP
   ============================================================ */
#tierPopup .modal { width: min(100%, 500px); }
.tier-options {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}
.tier-opt {
    font-family: 'Cinzel', serif;
    padding: clamp(14px, 3.5vw, 18px) 8px;
    font-size: clamp(1rem, 3vw, 1.15rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--tier-color);
    border: 2px solid var(--tier-color);
    min-height: 56px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.tier-opt:hover {
    background: var(--tier-color);
    color: var(--primary-text);
    transform: translateY(-2px);
}
.tier-opt.active {
    background: var(--tier-color);
    color: var(--primary-text);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   AUTH MODAL
   ============================================================ */
#authModal .modal { --tier-color: var(--primary); }

.google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.22s ease;
}
.google-btn:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 10px;
}
.auth-tab {
    flex: 1;
    padding: 9px 10px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 7px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.25s ease;
}
.auth-tab.active {
    background: var(--bg-elevated);
    color: var(--text-heading);
    box-shadow: var(--shadow-sm);
}

#authForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
#authForm label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
#authForm input {
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
}
#authForm input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(83, 20, 5, 0.10);
}

.auth-message {
    font-size: 0.8rem;
    padding: 9px 12px;
    border-radius: 8px;
    display: none;
    line-height: 1.45;
}
.auth-message.error {
    display: block;
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(179, 58, 58, 0.25);
}
.auth-message.success {
    display: block;
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(45, 106, 62, 0.25);
}

.auth-submit {
    padding: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    background: var(--primary);
    color: var(--primary-text);
    border: none;
    border-radius: 9px;
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.22s ease;
}
.auth-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    margin: 14px 0 0;
    line-height: 1.5;
}

/* ============================================================
   LEGAL PAGES
   ============================================================ */
.legal-page {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    z-index: 2000;
    overflow-y: auto;
    font-family: Georgia, 'Times New Roman', 'Cambria', serif;
    line-height: 1.75;
    font-size: 16px;
    transition: background-color 0.4s ease, color 0.4s ease;
}
.legal-page.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

.legal-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 20px clamp(16px, 4vw, 40px);
    position: sticky;
    top: 0;
    z-index: 10;
    transition: background-color 0.4s ease, border-color 0.4s ease;
}
.legal-header-inner {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.legal-brand {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-heading);
}
.legal-brand small {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 2px;
}

.legal-back-btn {
    font-family: 'Inter', sans-serif;
    background: var(--primary);
    color: var(--primary-text);
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.25s ease;
}
.legal-back-btn:hover { background: var(--primary-hover); }

.legal-content {
    max-width: 820px;
    margin: 0 auto;
    padding: clamp(30px, 5vw, 60px) clamp(16px, 4vw, 40px) 80px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    min-height: calc(100vh - 80px);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}
.legal-content h1 {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    color: var(--text-heading);
    margin: 0 0 8px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}
.legal-meta {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    color: var(--text-muted);
    padding-bottom: 24px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
}
.legal-content h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 36px 0 12px;
}
.legal-content h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 10px;
}
.legal-content p {
    margin: 0 0 16px;
    color: var(--text-primary);
}
.legal-content ul {
    margin: 0 0 16px;
    padding-left: 24px;
}
.legal-content li {
    margin-bottom: 6px;
    color: var(--text-primary);
}
.legal-content a {
    color: var(--primary);
    text-decoration: underline;
}
.legal-content strong {
    color: var(--text-heading);
    font-weight: 700;
}
.legal-note {
    background: var(--bg-secondary);
    border-left: 3px solid var(--border-strong);
    padding: 14px 18px;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.92rem;
    transition: background-color 0.4s ease;
}
.legal-footer {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px clamp(16px, 4vw, 40px);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    transition: background-color 0.4s ease;
}
.legal-content details {
    margin: 8px 0;
    border-left: 2px solid var(--border-strong);
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-radius: 4px;
}
.legal-content summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-heading);
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    padding: 4px 0;
    list-style: none;
}
.legal-content summary::-webkit-details-marker { display: none; }
.legal-content summary::before {
    content: "▸ ";
    color: var(--text-muted);
    margin-right: 6px;
    display: inline-block;
    transition: transform 0.2s;
}
.legal-content details[open] summary::before {
    transform: rotate(90deg);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .header-controls { gap: 8px; }
    .wallet-block { padding: 5px 10px; }
    .wallet-value { display: none; }
    .tax-block { padding: 5px 10px; }
    .tax-block label { display: none; }
    .features-grid { grid-template-columns: 1fr; }
    .steps-grid { grid-template-columns: 1fr; gap: 24px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    body { font-size: 13.5px; }
    input[type="number"], input[type="email"], input[type="password"], input[type="text"] {
        font-size: 16px !important;
    }
    .header-inner { gap: 10px; }
    .header-controls { gap: 6px; width: 100%; justify-content: flex-start; }
    .auth-buttons .btn { padding: 8px 12px; font-size: 0.82rem; }
    .brand-logo { width: 32px; height: 22px; }
    .tier-title { width: 100%; }
    .tier-shared { flex: 1 1 100%; }
    .tier-shared label { flex: 1 1 90px; }
    .tier-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .legal-content {
        border-left: none;
        border-right: none;
        padding-left: 20px;
        padding-right: 20px;
    }
    .legal-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .legal-back-btn { width: 100%; justify-content: center; }
    .hero-title { font-size: 1.8rem; }
    .hero-actions { flex-direction: column; width: 100%; max-width: 320px; }
    .btn-hero { width: 100%; }
    .cta-inner { padding: 32px 20px; }
}

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