/* ==========================================================================
   CacheYourBrain — site design system (app-shell edition)

   The site behaves like an app: the viewport never scrolls vertically.
   Layout = top bar / content canvas / status bar. Content that exceeds a
   screen flips horizontally between .page panels (js/pager.js) or sits in
   sub-tabs (js/tabs.js). Overflow inside a panel scrolls internally only
   (.page-inner, .workspace-sidebar, .workspace-main).

   Base theme is fixed (dark slate). Only --accent / --accent-glow shift per
   persona; the showcase window is themed via the --w-* variables.
   ========================================================================== */

:root {
    /* Chrome (never re-themed) */
    --bg: #0f172a;
    --bg-raised: #1e293b;
    --bg-sunken: #0b1120;
    --border: #334155;
    --text: #f8fafc;
    --muted: #94a3b8;

    /* Persona-shifting accent (JS overrides these) */
    --accent: #10b981;
    --accent-glow: rgba(16, 185, 129, 0.15);
    --warning: #fbbf24;                    /* form problems the visitor can fix */

    /* Showcase window tokens (JS overrides per persona) */
    --w-bg: #090d16;
    --w-bar: #131924;
    --w-sidebar: #0f1522;
    --w-border: #334155;
    --w-text: #f8fafc;
    --w-muted: #94a3b8;
    --w-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --w-radius: 10px;

    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

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

html, body { height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    line-height: 1.55;
    overflow: hidden;                 /* the page NEVER scrolls */
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); }

/* ==========================================================================
   Top bar (injected by js/chrome.js)
   ========================================================================== */

.top-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.55rem 1.25rem;
    background: var(--bg-sunken);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.top-bar::-webkit-scrollbar { display: none; }

.logo {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    text-decoration: none;
}

.logo em {
    font-style: normal;
    color: var(--accent);
    transition: color 0.3s ease;
}

.top-nav { display: flex; align-items: center; gap: 0.35rem; flex: 1; }

.nav-tab {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 500;
    padding: 0.32rem 0.85rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.2s;
}

.nav-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }

.nav-tab.active {
    color: var(--text);
    font-weight: 600;
    background: var(--accent-glow);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.3s ease, opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }

/* ==========================================================================
   Content canvas + flip pages
   ========================================================================== */

.app-content {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.pages {
    display: flex;
    height: 100%;
    transition: transform 0.45s cubic-bezier(0.22, 0.9, 0.3, 1);
}

.page {
    flex: 0 0 100%;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: clamp(0.75rem, 2vh, 1.5rem) clamp(1rem, 3vw, 2rem);
}

/* The one legal internal scroller for generic page content */
.page-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
}

.page-center { justify-content: center; }

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    margin-bottom: 0.9rem;
    transition: color 0.3s ease;
    flex: 0 0 auto;
}

/* ---- Compact hero (page 1 top strip) ---- */

.hero-compact {
    text-align: center;
    margin: 0.2rem auto 0.9rem auto;
    max-width: 860px;
    flex: 0 0 auto;
    position: relative;
}

.hero-compact::before {
    content: "";
    position: absolute;
    inset: -120% -30%;
    background: radial-gradient(ellipse at 50% 0%, var(--accent-glow), transparent 65%);
    pointer-events: none;
    z-index: -1;
    transition: background 0.4s ease;
}

.hero-compact h1 {
    font-size: clamp(1.35rem, 2.6vw, 2.15rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.35rem;
}

.hero-compact p {
    font-size: clamp(0.85rem, 1.3vw, 1rem);
    color: var(--muted);
}

@media (max-height: 660px) {
    .hero-compact p { display: none; }
}

/* ==========================================================================
   Persona tab bar + "More ▾" dropdown
   ========================================================================== */

.persona-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
    position: relative;
    flex: 0 0 auto;
}

.persona-tab {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: border-color 0.2s, color 0.2s, background 0.3s, box-shadow 0.3s, transform 0.15s;
}

.persona-tab:hover {
    border-color: var(--accent);
    color: var(--text);
    transform: translateY(-1px);
}

.persona-tab.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 4px 14px var(--accent-glow);
}

