/* ============================================================
   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; }

[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);
}
.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1.5px solid var(--danger);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.22s ease;
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    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(8px, 1.5vw, 14px);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}
.landing-header-inner {
    max-width: 1900px;
    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 4px 4px 0;
    border-radius: 10px;
    transition: transform 0.25s ease;
    margin-left: -4px;
}
.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; }
.landing-header-user { display: flex; align-items: center; gap: 12px; }

@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(8px, 1.5vw, 14px);
    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 4px 4px 0;
    border-radius: 10px;
    margin-left: -4px;
}
.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);
}
.wallet-block.readonly .wallet-value { padding-left: 0; border-left: none; }

/* 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 */
.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; margin-left: 0; }
.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 COLORS
   ============================================================ */
.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); }

/* ============================================================
   TOOL — REDESIGN
   ============================================================ */
.tier-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 5px solid var(--tier-color);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}
.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-bar-inline { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; flex: 1 1 auto; }
.tier-bar-inline label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.tier-bar-inline input {
    width: 100px;
    padding: 7px 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: 7px;
    outline: none;
    transition: all 0.2s ease;
}
.tier-bar-inline input:focus { border-color: var(--tier-color); box-shadow: 0 0 0 3px rgba(83, 20, 5, 0.08); }
.tier-bar-inline input::placeholder { color: var(--text-muted); font-style: italic; }

.cat-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 14px;
    overflow-x: auto;
    scrollbar-width: none;
    transition: background-color 0.4s ease;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
    flex: 1 1 0;
    min-width: 140px;
    padding: 11px 14px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.cat-tab:hover { color: var(--text-primary); }
.cat-tab.active { background: var(--bg-elevated); color: var(--text-heading); box-shadow: var(--shadow-sm); }
.cat-tab .cat-star { color: var(--gold); font-size: 0.9rem; line-height: 1; display: none; }
.cat-tab.has-best .cat-star { display: inline; }

.best-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--success-soft);
    border: 1.5px solid rgba(45, 106, 62, 0.35);
    margin-bottom: 14px;
    font-size: 0.88rem;
    color: var(--text-primary);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}
.best-banner.empty { background: var(--bg-secondary); border-color: var(--border); color: var(--text-muted); }
.best-banner .best-label {
    font-weight: 700;
    color: var(--success);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}
.best-banner.empty .best-label { color: var(--text-muted); }
.best-banner .best-desc { font-weight: 500; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.best-banner .best-value {
    font-weight: 700;
    color: var(--success);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.best-banner .best-value .accept-btn { min-width: 26px; min-height: 26px; padding: 0 8px; font-size: 0.85rem; }

.tool-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 14px;
    align-items: start;
}
.inputs-panel,
.results-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: clamp(14px, 2vw, 18px);
    box-shadow: var(--shadow-sm);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}
.panel-title {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.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;
    font-family: 'Inter', sans-serif;
}
.input-group { margin-bottom: 16px; }
.input-group:last-child { margin-bottom: 0; }
.input-group-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 8px;
}
.inputs-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.inputs-row label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.inputs-row 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: 7px;
    outline: none;
    transition: all 0.2s ease;
}
.inputs-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(83, 20, 5, 0.08); }
.inputs-row input::placeholder { color: var(--text-muted); font-style: italic; }

.results-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.results-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.results-table th.right { text-align: right; }
.results-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.results-table tr.group-row td {
    background: var(--bg-secondary);
    padding: 6px 10px;
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: none;
}
.results-table tr.row-best td { background: var(--success-soft); }
.results-table .col-op { font-weight: 500; color: var(--text-primary); }
.results-table .col-value {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.results-table .col-value.positive { color: var(--success); }
.results-table .col-value.negative { color: var(--danger); }
.results-table .col-value.cost { color: var(--primary); }
.results-table .col-action { width: 44px; text-align: right; padding-right: 4px; }

.accept-btn {
    min-width: 28px;
    min-height: 28px;
    padding: 0 8px;
    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.06); }
