/* Tokd — Styles */

:root {
    --bg: #0a0a12;
    --surface: #12121e;
    --surface-hover: #1a1a2a;
    --glass: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255,100,80,0.08);
    --text: #f0ece4;
    --text-dim: rgba(240,236,228,0.5);
    --coral: #ff6450;
    --coral-soft: rgba(255,100,80,0.12);
    --coral-glow: rgba(255,100,80,0.3);
    --accent: #ff6450;
    --accent-soft: rgba(255,100,80,0.12);
    --accent-glow: rgba(255,100,80,0.3);
    --lime: #c8ff00;
    --lime-soft: rgba(200,255,0,0.08);
    --lavender: #a78bfa;
    --lavender-soft: rgba(167,139,250,0.12);
    --green: #4ade80;
    --green-soft: rgba(74,222,128,0.1);
    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, 0.25);
    --yellow: #facc15;
    --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Ambient background gradient */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(255,100,80,0.06) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(200,255,0,0.03) 0%, transparent 50%);
    z-index: -1;
    animation: drift 25s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes drift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-30px, -20px) rotate(2deg); }
}

.container {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.page-container { padding-top: 4rem; }

header { text-align: center; }
header h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; }

.subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    user-select: none;
}

.text-dim { color: var(--text-dim); font-size: 0.8rem; }

/* ── Navigation ──────────────────────────────────────────────────────── */

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    /* relative for nav-center absolute positioning */
    background: rgba(10,10,18,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

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

.nav-brand {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    margin-right: 0.75rem;
}
.nav-logo {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.3px;
}
.nav-logo .dot {
    color: var(--coral);
}

.nav-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
}

.nav-pills {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 100px;
    padding: 4px;
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border-radius: 16px;
    text-decoration: none;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-dim);
    transition: background 0.15s, color 0.15s;
    position: relative;
    white-space: nowrap;
    border: none;
    background: transparent;
    cursor: pointer;
}
.nav-pill:hover {
    color: var(--text);
    background: rgba(255,255,255,0.05);
}
.nav-pill.active {
    background: var(--coral);
    /* Dark text on coral hits 6.16:1 — WCAG AA compliant. White was only
       3.53:1 and failed axe color-contrast (Round 7 Option E). */
    color: #111;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(255,100,80,0.35);
}
.nav-pill svg {
    display: none;
}

.nav-pill-badge {
    /* #dc2626 (Tailwind red-600) hits 5.94:1 on white — WCAG AA compliant
       even at this tiny font size (Round 7 Option E). Was #ef4444 at 4.46. */
    background: #dc2626;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: 2px;
}
.nav-pill-badge:empty { display: none; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-wallet {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.15s;
}
.nav-wallet::before {
    content: '';
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--green);
}
.nav-wallet:hover { color: var(--text); }

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--lavender);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    user-select: none;
}
.nav-avatar:hover { opacity: 0.85; transform: scale(1.05); }

/* Nav dropdown */
.nav-dropdown-wrap { position: relative; }

