/* ─ mazleg — Light + Dark mode ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #faf7f2;
    --surface: #f3efe8;
    --surface-hover: #ebe6dd;
    --border: #d4cfc5;
    --text: #1a2e1a;
    --text-muted: #6b7d6b;
    --accent: #2d5a3d;
    --accent-hover: #3a7250;
    --accent-glow: rgba(45, 90, 61, 0.1);
    --green: #3a7250;
    --red: #b5444a;
    --yellow: #8a7232;
    --overlay-bg: rgba(250, 247, 242, 0.92);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

:root.dark {
    --bg: #0f0f13;
    --surface: #1a1a24;
    --surface-hover: #22222f;
    --border: #2a2a3a;
    --text: #e8e8f0;
    --text-muted: #8888a0;
    --accent: #6c63ff;
    --accent-hover: #7b73ff;
    --accent-glow: rgba(108, 99, 255, 0.15);
    --green: #34d399;
    --red: #f87171;
    --yellow: #fbbf24;
    --overlay-bg: rgba(15, 15, 19, 0.88);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 16px;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

.container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
    position: relative;
}

/* ─ Sidebar Toggle Buttons ───────────────────────────────── */
.sidebar-toggles {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-toggle-sidebar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-toggle-sidebar:hover {
    border-color: var(--accent);
    color: var(--text);
}

.sidebar-icon { font-size: 1.05rem; }

/* ─ Star (favorite) ──────────────────────────────────────── */
.star-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.2rem;
    color: var(--text-muted);
    opacity: 0.4;
    transition: all 0.15s;
}

.star-btn:hover { opacity: 0.8; }
.star-btn.active { color: #fbbf24; opacity: 1; }

.star-col { text-align: center; width: 36px; }

/* ─ History Sidebar (collapsible, slides from left) ─────── */
.history-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: left 0.25s ease;
}

.history-sidebar.open { left: 0; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.sidebar-header .btn-close-sidebar {
    padding: 0.15rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
}

.sidebar-header .btn-close-sidebar:hover {
    border-color: var(--accent);
    color: var(--text);
}

.history-sidebar .history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    padding-bottom: 0.75rem;
}

.history-sidebar .history-list::-webkit-scrollbar { width: 4px; }
.history-sidebar .history-list::-webkit-scrollbar-track { background: transparent; }
.history-sidebar .history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.history-item {
    padding: 0.7rem 1rem;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 2px solid transparent;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child { border-bottom: none; }

.history-item:hover {
    background: var(--surface-hover);
    border-left-color: var(--accent);
}

/* Favorite items styling */
.fav-item {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin: 0.3rem 0.4rem;
    margin-bottom: 0.4rem;
    padding: 0.5rem 0.65rem;
    padding-top: 1.4rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    transition: all 0.2s;
    position: relative;
    min-height: 48px;
}

.fav-item:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    transform: translateX(2px);
}

.fav-content {
    flex: 1;
    min-width: 0;
}

.fav-item .history-item-desc {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    display: block;
    margin-bottom: 0.25rem;
}

.fav-tlds {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.fav-tld {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    background: var(--accent-glow);
    color: var(--accent);
    font-family: var(--mono);
    letter-spacing: 0.02em;
}

.fav-item .remove-fav {
    position: absolute;
    top: 4px;
    right: 5px;
    font-size: 0.9rem;
    opacity: 0.2;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--red);
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}

.fav-item .remove-fav:hover {
    opacity: 1;
    background: rgba(181, 68, 74, 0.1);
    border-color: rgba(181, 68, 74, 0.3);
}

.history-item:last-child { border-bottom: none; }

.history-item-header {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.history-item-desc {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.history-sidebar .history-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ─ Top Bar ─────────────────────────────────────────────── */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
}

/* ─ Pricing nav link (top bar) ───────────────────────────── */
.nav-pricing-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
}

.nav-pricing-link:hover {
    color: var(--accent);
}

/* ─ Free-tier quota badge (under Generate button) ────────── */
.quota-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.85rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.quota-badge.exhausted #quota-text {
    color: var(--red);
    font-weight: 600;
}

.quota-upgrade-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.quota-upgrade-link:hover {
    text-decoration: underline;
}