.accept-btn.flash { background: var(--success); color: #fff; }

/* ============================================================
   NEUMORPHISM (LIGHT MODE ONLY)
   ============================================================ */
[data-theme="light"] .accept-btn,
[data-theme="light"] #saveJsonBtn,
[data-theme="light"] #loadJsonBtn {
    background: var(--bg-primary);
    color: var(--primary);
    border: none;
    box-shadow:
        3px 3px 8px rgba(83, 20, 5, 0.14),
        -3px -3px 8px rgba(255, 255, 255, 0.90);
    transition: box-shadow 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}
[data-theme="light"] .accept-btn:hover,
[data-theme="light"] #saveJsonBtn:hover,
[data-theme="light"] #loadJsonBtn:hover {
    background: var(--bg-primary);
    color: var(--primary-hover);
    box-shadow:
        inset 2px 2px 5px rgba(83, 20, 5, 0.12),
        inset -2px -2px 5px rgba(255, 255, 255, 0.85);
    transform: none;
}
[data-theme="light"] .accept-btn.flash {
    background: var(--bg-primary);
    color: var(--success);
    box-shadow:
        inset 3px 3px 6px rgba(45, 106, 62, 0.20),
        inset -3px -3px 6px rgba(255, 255, 255, 0.70);
}

/* ============================================================
   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;
    text-transform: none;
}
#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;
}

/* Forgot password link */
.auth-forgot-wrap {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 4px;
}
.auth-forgot-link {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}
.auth-forgot-link:hover {
    color: var(--primary-hover);
    text-decoration: none;
    opacity: 0.85;
}
.auth-forgot-link:focus { outline: none; text-decoration: none; }

.auth-back-link {
    background: none;
    border: none;
    padding: 8px 0 0;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
    text-align: center;
    width: 100%;
}
.auth-back-link:hover { color: var(--primary); text-decoration: none; }

/* Reset mode: hide password + forgot link + tabs */
#authModal.reset-mode .auth-tabs,
#authModal.reset-mode #authPasswordLabel,
#authModal.reset-mode #authForgotWrap,
#authModal.reset-mode .google-btn,
#authModal.reset-mode #authDivider { display: none; }
#authModal.reset-mode #authBackLink { display: block; }

/* ============================================================
   PASSWORD INPUT WITH EYE TOGGLE
   ============================================================ */
.pw-wrap {
    position: relative;
    display: block;
    width: 100%;
}
.pw-wrap input {
    width: 100%;
    padding-right: 44px !important;
}
.pw-eye {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.pw-eye:hover {
    color: var(--primary);
    background: var(--bg-secondary);
}
.pw-eye:focus {
    outline: none;
    color: var(--primary);
}
.pw-eye svg {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}
.pw-eye .pw-eye-closed { display: none; }
.pw-eye .pw-eye-open { display: block; }
.pw-eye.is-visible .pw-eye-open { display: none; }
.pw-eye.is-visible .pw-eye-closed { display: block; }

/* ============================================================
   SETTINGS MODAL — EXTENDED
   ============================================================ */
.settings-modal { width: min(100%, 560px); }
.settings-section { padding: 16px 0; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: none; padding-bottom: 0; }
.settings-section:first-of-type { padding-top: 0; }
.settings-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 10px;
}
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.settings-row:last-child { margin-bottom: 0; }
.settings-row-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-row-info strong { font-size: 0.9rem; font-weight: 500; color: var(--text-primary); }
.settings-row-info span { font-size: 0.78rem; color: var(--text-muted); line-height: 1.35; }
.settings-select {
    font-family: inherit;
    font-size: 0.85rem;
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    min-width: 140px;
    transition: border-color 0.2s ease;
}
.settings-select:focus { border-color: var(--primary); }
.settings-danger { border-top: 1px solid rgba(179, 58, 58, 0.25); margin-top: 4px; }
.settings-danger .settings-row { background: var(--danger-soft); border-color: rgba(179, 58, 58, 0.25); }