.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 210px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
}
.nav-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.nav-dropdown-header {
    padding: 0.65rem 0.75rem 0.45rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-dropdown-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.nav-dropdown-tier {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--coral-soft);
    color: var(--coral);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.nav-dropdown-divider { height: 1px; background: var(--border); margin: 3px 8px; }

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.1s, color 0.1s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.nav-dropdown-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.nav-dropdown-item svg { width: 15px; height: 15px; opacity: 0.45; }
.nav-dropdown-item:hover svg { opacity: 0.7; }

.nav-dropdown-setup { color: #ff9f0a; }
.nav-dropdown-setup:hover { color: #ff9f0a; background: rgba(255,159,10,0.08); }

.nav-dropdown-danger { color: rgba(239,68,68,0.8); }
.nav-dropdown-danger:hover { color: #ef4444; background: rgba(239,68,68,0.08); }

/* Legacy nav classes kept for backward compat with landing page */
.nav-link {
    /* Explicit rgba @ 0.72 alpha for stable WCAG AA ≥4.5:1 on nav bg
       (Round 7 Option E). text-dim @ 0.5 was borderline. */
    color: rgba(240,236,228,0.72);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.15s;
}
.nav-link:hover { color: var(--text); }
.nav-link.nav-cta-btn {
    /* Primary CTA pill in the injected top-nav. Coral bg + dark text =
       6.16:1 (Round 7 Option E). */
    padding: 6px 14px;
    background: var(--coral);
    color: #111;
    border-radius: 100px;
    font-weight: 600;
}
.nav-link.nav-cta-btn:hover {
    box-shadow: 0 0 18px var(--coral-glow);
    color: #111;
}

/* ── Hamburger + Mobile Menu ─────────────────────────────────────────── */

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    line-height: 0;
}
.nav-hamburger:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.nav-mobile-menu {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: rgba(10,10,18,0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 99;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav-mobile-menu.open {
    opacity: 1;
    transform: translateY(0);
}

.nav-mobile-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 10px;
    transition: background 0.15s, color 0.15s;
}
.nav-mobile-item:hover,
.nav-mobile-item.active {
    color: var(--text);
    background: rgba(255,255,255,0.06);
}
.nav-mobile-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.5;
    flex-shrink: 0;
}
.nav-mobile-item.active svg { opacity: 0.85; }

.nav-mobile-badge {
    margin-left: 4px;
}

@media (max-width: 768px) {
    .nav-center { display: none; }
    .nav-hamburger { display: flex; }
    .nav-mobile-menu { display: flex; }
}

/* ── Auth Forms ──────────────────────────────────────────────────────── */

.auth-container {
    max-width: 380px;
    padding-top: 4rem;
}

.auth-tabs {
    display: flex;
    gap: 0;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 0.6rem;
    background: var(--bg);
    border: none;
    color: var(--text-dim);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}
.auth-tab.active {
    background: var(--surface);
    color: var(--text);
}

.auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    outline: none;
}
.auth-form input:focus { border-color: var(--accent); }

.auth-error {
    color: var(--red);
    font-size: 0.85rem;
    text-align: center;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn-primary {
    background: var(--accent);
    /* Dark text on coral = 6.16:1 vs white's 3.53:1 (Round 7 Option E). */
    color: #111;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-sm {
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    cursor: pointer;
}
.btn-sm:hover { border-color: var(--text-dim); color: var(--text); }
.btn-sm.btn-primary { background: var(--accent); color: #111; border-color: var(--accent); }
.btn-sm.btn-danger { border-color: var(--red); color: var(--red); }
.btn-sm.btn-danger:hover { background: var(--red); color: #fff; }

/* ── Info Cards ──────────────────────────────────────────────────────── */

.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* ── Settings: API Key Cards ─────────────────────────────────────────── */

.key-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    width: 100%;
    margin-bottom: 0.75rem;
}

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

.key-desc { color: var(--text-dim); font-size: 0.75rem; }

.section-label { font-size: 0.95rem; margin: 1rem 0 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.required-badge { font-size: 0.65rem; padding: 0.15rem 0.4rem; border-radius: 4px; background: rgba(250, 204, 21, 0.15); color: var(--yellow); font-weight: 600; }
.optional-badge { font-size: 0.65rem; padding: 0.15rem 0.4rem; border-radius: 4px; background: rgba(136, 136, 136, 0.15); color: var(--text-dim); font-weight: 600; }

.key-status {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-family: monospace;
}
.key-status.key-set { color: var(--green); }
.key-status.key-default { color: var(--text-dim); }

.key-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.key-input {
    flex: 1;
    background: var(--bg) !important;
    padding: 0.4rem 0.6rem !important;
}

.key-buttons {
    display: flex;
    gap: 0.5rem;
}

/* ── Admin ───────────────────────────────────────────────────────────── */

.admin-page {
    max-width: 600px;
}

.admin-page section {
    width: 100%;
    margin-bottom: 1.5rem;
}

.admin-page h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.user-card { margin-bottom: 0.5rem; }
.user-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}
.user-card-meta { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 0.4rem; }
.user-card-actions { display: flex; gap: 0.5rem; }

.badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--accent-soft);
    color: var(--accent);
}
.badge-dim { background: rgba(255, 255, 255, 0.05); color: var(--text-dim); }
.badge-admin { background: var(--accent); color: #111; }
.badge-active { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.badge-inactive { background: rgba(239, 68, 68, 0.15); color: var(--red); }

.invite-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
}
.invite-code { color: var(--accent); font-size: 0.9rem; }

/* ── Settings Bar (main page) ───────────────────────────────────────── */

.settings-bar {
    width: 100%;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
}

.settings-bar select {
    flex: 1;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}
.settings-bar select:focus { border-color: var(--accent); }
.settings-bar select option { background: var(--surface); color: var(--text); }

.polish-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-dim);
    white-space: nowrap;
    cursor: pointer;
}
.polish-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

#polish-service-row select {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

/* ── Fallback for other pages using .controls ────────────────────────── */

.controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-row label {
    font-size: 0.85rem;
    color: var(--text-dim);
}

select, input[type="password"], input[type="text"], input[type="number"] {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
}

select:focus, input:focus { border-color: var(--accent); }

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ── Mic / Record Button ────────────────────────────────────────────── */

.mic-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.record-btn {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    border: 2px solid var(--glass-border);
    background: var(--glass);
    backdrop-filter: blur(10px);
    color: var(--text);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    position: relative;
}

.record-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 24px;
    border: 1px solid transparent;
    transition: border-color 0.3s;
}