/* ─ Sign In Button (top bar) ─────────────────────────────── */
.btn-sign-in-top {
    padding: 0.45rem 1rem;
    background: var(--accent);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-sign-in-top:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* ─ Auth Modal ───────────────────────────────────────────── */
.auth-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 299;
    backdrop-filter: blur(3px);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 340px;
    width: 90%;
    z-index: 301;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.auth-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.auth-card h2 { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.auth-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.5; }

.btn-modal-sign-in {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.3rem;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    color: #444;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btn-modal-sign-in:hover {
    border-color: #4285F4;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.15);
}

.google-icon { width: 18px; height: 18px; }

.btn-skip-auth {
    display: block;
    margin: 0.85rem auto 0;
    padding: 0.45rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font);
    cursor: pointer;
    transition: color 0.15s;
}

.btn-skip-auth:hover { color: var(--text); }

/* ─ User Menu ────────────────────────────────────────────── */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.65rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}

.user-btn:hover {
    border-color: var(--accent);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

#user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-chevron {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--text-muted);
    margin-left: 0.2rem;
    transition: transform 0.15s;
}

.user-btn.active .user-chevron {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.35rem;
    min-width: 120px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    display: none;
    z-index: 50;
}

.user-dropdown.show { display: block; }

.btn-sign-out-dropdown {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--red);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.btn-sign-out-dropdown:hover {
    background: rgba(181, 68, 74, 0.08);
}

/* ─ Auth Modal ───────────────────────────────────────────── */
.auth-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 299;
    backdrop-filter: blur(4px);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 360px;
    width: 90%;
    z-index: 301;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.auth-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.auth-card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.auth-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.btn-sign-in {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.5rem;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font);
    color: #444;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btn-sign-in:hover {
    border-color: #4285F4;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.15);
}

.google-icon {
    width: 20px;
    height: 20px;
}

.btn-skip-auth {
    display: block;
    margin: 1rem auto 0;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font);
    cursor: pointer;
    transition: color 0.15s;
}

.btn-skip-auth:hover { color: var(--text); }

/* ─ Theme Toggle ─────────────────────────────────────────── */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.5rem;
    line-height: 1;
}

.theme-toggle:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: scale(1.05);
}

.theme-icon::before { content: '🌙'; }
:root.dark .theme-icon::before { display: none; }
:root.dark .theme-icon::after { content: '☀️'; }

/* ─ Header ───────────────────────────────────────────────── */
header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--accent);
}

.logo-img { width: 84px; height: 84px; }
.subtitle { color: var(--text-muted); font-size: 1.1rem; margin-top: 0.35rem; }

/* ─ Form ─────────────────────────────────────────────────── */
.input-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.5rem; color: var(--text); }
.optional { font-weight: 400; color: var(--text-muted); font-size: 0.85rem; }

textarea, input[type="text"] {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.1rem;
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

textarea:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { resize: vertical; min-height: 110px; }
.form-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 200px; }

/* ─ Toggle Switch ────────────────────────────────────────── */
.toggle-group { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0.35rem; }
.toggle-label { margin-bottom: 0 !important; }
.toggle-text { font-weight: 600; font-size: 0.95rem; }

.toggle { position: relative; display: inline-block; width: 48px; height: 26px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 26px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }
.toggle-hint { font-size: 0.8rem; color: var(--text-muted); }

/* ─ Options Sections ─────────────────────────────────────── */
.option-section { margin-bottom: 1.5rem; }
.option-section:last-child { margin-bottom: 0; }

.option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.option-header label { font-weight: 600; font-size: 0.95rem; color: var(--text); }

/* Hide checkboxes */
.option-pill input[type="checkbox"],
.cat-pill input[type="checkbox"] {
    position: absolute; opacity: 0; width: 0; height: 0;
}

.option-pill,
.cat-pill {
    cursor: pointer;
    display: inline-block;
}

.option-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.option-pill .pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.95rem;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 22px;
    transition: all 0.15s;
    user-select: none;
    min-width: 52px;
}

.option-pill .pill-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.15s;
}

.option-pill input:checked + .pill { border-color: var(--accent); background: var(--accent-glow); }
.option-pill input:checked + .pill .pill-label { color: var(--text); font-weight: 700; }
.option-pill:hover .pill { border-color: rgba(45, 90, 61, 0.5); }
:root.dark .option-pill:hover .pill { border-color: rgba(108, 99, 255, 0.5); }

.option-pill .pill-example.remove-tld {
    margin-left: 0.3rem;
    cursor: pointer;
    opacity: 0.4;
    font-size: 0.85rem;
    line-height: 1;
}
.option-pill .pill-example.remove-tld:hover { opacity: 1; }