/* Change password form */
#changePwForm { display: flex; flex-direction: column; gap: 12px; }
#changePwForm 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;
}
#changePwForm 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;
    text-transform: none;
}
#changePwForm input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(83, 20, 5, 0.10); }

/* Change email form */
#changeEmailForm { display: flex; flex-direction: column; gap: 12px; }
#changeEmailForm 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;
}
#changeEmailForm 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;
    text-transform: none;
}
#changeEmailForm input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(83, 20, 5, 0.10); }
#changeEmailForm input[readonly] {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ============================================================
   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; } }

/* ============================================================
   VERIFY EMAIL PAGE + RESET PASSWORD PAGE
   ============================================================ */
.verify-page {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    overflow-y: auto;
    background: var(--bg-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    padding: 40px 16px;
    align-items: center;
    justify-content: center;
    transition: background-color 0.4s ease;
}
.verify-page.visible {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.verify-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    transition: border-color 0.4s ease, background-color 0.4s ease;
}
.verify-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--primary);
    transition: background-color 0.4s ease;
}
.verify-card.is-success::before { background: var(--success); }
.verify-card.is-error::before { background: var(--danger); }

.verify-logo {
    width: 60px;
    height: 40px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.verify-logo svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(255, 0, 0, 0.15));
}

.verify-brand {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    margin-bottom: 32px;
}

.verify-icon-wrap {
    width: 76px;
    height: 76px;
    margin: 0 auto 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--bg-secondary);
    transition: background-color 0.4s ease, transform 0.4s ease;
}
.verify-card.is-success .verify-icon-wrap {
    background: var(--success-soft);
    animation: verifyPop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.verify-card.is-error .verify-icon-wrap {
    background: var(--danger-soft);
    animation: verifyPop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes verifyPop {
    0% { transform: scale(0.85); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.verify-icon {
    width: 36px;
    height: 36px;
    display: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.verify-icon-success { color: var(--success); }
.verify-icon-error { color: var(--danger); }

.verify-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: verifySpin 0.9s linear infinite;
    display: none;
}
@keyframes verifySpin { to { transform: rotate(360deg); } }

.verify-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--text-heading);
    margin: 0 0 12px;
    letter-spacing: 0.02em;
    line-height: 1.25;
}

.verify-message {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 auto 28px;
    max-width: 340px;
}

.verify-actions {
    display: none;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}
.verify-actions.visible { display: flex; }
.verify-actions .btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 0.9rem;
    justify-content: center;
}

/* Reset password form inside verify-card */
.verify-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    margin-top: 8px;
}
.verify-form 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;
}
.verify-form 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;
    text-transform: none;
}
.verify-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(83, 20, 5, 0.10);
}
#resetPasswordPage .verify-message { margin-bottom: 20px; }

/* ============================================================
   RTL SUPPORT (Arabic) — EXTENDED
   ============================================================ */
[dir="rtl"] .sidebar {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    box-shadow: 12px 0 40px rgba(83, 20, 5, 0.12);
}
[dir="rtl"] .sidebar.visible { transform: translateX(0); }
[dir="rtl"] .results-table th,
[dir="rtl"] .results-table td { text-align: right; }
[dir="rtl"] .results-table .col-value,
[dir="rtl"] .results-table th.right { text-align: left; }
[dir="rtl"] .results-table .col-action { text-align: left; padding-left: 4px; padding-right: 0; }
[dir="rtl"] .wallet-value { padding-left: 0; padding-right: 8px; border-left: none; border-right: 1px solid var(--border); }
[dir="rtl"] .landing-header-inner,
[dir="rtl"] .header-inner { flex-direction: row-reverse; }
[dir="rtl"] .brand,
[dir="rtl"] .landing-brand { margin-left: 0; margin-right: -4px; }
[dir="rtl"] .tier-bar { border-left: 1px solid var(--border); border-right: 5px solid var(--tier-color); }