.record-btn:hover {
    border-color: var(--coral);
    box-shadow: 0 0 40px var(--coral-soft);
}
.record-btn:hover::before { border-color: rgba(255,100,80,0.2); }
.record-btn:hover .mic-svg { color: var(--coral); }
.record-btn:active { transform: scale(0.95); }

.record-btn.recording {
    border-color: var(--red);
    box-shadow: 0 0 50px var(--red-glow);
    animation: breathe 2s ease-in-out infinite;
}
.record-btn.recording .mic-svg { color: var(--red); }

.record-btn.processing {
    border-color: var(--yellow);
    box-shadow: 0 0 30px rgba(250, 204, 21, 0.15);
    opacity: 0.8;
    pointer-events: none;
}
.record-btn.processing .mic-svg { color: var(--yellow); animation: spin 1s linear infinite; }

.mic-svg {
    width: 32px;
    height: 32px;
    color: var(--text-dim);
    transition: color 0.3s;
}

#record-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 500;
}

@keyframes breathe {
    0%, 100% { box-shadow: 0 0 30px var(--red-glow); }
    50% { box-shadow: 0 0 60px var(--red-glow); }
}

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

.hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    text-align: center;
}

kbd {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 0.1rem 0.5rem;
    font-size: 0.72rem;
    font-family: inherit;
}

/* ── Status ──────────────────────────────────────────────────────────── */

.status { width: 100%; padding: 0.6rem 1rem; border-radius: 8px; font-size: 0.85rem; text-align: center; }
.status-info { background: var(--accent-soft); color: var(--accent); }
.status-error { background: rgba(239, 68, 68, 0.1); color: var(--red); }
.status-warn { background: rgba(250, 204, 21, 0.1); color: var(--yellow); }

/* ── Result Card ─────────────────────────────────────────────────────── */

.result {
    width: 100%;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.lang-badge, .cost-badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.05);
    color: var(--text-dim);
}

.btn-copy {
    margin-left: auto;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}
.btn-copy:hover { opacity: 0.85; }