.more-wrap { position: relative; }

.more-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1.2rem;
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0 2rem;
    min-width: min(620px, 90vw);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    z-index: 50;
    text-align: left;
}

.more-panel.open { display: grid; }

.more-group h5 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin: 0.5rem 0 0.3rem 0;
    transition: color 0.3s ease;
}

.more-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    padding: 0.28rem 0.4rem;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
}

.more-item:hover { background: var(--accent-glow); color: var(--text); }
.more-item.active { color: var(--text); font-weight: 600; }

/* ---- Variant chips (Collectors → Music / Movies / Photos) ---- */

.variant-chips {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    margin-bottom: 0.7rem;
    min-height: 1.7rem;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.variant-chip {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.18rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all 0.2s;
}

.variant-chip:hover { border-color: var(--accent); color: var(--text); }

.variant-chip.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--text);
}

/* ==========================================================================
   Showcase window (the chameleon) — flex-fills its page
   ========================================================================== */

.showcase-window {
    background: var(--w-bg);
    border: 1px solid var(--w-border);
    border-radius: var(--w-radius);
    overflow: hidden;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
    transition: background 0.35s ease, border-color 0.35s ease, border-radius 0.35s ease;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.window-bar {
    background: var(--w-bar);
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--w-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.35s ease, border-color 0.35s ease;
    flex: 0 0 auto;
}

.circles { display: flex; gap: 6px; }
.circle { width: 11px; height: 11px; border-radius: 50%; }
.circle.r { background: #ef4444; opacity: 0.85; }
.circle.y { background: #eab308; opacity: 0.85; }
.circle.g { background: #22c55e; opacity: 0.85; }

.window-title {
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--w-muted);
    transition: color 0.35s ease;
}

.workspace-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    flex: 1 1 auto;
    min-height: 0;
}

.workspace-sidebar {
    background: var(--w-sidebar);
    border-right: 1px solid var(--w-border);
    padding: 1.1rem 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.83rem;
    transition: background 0.35s ease, border-color 0.35s ease;
    overflow-y: auto;                /* internal scroll only */
    min-height: 0;
    scrollbar-width: thin;
}

.workspace-sidebar h4 {
    color: var(--accent);
    margin-bottom: 0.9rem;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: var(--w-font);
    transition: color 0.3s ease;
}

.tree-item {
    padding: 0.28rem 0;
    color: var(--w-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.35s ease;
}
.tree-item.d1 { padding-left: 16px; }
.tree-item.d2 { padding-left: 32px; }
.tree-item.d3 { padding-left: 48px; }

.workspace-main {
    padding: clamp(1rem, 2.5vh, 1.9rem) clamp(1.2rem, 2.5vw, 2.2rem);
    display: flex;
    flex-direction: column;
    font-family: var(--w-font);
    color: var(--w-text);
    transition: color 0.35s ease;
    overflow-y: auto;                /* internal scroll only */
    min-height: 0;
    scrollbar-width: thin;
}

.workspace-main h3 {
    font-size: clamp(1.15rem, 2vw, 1.55rem);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.workspace-main .pitch {
    color: var(--w-muted);
    margin-bottom: 0.8rem;
    font-size: 0.93rem;
    transition: color 0.35s ease;
}

.idea-list {
    list-style: none;
    margin-bottom: 1rem;
    color: var(--w-muted);
    font-size: 0.88rem;
}

.idea-list li { padding: 0.1rem 0; }

.idea-list li::before {
    content: "✔";
    color: var(--accent);
    margin-right: 0.55rem;
    transition: color 0.3s ease;
}

.data-display {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--w-border);
    padding: 0.85rem 1.1rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--w-text);
    overflow-x: auto;
    margin-bottom: 1rem;
    white-space: pre;
    transition: border-color 0.35s ease, color 0.35s ease;
}

@media (max-height: 720px) {
    .data-display { display: none; }   /* protect the height budget */
}

.starter-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 0.55rem 1.2rem;
    border-radius: 6px;
    font-size: 0.86rem;
    font-weight: 700;
    font-family: var(--font-ui);
    text-decoration: none;
    width: fit-content;
    cursor: pointer;
    margin-top: auto;
    transition: background 0.3s ease, opacity 0.15s;
}
.starter-cta:hover { opacity: 0.9; }

/* ==========================================================================
   Cards
   ========================================================================== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: clamp(0.9rem, 2vh, 1.4rem);
    transition: border-color 0.2s, transform 0.15s;
}

.card:hover { border-color: var(--accent); transform: translateY(-2px); }

/* A whole card as one link (the product cards on the company home). Without this
   the anchor's underline runs through every line of the card body. */
a.card {
    display: block;
    text-decoration: none;
    color: inherit;
}
a.card h4 { color: var(--accent); }
a.card:hover h4 { text-decoration: underline; }

/* A product that cannot be clicked yet: present, clearly not ready. */
.card-muted {
    opacity: 0.72;
    border-style: dashed;
}
.card-muted:hover { transform: none; border-color: var(--border); }

/* Route back to the company home from any product page. It lives in the status
   bar because the top bar is fixed-height window chrome: a seventh nav item
   pushes the "Get the App" button off the right edge. */
.status-company {
    color: var(--muted);
    text-decoration: none;
    border-right: 1px solid var(--border);
    padding-right: 0.6rem;
    margin-right: 0.15rem;
}
.status-company:hover { color: var(--accent); }

/* ---- Newsletter signup (js/newsletter.js) ---- */
.newsletter {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: clamp(0.9rem, 2vh, 1.3rem);
    max-width: 34rem;
    margin: 0 auto 1rem;
    text-align: left;
}
.newsletter h4 { margin: 0 0 0.25rem; }
.newsletter .meta { margin: 0 0 0.8rem; }

.newsletter-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.newsletter-row input[type="email"] {
    flex: 1 1 14rem;
    min-width: 0;                    /* a flex item will not shrink below its content without this */
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    padding: 0.5rem 0.7rem;
}
.newsletter-row input[type="email"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.newsletter-row button {
    background: var(--accent);
    color: var(--bg);
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 700;
    padding: 0.5rem 1.1rem;
    cursor: pointer;
}
.newsletter-row button:disabled { opacity: 0.6; cursor: default; }

/* The checkbox is never pre-ticked: a pre-ticked box is not consent, and the
   service refuses a signup without it (Docs/103). */
.newsletter-consent {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-top: 0.7rem;
    font-size: 0.82rem;
    color: var(--muted);
    cursor: pointer;
}
.newsletter-consent input { margin-top: 0.22rem; flex: 0 0 auto; }

.newsletter-bot:not(:empty) { margin-top: 0.7rem; }

.newsletter-msg { margin: 0.7rem 0 0; font-size: 0.85rem; min-height: 1.2em; }
.newsletter-msg.ok { color: var(--accent); }
.newsletter-msg.warn { color: var(--warning); }

.card .card-icon { font-size: 1.45rem; margin-bottom: 0.4rem; }
.card h4 { font-size: 1rem; margin-bottom: 0.3rem; }
.card p { color: var(--muted); font-size: 0.87rem; }

.card a.card-link {
    display: inline-block;
    margin-top: 0.6rem;
    font-size: 0.83rem;
    font-weight: 600;
    text-decoration: none;
}

.mini-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    color: var(--accent);
    margin: 1.4rem 0 0.7rem 0;
    transition: color 0.3s ease;
}
.mini-title:first-child { margin-top: 0; }

.page-tagline {
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
    max-width: 720px;
    margin: 0 auto 1.4rem auto;
}

/* ==========================================================================
   Sub-tabs (content pages: Downloads, Community, Gallery, FAQ)
   ========================================================================== */

.page-head {
    text-align: center;
    margin: 0.4rem auto 1rem auto;
    max-width: 760px;
    flex: 0 0 auto;
}
.page-head h1 { font-size: clamp(1.3rem, 2.4vw, 1.9rem); letter-spacing: -0.02em; margin-bottom: 0.3rem; }
.page-head p { color: var(--muted); font-size: 0.92rem; }

.subtabs {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    flex: 0 0 auto;
}

.subtab {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.4rem 1.1rem;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all 0.2s;
}

.subtab:hover { border-color: var(--accent); color: var(--text); }

.subtab.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--text);
}