[dir="rtl"] .auth-forgot-wrap { justify-content: flex-start; }
[dir="rtl"] .settings-row { flex-direction: row-reverse; }
[dir="rtl"] .settings-row-info { text-align: right; }
[dir="rtl"] .settings-select { text-align: right; }
[dir="rtl"] .verify-form { text-align: right; }
[dir="rtl"] .verify-form label { text-align: right; }
[dir="rtl"] .auth-hint { text-align: right; }
[dir="rtl"] #changeEmailForm { text-align: right; }
[dir="rtl"] #changeEmailForm label { text-align: right; }
[dir="rtl"] .verify-actions .btn { justify-content: center; }
[dir="rtl"] .modal-header { flex-direction: row-reverse; }
[dir="rtl"] .auth-tabs { flex-direction: row-reverse; }
[dir="rtl"] .auth-back-link { text-align: center; }
[dir="rtl"] .landing-header-actions { flex-direction: row-reverse; }

/* RTL — eye toggle on left side */
[dir="rtl"] .pw-wrap input { padding-right: 12px !important; padding-left: 44px !important; }
[dir="rtl"] .pw-eye { right: auto; left: 8px; }

/* ============================================================
   APP FOOTER
   ============================================================ */
.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); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
    .tool-grid { grid-template-columns: 1fr; }
}
@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); }
    .inputs-row { grid-template-columns: repeat(2, minmax(0, 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-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tier-bar-inline input { width: 80px; }
    .results-table { font-size: 0.8rem; }
    .results-table td { padding: 8px 6px; }
    .results-table th { padding: 6px 6px; }
    .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; }
    .settings-row { flex-direction: column; align-items: stretch; gap: 8px; }
    .settings-select { min-width: 100%; }

    /* Verify page mobile */
    .verify-page { padding: 24px 12px; }
    .verify-card { padding: 36px 22px 32px; border-radius: 16px; }
    .verify-title { font-size: 1.15rem; }
    .verify-icon-wrap { width: 64px; height: 64px; margin-bottom: 20px; }
    .verify-icon { width: 30px; height: 30px; }
    .verify-spinner { width: 30px; height: 30px; }
    .verify-brand { margin-bottom: 24px; font-size: 0.72rem; }
}

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

/* ============================================================
   CAT TABS SIDEBAR — auto-collapsed, expands on hover
   Collapsed: ~64px, shows fragment count
   Hover:     ~230px, shows full category name
   Tabs share the full height of the screen evenly.
   ============================================================ */
.cat-tabs-sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
    width: 64px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 10px 6px;
    display: none;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    z-index: 45;
    transition:
        width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        background-color 0.4s ease,
        border-color 0.4s ease,
        box-shadow 0.35s ease;
}

body.tool-mode .cat-tabs-sidebar {
    display: flex;
}

.cat-tabs-sidebar:hover {
    width: 230px;
    box-shadow: 12px 0 32px rgba(83, 20, 5, 0.12);
}

/* Each tab takes 1/N of the sidebar height */
.cat-tab-v {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    font-family: inherit;
    transition:
        background-color 0.22s ease,
        color 0.22s ease,
        border-color 0.22s ease;
}
.cat-tab-v:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border);
}
.cat-tab-v.active {
    background: var(--primary);
    color: var(--primary-text);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(83, 20, 5, 0.15);
}

/* The two content layers — number (collapsed) and text (hover) */
.cat-tab-v-num,
.cat-tab-v-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.cat-tab-v-num {
    opacity: 1;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: inherit;
}

.cat-tab-v-text {
    opacity: 0;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    color: inherit;
}

/* On hover of the sidebar → fade num out, fade text in */
.cat-tabs-sidebar:hover .cat-tab-v-num { opacity: 0; }
.cat-tabs-sidebar:hover .cat-tab-v-text { opacity: 1; }

/* Star badge for best opportunity */
.cat-tab-v .cat-star {
    position: absolute;
    top: 4px;
    right: 4px;
    color: var(--gold);
    font-size: 0.85rem;
    line-height: 1;
    display: none;
    z-index: 2;
}
.cat-tab-v.active .cat-star { color: var(--primary-text); }
.cat-tab-v.has-best .cat-star { display: inline; }