.copy-btn { /* alias used in app.js */
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 5px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}
.copy-btn:hover { opacity: 0.85; }
.copy-btn-sm { padding: 4px 12px; font-size: 0.72rem; }

.result-text { font-size: 1.05rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }

/* ── History ─────────────────────────────────────────────────────────── */

.history {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    width: 100%;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 14px 18px;
    transition: background 0.15s;
}
.history-item:hover { background: var(--glass-hover); }

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-meta {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.history-item p {
    font-size: 0.9rem;
    line-height: 1.55;
    color: rgba(240, 240, 245, 0.75);
}

/* ── Nav Queue Badge ─────────────────────────────────────────────────── */

.nav-queue-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    background: var(--lavender);
    color: #fff;
    margin-left: 4px;
    padding: 0 4px;
}
.nav-queue-badge:empty { display: none; }

/* ── Continue Listening Bar ──────────────────────────────────────────── */

.continue-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 40;
    padding: 0 12px 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
}
.continue-bar-inner {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(30, 30, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
}
.continue-bar-inner:hover { background: rgba(40, 40, 55, 0.95); }
.continue-bar-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--coral), var(--lavender));
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.continue-bar-icon svg { width: 16px; height: 16px; fill: #fff; }
.continue-bar-info { flex: 1; min-width: 0; }
.continue-bar-title {
    font-size: 12px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.continue-bar-sub {
    font-size: 11px; color: var(--text-dim); margin-top: 1px;
}
.continue-bar-close {
    background: none; border: none;
    color: var(--text-dim); cursor: pointer;
    padding: 4px; font-family: inherit;
}

/* ── Mobile ──────────────────────────────────────────────────────────── */

@media (max-width: 500px) {
    body { padding: 1rem 0.75rem; }
    .record-btn { width: 100px; height: 100px; }
    .mic-svg { width: 26px; height: 26px; }
    header h1 { font-size: 1.5rem; }
    .settings-bar { flex-direction: column; }
    .settings-bar select { width: 100%; }
    .nav-wallet { font-size: 0.65rem; padding: 4px 8px; }
    .nav-brand { font-size: 0.9rem; }
}

/* ── PWA Install Banner ─────────────────────────────────────────────── */

.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    z-index: 9999;
    padding: 0 16px calc(12px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.pwa-install-banner.visible { transform: translateY(0); }

.pwa-install-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 14px 16px;
    backdrop-filter: blur(20px);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
}
.pwa-install-text strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}
.pwa-install-text span {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

.pwa-install-btn {
    background: var(--coral);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.pwa-install-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    font-family: inherit;
}

/* ── iOS Install Overlay ─────────────────────────────────────────────── */

.pwa-ios-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.pwa-ios-overlay.visible { opacity: 1; }

.pwa-ios-card {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 24px;
    max-width: 340px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.pwa-ios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.pwa-ios-header strong {
    font-size: 18px;
    font-weight: 700;
}
.pwa-ios-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.pwa-ios-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.pwa-ios-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.pwa-ios-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--coral);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-ios-done {
    width: 100%;
}

/* ── Bottom Navigation Bar (mobile PWA) ─────────────────────────────── */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    z-index: 100;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(10, 10, 18, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    align-items: stretch;
    justify-content: space-around;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 3px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    padding: 6px 0;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}
.bottom-nav-item.active {
    color: var(--coral);
}
.bottom-nav-item .bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    background: var(--coral);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.bottom-nav-badge:empty { display: none; }

@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    body { padding-bottom: calc(56px + env(safe-area-inset-bottom) + 1rem); }
}

/* ── iOS Safe Area + Overscroll ──────────────────────────────────────── */

html {
    overscroll-behavior: none;
}
body {
    overscroll-behavior-y: contain;
    padding-top: env(safe-area-inset-top);
}

@media (max-width: 768px) {
    .top-nav {
        padding-top: env(safe-area-inset-top);
    }
}