/* The legal pages use real links rather than buttons: Paddle reviews distinct
   terms / refund / privacy URLs, and Google OAuth verification wants a stable
   privacy URL, neither of which a #tab= fragment can provide. An anchor needs
   the button's shape handing back to it. */
a.subtab {
    display: inline-block;
    text-decoration: none;
}

.subtab-panel {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;                /* internal scroll only */
    scrollbar-width: thin;
}
.subtab-panel.active { display: block; }

.stub-note {
    max-width: 760px;
    margin: 0 auto;
    background: var(--bg-raised);
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 1.2rem 1.6rem;
    color: var(--muted);
    font-size: 0.92rem;
}
.stub-note ul { margin: 0.5rem 0 0 1.2rem; }

/* ==========================================================================
   Status bar (injected by js/chrome.js)
   ========================================================================== */

.status-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.3rem 1.25rem;
    background: var(--bg-sunken);
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
}

.status-left { display: flex; align-items: center; gap: 0.5rem; overflow: hidden; text-overflow: ellipsis; }
.status-dot { color: #22c55e; font-size: 0.6rem; }

.status-center {
    flex: 1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
}

.pager { display: flex; align-items: center; gap: 0.55rem; }

.pager-arrow {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 22px;
    height: 22px;
    line-height: 1;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: all 0.15s;
}
.pager-arrow:hover { border-color: var(--accent); color: var(--text); }
.pager-arrow:disabled { opacity: 0.3; cursor: default; }

.pager-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
}
.pager-dot.active { background: var(--accent); transform: scale(1.25); }