/* ============================================================
   APP MAIN — offset by the collapsed sidebar
   ============================================================ */
.app-main {
    max-width: 1700px;
    margin: 0 auto;
    padding: clamp(14px, 2.5vw, 24px);
}
body.tool-mode .app-main {
    padding-left: calc(64px + clamp(14px, 2.5vw, 24px));
    transition: padding-left 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ============================================================
   TIER BAR
   ============================================================ */
.tier-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 5px solid var(--tier-color);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}
.tier-bar-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    flex: 1 1 auto;
}
.tier-bar .best-banner {
    flex: 0 1 auto;
    margin: 0;
    min-width: 240px;
    justify-content: flex-end;
}

/* ============================================================
   INPUTS PANEL — Caerleon & BM in the SAME div, visually separated
   ============================================================ */
.inputs-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: clamp(14px, 2vw, 20px);
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
    width: 100%;
}

.inputs-single {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inputs-group-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 0 6px;
}
.caerleon-label { color: #1d6a9e; }
.bm-label { color: #b33a3a; }
[data-theme="dark"] .caerleon-label { color: #5aaae0; }
[data-theme="dark"] .bm-label { color: #e07060; }

.inputs-group-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(29, 106, 158, 0.15);
}
.bm-label .inputs-group-dot {
    box-shadow: 0 0 0 3px rgba(179, 58, 58, 0.15);
}

.inputs-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0 12px;
    position: relative;
}
.inputs-divider::before {
    content: "";
    position: absolute;
    top: -1px; left: 0;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--border-strong) 0%, transparent 100%);
    border-radius: 2px;
}

/* ============================================================
   RESULTS SPLIT — costs left, profits right
   ============================================================ */
.results-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 14px;
    align-items: start;
}
.results-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: clamp(14px, 2vw, 18px);
    box-shadow: var(--shadow-sm);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

/* ============================================================
   NUMBER INPUTS — tabular digits
   ============================================================ */
.tier-bar-inline input[type="text"],
.inputs-row input[type="text"],
#wallet {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    /* Sidebar becomes a horizontal top bar — both number and text visible */
    .cat-tabs-sidebar {
        position: sticky;
        top: 60px;
        left: 0;
        right: 0;
        bottom: auto;
        width: 100%;
        height: auto;
        flex-direction: row;
        padding: 8px 10px;
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid var(--border);
        box-shadow: none;
        scrollbar-width: none;
    }
    .cat-tabs-sidebar::-webkit-scrollbar { display: none; }
    .cat-tabs-sidebar:hover {
        width: 100%;
        box-shadow: none;
    }
    .cat-tab-v {
        flex: 0 0 auto;
        min-width: 140px;
        height: 44px;
    }
    /* On mobile, hide the number and always show the text */
    .cat-tab-v-num { opacity: 0; }
    .cat-tab-v-text { opacity: 1; }

    body.tool-mode .app-main {
        padding-left: clamp(14px, 2.5vw, 24px);
    }
    .results-split { grid-template-columns: 1fr; }
}

/* RTL support */
[dir="rtl"] .cat-tabs-sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border);
}
[dir="rtl"] .cat-tabs-sidebar:hover {
    box-shadow: -12px 0 32px rgba(83, 20, 5, 0.12);
}
[dir="rtl"] body.tool-mode .app-main {
    padding-left: clamp(14px, 2.5vw, 24px);
    padding-right: calc(64px + clamp(14px, 2.5vw, 24px));
}
[dir="rtl"] .tier-bar { border-left: 1px solid var(--border); border-right: 5px solid var(--tier-color); }

@media (max-width: 900px) {
    [dir="rtl"] .cat-tabs-sidebar {
        right: 0; left: 0;
        border-left: none;
        border-bottom: 1px solid var(--border);
    }
    [dir="rtl"] body.tool-mode .app-main {
        padding-right: clamp(14px, 2.5vw, 24px);
    }
}