/* Toggle All button */
.btn-toggle-all {
    padding: 0.35rem 0.8rem;
    background: transparent;
    border: 1.5px solid var(--accent);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}

.btn-toggle-all:hover { background: var(--accent-glow); }
.btn-toggle-all.active { background: var(--accent); color: white; }

/*  Category Pills ───────────────────────────────────────── */
.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.category-header label { font-size: 0.95rem; }

.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.cat-pill { cursor: pointer; }

.cat-pill .pill {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 22px;
    transition: all 0.15s;
    user-select: none;
}

.cat-pill .pill-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.15s;
}

.cat-pill .pill-example {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.15s;
}

.cat-pill input:checked + .pill { border-color: var(--accent); background: var(--accent-glow); }
.cat-pill input:checked + .pill .pill-label { color: var(--text); }
.cat-pill input:checked + .pill .pill-example { opacity: 0.7; }
.cat-pill:hover .pill { border-color: rgba(45, 90, 61, 0.5); }
:root.dark .cat-pill:hover .pill { border-color: rgba(108, 99, 255, 0.5); }

/* ─ Add TLD Row ──────────────────────────────────────────── */
.add-tld-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.add-tld-row input {
    flex: 1;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.85rem;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.add-tld-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-add-tld {
    padding: 0.55rem 1.1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.btn-add-tld:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-add-tld:active { transform: translateY(0); }

/* ─ Submit Button ───────────────────────────────────────── */
.btn-generate {
    width: 100%;
    padding: 0.95rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    margin-top: 0.5rem;
}

.btn-generate:hover { background: var(--accent-hover); }
.btn-generate:active { transform: scale(0.99); }
.btn-generate:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-loading { display: flex; align-items: center; gap: 0.5rem; justify-content: center; }

/* ─ Results Summary ─────────────────────────────────────── */
.results-summary {
    margin-top: 1.75rem;
    display: flex;
    gap: 2rem;
    justify-content: center;
    padding: 1rem;
}

.summary-item { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.summary-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.summary-value { font-size: 1.4rem; font-weight: 700; font-family: var(--mono); color: var(--accent); }

/* ─ Results Panel ───────────────────────────────────────── */
.results-panel {
    margin-top: 1.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.results-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.results-header h2 { font-size: 1.2rem; font-weight: 700; }
.results-filters { display: flex; gap: 0.4rem; }

.filter-btn {
    padding: 0.4rem 0.9rem;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 22px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.filter-hint { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 0.35rem; }

.table-wrapper { max-height: 700px; overflow-y: auto; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrapper::-webkit-scrollbar { width: 6px; }
.table-wrapper::-webkit-scrollbar-track { background: var(--bg); }
.table-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
thead { position: sticky; top: 0; z-index: 1; background: var(--surface); }

th {
    text-align: left;
    padding: 0.85rem 1.1rem;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.tld-col { text-align: center; width: 64px; }
td { padding: 0.75rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: var(--surface-hover); }
td.tld-cell { text-align: center; }

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    background: var(--accent-glow);
    border: 1px solid rgba(45, 90, 61, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
    white-space: nowrap;
}

:root.dark .category-badge { border-color: rgba(108, 99, 255, 0.3); }
.name-cell { font-weight: 600; font-size: 1rem; }

/* ─ TLD Indicators ───────────────────────────────────────── */
.tld-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.8rem;
}

.tld-check.available { background: rgba(58, 114, 80, 0.12); color: var(--green); }
:root.dark .tld-check.available { background: rgba(52, 211, 153, 0.12); }
.tld-check.unavailable { background: rgba(181, 68, 74, 0.08); color: var(--red); opacity: 0.4; }

/* ─ Loading Overlay ─────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(6px);
}

.loading-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2.5rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.loading-spinner {
    width: 52px;
    height: 52px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--accent); }
.loading-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.5rem; }
.loading-subtitle { margin-bottom: 1.25rem !important; }

.progress-bar-container {
    width: 100%;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    text-align: left;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.3s;
}

.step.active { background: var(--accent-glow); color: var(--text); }
.step.done { color: var(--green); }
.step-icon { font-size: 0.75rem; }

.btn-cancel {
    margin-top: 1.5rem;
    width: 100%;
    padding: 0.65rem 1rem;
    background: transparent;
    border: 1.5px solid rgba(181, 68, 74, 0.4);
    border-radius: var(--radius-sm);
    color: var(--red);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-cancel:hover { background: rgba(181, 68, 74, 0.08); border-color: var(--red); }

/* ─ Footer ───────────────────────────────────────────────── */
footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ─ Responsive ───────────────────────────────────────────── */

/* Tablets & large phones */
@media (max-width: 768px) {
    .container { padding: 1.5rem 1.25rem 3rem; }
    header { margin-bottom: 2rem; }
    header h1 { font-size: 2.3rem; gap: 0.5rem; }
    .logo-img { width: 66px; height: 66px; }
    .subtitle { font-size: 1rem; }
    .input-panel { padding: 1.5rem; }
    .form-row { gap: 1.25rem; }
}

/* Phones */
@media (max-width: 640px) {
    .container { padding: 1.25rem 1rem 3rem; }

    /* Header */
    header { margin-bottom: 1.75rem; }
    header h1 { font-size: 2rem; }
    .logo-img { width: 56px; height: 56px; }
    .subtitle { font-size: 0.95rem; }

    /* Top bar — keep controls reachable & tappable */
    .top-bar { gap: 0.5rem; flex-wrap: wrap; }
    .theme-toggle { width: 44px; height: 44px; border-radius: 12px; font-size: 1.3rem; }
    #user-name { max-width: 80px; }

    /* Form */
    .input-panel { padding: 1.25rem; }
    .form-group { margin-bottom: 1.25rem; }
    .form-row { flex-direction: column; gap: 1rem; }
    .flex-1 { min-width: 0; }
    /* Prevent iOS auto-zoom on focus (needs >=16px font) */
    textarea, input[type="text"], .add-tld-row input { font-size: 16px; }
    textarea { min-height: 96px; }

    /* Toggle row sits under keywords, spaced comfortably */
    .toggle-group { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.6rem; }
    .toggle-hint { flex-basis: 100%; }

    /* Options: give pills a touch-friendly size */
    .option-header { flex-wrap: wrap; gap: 0.4rem; }
    .option-pill .pill { padding: 0.55rem 1rem; min-height: 40px; }
    .cat-pill .pill { padding: 0.55rem 0.9rem; min-height: 40px; }
    .add-tld-row input { padding: 0.65rem 0.85rem; }
    .btn-add-tld { padding: 0.65rem 1.1rem; }

    .btn-generate { padding: 1rem 1.5rem; font-size: 1.05rem; }

    /* Results */
    .results-summary { gap: 1.5rem; margin-top: 1.5rem; padding: 0.75rem; }
    .results-header { flex-direction: column; align-items: flex-start; padding: 1.25rem; }
    .results-filters { flex-wrap: wrap; }

    /* Table stays a table but scrolls horizontally when the TLD
       columns don't fit, with tighter cells so it usually does. */
    .table-wrapper { max-height: 65vh; }
    th { padding: 0.7rem 0.75rem; font-size: 0.7rem; }
    td { padding: 0.65rem 0.75rem; }
    .name-cell { font-size: 0.95rem; }
    .category-badge { font-size: 0.72rem; padding: 0.2rem 0.55rem; }
    .tld-col { width: 48px; }
    .star-col { width: 32px; }
    .tld-check { width: 22px; height: 22px; }

    /* Loading card fits small screens */
    .loading-card { padding: 2rem 1.5rem; }
    .loading-card h3 { font-size: 1.1rem; }

    /* Sidebars near full-width for readability */
    .history-sidebar { width: 84vw; max-width: 320px; left: calc(-84vw - 20px); }

    /* Auth modal breathes on small screens */
    .auth-card { padding: 2rem 1.5rem; }
}

/* Small phones */
@media (max-width: 400px) {
    .container { padding: 1rem 0.75rem 2.5rem; }
    header h1 { font-size: 1.75rem; }
    .logo-img { width: 48px; height: 48px; }
    .subtitle { font-size: 0.9rem; }
    .input-panel { padding: 1rem; }
    .sidebar-toggles { gap: 0.4rem; }
    .btn-toggle-sidebar { padding: 0.45rem 0.7rem; font-size: 0.8rem; }
    /* Category examples take too much room on tiny screens */
    .cat-pill .pill-example { display: none; }
    th, td { padding: 0.6rem 0.6rem; }
}

/* Coarse pointers (touch): keep hover-transform surprises away */
@media (hover: none) {
    .fav-item:hover { transform: none; }
    .btn-add-tld:hover, .btn-sign-in-top:hover { transform: none; }
    .theme-toggle:hover { transform: none; }
}