/* ==========================================================================
   Phase 2 components — lists, badges, accordion, forms, toast
   ========================================================================== */

.list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-width: 880px;
    margin: 0 auto;
    width: 100%;
}

.row {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1.1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: border-color 0.15s;
    text-align: left;
}

.row.clickable { cursor: pointer; }
.row.clickable:hover { border-color: var(--accent); }

.row-main { flex: 1; min-width: 0; }
.row h4 { font-size: 0.95rem; margin-bottom: 0.1rem; }
.row .excerpt {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta { font-size: 0.76rem; color: var(--muted); }
.meta b { color: var(--text); font-weight: 600; }

.badge {
    font-size: 0.66rem;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    border: 1px solid currentColor;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    white-space: nowrap;
}
.badge.planned     { color: #38bdf8; }
.badge.building    { color: #f59e0b; }
.badge.shipped     { color: #22c55e; }
.badge.considering { color: var(--muted); }
.badge.latest      { color: var(--accent); }

.tag-pill {
    display: inline-block;
    font-size: 0.68rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.04rem 0.5rem;
    color: var(--muted);
    margin-right: 0.25rem;
}

.vote-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.25rem 0.65rem;
    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.25;
}
.vote-btn:hover { border-color: var(--accent); color: var(--text); }
.vote-btn.voted { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

/* Toolbar (search + filter chips) */
.toolbar {
    display: flex;
    gap: 0.55rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.search-input {
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    width: min(320px, 100%);
    outline: none;
    transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--muted); }

.filter-chip {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.22rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--accent); color: var(--text); }
.filter-chip.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--text);
}

/* Accordion (FAQ) */
.accordion { max-width: 820px; margin: 0 auto; width: 100%; }

.accordion-item {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.accordion-q {
    width: 100%;
    background: none;
    border: none;
    color: var(--text);
    padding: 0.7rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.92rem;
    text-align: left;
}

.accordion-q .chev { color: var(--muted); transition: transform 0.2s; }
.accordion-item.open .accordion-q .chev { transform: rotate(90deg); color: var(--accent); }

.accordion-a {
    display: none;
    padding: 0 1rem 0.9rem 1rem;
    color: var(--muted);
    font-size: 0.88rem;
}
.accordion-item.open .accordion-a { display: block; }
.accordion-item.open { border-color: var(--accent); }

/* Detail views (blog article, discussion thread) */
.back-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.3rem 0.9rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    margin-bottom: 0.9rem;
    transition: all 0.15s;
}
.back-btn:hover { border-color: var(--accent); color: var(--text); }

.detail { max-width: 780px; margin: 0 auto; width: 100%; }
.detail h2 { font-size: 1.35rem; letter-spacing: -0.02em; margin-bottom: 0.25rem; }
.detail .meta { margin-bottom: 1rem; }
.detail-body p { margin-bottom: 0.85rem; color: #cbd5e1; font-size: 0.93rem; }

.reply {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.55rem;
}
.reply .meta { margin-bottom: 0.25rem; }
.reply p { font-size: 0.88rem; color: #cbd5e1; }

.reply-box {
    width: 100%;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    padding: 0.6rem 0.9rem;
    resize: vertical;
    min-height: 70px;
    outline: none;
    margin: 0.6rem 0;
}
.reply-box:focus { border-color: var(--accent); }

/* Upload / generic form */
.form { max-width: 560px; margin: 0 auto; width: 100%; }
.field { margin-bottom: 0.9rem; }
.field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.25rem;
}
.field input, .field textarea {
    width: 100%;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem;
    outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }

/* Highlighted release card */
.release-hero {
    max-width: 880px;
    margin: 0 auto 1rem auto;
    width: 100%;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 1.1rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.release-hero .row-main h4 { font-size: 1.05rem; }

.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.38rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.84rem;
    cursor: pointer;
    font-family: var(--font-ui);
    white-space: nowrap;
    transition: background 0.15s, color 0.3s ease, border-color 0.3s ease;
}
.btn-secondary:hover { background: var(--accent-glow); }

.form-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    max-width: 880px;
    margin: 0 auto 0.9rem auto;
    width: 100%;
}

.badge.local { color: #c084fc; }

/* ---- Auth modal + account chip (Phase 5) ---- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 16, 0.72);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.modal {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.6rem 1.8rem;
    width: min(400px, 92vw);
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

.modal h3 { margin-bottom: 1rem; font-size: 1.2rem; letter-spacing: -0.02em; }

.modal-close {
    position: absolute;
    top: 0.7rem;
    right: 0.85rem;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.95rem;
}
.modal-close:hover { color: var(--text); }

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    background: #ffffff;
    color: #1f2937;
    border-radius: 6px;
    padding: 0.55rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}
.btn-google:hover { opacity: 0.92; }
.g-mark { font-weight: 800; color: #4285f4; }

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

.auth-links {
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 0.9rem;
}
.auth-links a { color: var(--accent); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.5rem; }
.pw-eye {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.25rem;
    opacity: 0.75;
}
.pw-eye:hover { opacity: 1; }

.account-area { position: relative; white-space: nowrap; }

.user-chip {
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    color: var(--text);
    border-radius: 999px;
    padding: 0.32rem 0.9rem;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.user-menu {
    /* fixed: the top bar is a scroll container (overflow-x) and would clip
       an absolutely-positioned dropdown; JS anchors this to the chip */
    position: fixed;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem;
    min-width: 230px;
    z-index: 250;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    display: none;
    text-align: left;
}
.user-menu.open { display: block; }
.user-menu .meta { padding: 0.3rem 0.5rem 0.5rem 0.5rem; line-height: 1.5; }
.user-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--muted);
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.85rem;
}
.user-menu button:hover { background: var(--accent-glow); color: var(--text); }

/* Toast (bottom-right, above the status bar) */
.toast {
    position: fixed;
    right: 1rem;
    bottom: 2.8rem;
    background: var(--bg-raised);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.55rem 1rem;
    font-size: 0.82rem;
    color: var(--text);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    transform: translateY(6px);
    max-width: min(360px, 90vw);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   Small screens — panels scroll inside; the page still never scrolls
   ========================================================================== */

@media (max-width: 840px) {
    .workspace-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .workspace-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--w-border);
        max-height: 32%;
    }
    .top-nav .nav-external { display: none; }
    .status-center { display: none; }
}
