/* ============================================================
   SnapGPT — AI Live Notes
   Same visual system as Chat / Study: dark ground, Geist with
   Geist Mono for timestamps, one red accent, hairline borders,
   solid colors. Layout mirrors the reference note workspace:
   app sidebar + header bar + (recorder/transcripts | notes | ask).
   ============================================================ */

:root {
    --sidebar-w: 260px;
    --sidebar-collapsed-w: 52px;
    --sidebar-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --navbar-h: 52px;

    --bg: #0f0f11;
    --sidebar-bg: #0a0a0c;
    --text-1: #fafafa;
    --text-2: rgba(255, 255, 255, 0.6);
    --text-3: rgba(255, 255, 255, 0.4);
    --disabled: rgba(255, 255, 255, 0.22);
    --primary: #ff4a36;
    --primary-hover: #ff5e4a;
    --accent-soft: rgba(255, 74, 54, 0.1);
    --accent-line: rgba(255, 74, 54, 0.4);
    --secondary: rgba(255, 255, 255, 0.1);
    --tertiary: rgba(255, 255, 255, 0.05);
    --hover: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-2: rgba(255, 255, 255, 0.12);
    --input-bg: #1a1a1e;
    --divider: rgba(255, 255, 255, 0.08);
    --panel: #1a1a1e;
    --canvas: rgba(255, 255, 255, 0.04);
    --rec-border: rgba(255, 255, 255, 0.1);
    --rec-bg: #141418;
    --record-btn: #ff4a36;
    --format-bg: #1a1a1e;
    --upgrade: #ff4a36;
    --wave-idle: rgba(255, 255, 255, 0.18);
    --scroll-thumb: rgba(255, 255, 255, 0.12);
    --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}


* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
::selection { background: var(--primary); color: #fff; }

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.01em;
    background: var(--bg);
    color: var(--text-1);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
svg { flex-shrink: 0; display: block; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; }

.app { height: 100%; }

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-2);
    flex-shrink: 0;
}
.action-btn:hover { background: var(--hover); color: var(--text-1); }

/* ============================================================
   Main
   ============================================================ */

.note-app { height: 100%; width: 100%; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

/* ---------- Landing ---------- */
.ai-note-home {
    position: relative;
    display: flex;
    height: 100%;
    width: 100%;
    flex-direction: column;
    align-items: center;
    overflow: auto;
    padding: 100px 60px 60px;
}

/* Backdrop: one soft brand wash at the top that fades into the page. */
.home-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 70% 55% at 50% -10%, rgba(255, 74, 54, 0.16) 0%, rgba(255, 74, 54, 0.05) 45%, transparent 75%);
}

.home-inner { position: relative; z-index: 1; width: 100%; max-width: 880px; display: flex; flex-direction: column; align-items: center; }

.home-title { font-size: 38px; font-weight: 700; line-height: 1.12; letter-spacing: -0.035em; text-align: center; }
.home-subtitle { margin-top: 10px; font-size: 16px; color: var(--text-2); text-align: center; max-width: 440px; }

/* Start button: brand gradient pill with a live five-bar audio glyph */
.start-note-button {
    position: relative;
    margin-top: 32px;
    height: 56px;
    padding: 0 32px 0 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 34px;
    background: linear-gradient(100deg, #ff4a36 0%, #ff6b3f 40%, #e07cff 100%);
    background-size: 135% 100%;
    background-position: 0% 50%;
    color: #fff;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    box-shadow:
        0 12px 32px -10px rgba(255, 74, 54, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
    transition: box-shadow 0.18s ease, background-position 0.5s ease;
}
.start-note-button::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 55%);
    pointer-events: none;
}
.start-note-button:hover {
    background-position: 100% 50%;
    box-shadow:
        0 18px 40px -12px rgba(255, 74, 54, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
}
.start-note-label { position: relative; z-index: 1; }

.start-note-bars {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2.5px;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.start-note-bars i {
    display: block;
    width: 2px;
    height: 16px;
    border-radius: 2px;
    background: #fff;
    transform-origin: center;
    animation: bar-pulse 1.15s ease-in-out infinite;
}
.start-note-bars i:nth-child(1) { animation-delay: -0.9s; }
.start-note-bars i:nth-child(2) { animation-delay: -0.45s; }
.start-note-bars i:nth-child(3) { animation-delay: 0s; }
.start-note-bars i:nth-child(4) { animation-delay: -0.6s; }
.start-note-bars i:nth-child(5) { animation-delay: -0.25s; }

@keyframes bar-pulse {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

/* Saved notes: a fixed-height card (like the reference) with a
   two-column grid that scrolls inside the card. */
.home-notes {
    width: 100%;
    max-width: 756px;
    height: 360px;
    margin-top: 52px;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
    overflow: hidden;
}
.home-notes-head { display: flex; align-items: center; height: 72px; flex-shrink: 0; padding: 0 24px; }
.home-notes-title { font-size: 20px; font-weight: 700; }
.home-notes-count { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.home-notes-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 24px 24px; }
.home-notes-body::-webkit-scrollbar { width: 6px; }
.home-notes-body::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; }
.home-notes-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.home-notes[hidden] { display: none; }
.home-notes-sentinel { display: flex; justify-content: center; gap: 5px; padding: 14px 0 0; }
.home-notes-sentinel[hidden] { display: none; }
.home-notes-sentinel span { width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); animation: loader-dot 1.1s ease-in-out infinite; }
.home-notes-sentinel span:nth-child(2) { animation-delay: 0.15s; }
.home-notes-sentinel span:nth-child(3) { animation-delay: 0.3s; }
@keyframes loader-dot { 0%, 80%, 100% { opacity: 0.4; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

/* Promo slideshow: same footprint as the notes card, shown instead of
   it until the first note exists. Slides stack in one grid cell and
   crossfade; the copy column sits left, the screenshot fills the right. */
.home-promo {
    position: relative;
    width: 100%;
    height: 400px;
    margin-top: 72px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
    overflow: hidden;
}
.home-promo[hidden] { display: none; }
.home-promo-slides { display: grid; height: 100%; }
.home-promo-slide {
    grid-area: 1 / 1;
    display: flex;
    min-height: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
.home-promo-slide.is-active { opacity: 1; pointer-events: auto; }
.home-promo-copy {
    width: 320px;
    flex-shrink: 0;
    padding: 40px 36px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.home-promo-title { font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
.home-promo-text { font-size: 15px; line-height: 1.5; color: var(--text-2); }
.home-promo-media { position: relative; flex: 1; min-width: 0; }
.home-promo-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.home-promo-media::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(to right, rgba(15, 15, 17, 0.85), rgba(15, 15, 17, 0) 22%);
}
.home-promo-nav {
    position: absolute;
    left: 36px;
    bottom: 36px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 248px;
}
.home-promo-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-2);
    background: var(--secondary);
    color: var(--text-1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.home-promo-btn:hover { background: var(--hover); border-color: rgba(255, 255, 255, 0.24); }
.home-promo-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.home-promo-count { font-family: var(--mono); font-size: 13px; color: var(--text-3); user-select: none; }

.home-note-item {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    height: 85px;
    min-width: 0;
    padding: 16px 44px 16px 17px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--tertiary);
    text-align: left;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.home-note-item:hover { background: var(--hover); border-color: var(--border); }
.home-note-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.home-note-title { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-note-meta { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.home-note-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-2);
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.home-note-item:hover .home-note-delete, .home-note-delete:focus-visible { opacity: 1; }
.home-note-delete:hover { color: var(--primary); background: rgba(255, 255, 255, 0.06); }

/* ---------- Note view ---------- */
.note-view { display: flex; flex-direction: column; height: 100%; width: 100%; overflow: hidden; }

.header {
    display: flex;
    height: 66px;
    width: 100%;
    flex-shrink: 0;
    align-items: flex-end;
    border-bottom: 1px solid var(--border);
    padding: 14px 30px 14px 20px;
}

.new-notes-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid var(--secondary);
}
.new-notes-btn:hover { background: var(--hover); }
.new-notes-icon { display: block; flex-shrink: 0; color: var(--primary); }
/* Icon, label and shortcut all center on the same 21px line; the shortcut
   is a flex box with line-height 1 so the ⌘ glyph (which falls back to a
   system font) can't push itself below the icon's centre. */
.new-notes-label { display: flex; align-items: center; height: 21px; width: 95px; font-size: 14px; font-weight: 500; line-height: 1; text-align: left; }
.new-notes-kbd { display: inline-flex; align-items: center; height: 21px; font-family: var(--mono); font-size: 12px; line-height: 1; color: var(--text-3); white-space: nowrap; }

.note-body { display: flex; height: 100%; min-height: 0; overflow-x: auto; overflow-y: hidden; }

.col-divider { width: 1px; flex-shrink: 0; background: var(--divider); }

/* ---------- Left column ---------- */
.left-col { display: flex; width: 320px; min-width: 320px; flex-shrink: 0; flex-direction: column; overflow: hidden; }

.title-row {
    display: flex;
    height: 60px;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
    padding: 16px 18px;
    margin-bottom: 8px;
}
.back-btn { width: 32px; height: 32px; flex-shrink: 0; color: var(--text-2); display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.back-btn:hover { background: var(--hover); color: var(--text-1); }
.title-wrap { position: relative; flex: 1; min-width: 0; overflow: hidden; }
/* While the AI title is being generated, the input shows a shimmer bar (same idea as the chat sidebar skeleton) */
.title-wrap.is-pending .note-title { color: transparent; }
.title-wrap.is-pending::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    width: min(240px, 60%);
    height: 14px;
    transform: translateY(-50%);
    border-radius: 6px;
    background: linear-gradient(90deg, var(--secondary) 0%, var(--hover) 50%, var(--secondary) 100%);
    background-size: 200% 100%;
    animation: title-shimmer 1.3s linear infinite;
    pointer-events: none;
}
@keyframes title-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.note-title {
    width: 100%;
    padding: 0 8px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-1);
    font-size: 24px;
    font-weight: 700;
    line-height: 31.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    outline: none;
}
.note-title:hover, .note-title:focus { background: var(--secondary); }

.recording-section { display: flex; flex-direction: column; gap: 20px; padding: 0 18px; flex-shrink: 0; }

.recording-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
    border-radius: 12px;
    border: 1px solid var(--rec-border);
    background: var(--rec-bg);
    overflow: hidden;
    transition: border-color 0.3s ease;
}
.recording-container[data-state="recording"] { border-color: var(--accent-line); }

.recording-top { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 16px 12px; }

.audio-wave {
    width: 260px;
    height: 44px;
    border-radius: 4px;
    background: var(--canvas);
}

.recording-timer {
    margin-top: -8px;
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

.start-recording-button {
    display: inline-flex;
    height: 44px;
    width: 220px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 30px;
    background: var(--record-btn);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    transition: filter 0.15s ease;
}
.start-recording-button:hover:not(:disabled) { background: var(--primary-hover); }
.start-recording-button:disabled { opacity: 0.75; cursor: progress; }
.record-icon-stop { display: none; }
.recording-container[data-state="recording"] .record-icon-start { display: none; }
.recording-container[data-state="recording"] .record-icon-stop { display: block; }

.format-btn > svg { color: var(--text-3); }

/* Transcripts */
.transcripts {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
    flex-direction: column;
    overflow: hidden;
    border-top: 1px solid var(--border);
}
.transcripts-header { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 18px; }
.transcripts-title { font-size: 18px; font-weight: 700; line-height: 1.5; }
.icon-button { width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--text-2); transition: background 0.15s ease, color 0.15s ease; }
.icon-button:hover { background: var(--hover); color: var(--text-1); }
/* Copy button: the icon swaps to a check that draws itself in, then swaps back */
.copy-button { position: relative; }
.copy-button .copy-check { position: absolute; inset: 0; margin: auto; display: none; color: #22c55e; }
.copy-button.is-copied { color: #22c55e; }
.copy-button.is-copied .copy-icon { animation: copy-icon-out 0.18s ease forwards; }
.copy-button.is-copied .copy-check { display: block; animation: copy-check-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.copy-button.is-copied .copy-check path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: copy-check-draw 0.28s ease-out 0.08s forwards; }
@keyframes copy-icon-out { to { opacity: 0; transform: scale(0.6); } }
@keyframes copy-check-pop { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: none; } }
@keyframes copy-check-draw { to { stroke-dashoffset: 0; } }

.transcripts-body { display: flex; flex: 1; min-height: 0; flex-direction: column; padding: 0 18px 20px; }
/* Empty state: sits in the upper part of the column (2:3 split like the reference) */
.transcripts-empty {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-bottom: 20%;
    color: var(--disabled);
    text-align: center;
}
.transcripts-empty-text { font-size: 13px; line-height: 1.35; }
.transcripts-list {
    display: flex;
    height: 100%;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding-right: 4px;
}

.transcript-item {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    gap: 12px;
    border-radius: 12px;
    background: var(--tertiary);
    padding: 12px 0 4px 16px;
    overflow: hidden;
}
.transcript-item-head { display: flex; align-items: center; justify-content: space-between; padding-right: 16px; }
.transcript-time { height: 20px; font-family: var(--mono); font-size: 13px; font-weight: 600; line-height: 18.2px; color: var(--text-1); font-variant-numeric: tabular-nums; }
.transcript-insert {
    width: 28px;
    height: 28px;
    margin: -4px -6px -4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--primary);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.transcript-item:hover .transcript-insert, .transcript-insert:focus-visible { visibility: visible; opacity: 1; }
.transcript-insert:hover { background: var(--accent-soft); }
.transcript-text { padding-right: 16px; font-size: 12px; color: var(--text-2); line-height: 1.5; margin-bottom: 8px; }
.transcript-item.is-interim .transcript-text { color: var(--text-3); }
.transcript-item.is-interim .transcript-text::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 0.9em;
    background: var(--primary);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s steps(2, start) infinite;
}

/* ---------- Editor column ---------- */
.editor-col { width: auto; min-width: 460px; flex-grow: 1; overflow: hidden; }
.editor-container { display: flex; height: 100%; width: 100%; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; margin: 0 auto; }

.editor-header {
    display: flex;
    height: 60px;
    width: 100%;
    max-width: 756px;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 16px 40px;
    position: relative;
    z-index: 5;
}
.editor-title { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.export-wrap { position: relative; flex-shrink: 0; }
.export-btn { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 8px; color: var(--text-1); }
.export-btn:hover, .export-btn[aria-expanded="true"] { background: var(--hover); }
.export-btn svg { color: var(--text-2); }
.export-btn span { font-size: 15px; font-weight: 500; line-height: 1; }

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 200px;
    padding: 6px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.8);
    z-index: 20;
}
.dropdown-menu.dropdown-up { top: auto; bottom: calc(100% + 4px); left: 0; right: auto; }
.dropdown-item { display: block; width: 100%; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; text-align: left; white-space: nowrap; }
.dropdown-item:hover { background: var(--hover); }
.dropdown-item.is-active { color: var(--primary); }

.editor-content-area { position: relative; height: 100%; width: 100%; max-width: 756px; overflow-y: auto; }

.function-btns { display: flex; width: 100%; align-items: center; gap: 12px; padding: 12px 40px 16px; }
.function-btn {
    display: flex;
    height: 63px;
    width: 50%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
    border: 1px solid var(--secondary);
    background: var(--tertiary);
    text-align: left;
    transition: filter 0.15s ease;
}
.function-btn:hover:not(:disabled) { background: var(--hover); border-color: var(--border-2); }
.function-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.function-btn { position: relative; overflow: hidden; transition: background 0.2s ease, border-color 0.2s ease; }
.fn-spinner { display: none; flex-shrink: 0; color: var(--primary); }
.function-btn.is-busy,
.function-btn.is-busy:disabled {
    opacity: 1;
    cursor: progress;
    justify-content: center;
    text-align: center;
    border-color: rgba(255, 74, 54, 0.35);
    background: rgba(255, 74, 54, 0.06);
}
.function-btn.is-busy .fn-icon { display: none; }
.function-btn.is-busy .fn-spinner { display: block; animation: fn-spin 0.9s linear infinite; }
.function-btn.is-busy .btn-text { display: flex; flex-direction: column; align-items: center; }
.function-btn.is-busy .btn-title {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.6) 30%, #fff 50%, rgba(255, 255, 255, 0.6) 80%);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmertext 2.25s infinite;
}
.function-btn.is-busy .btn-desc { color: var(--text-3); }
/* A soft sheen sweeping across the card... */
.function-btn.is-busy::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
    background-size: 250% 100%;
    animation: fn-sheen 2.4s ease-in-out infinite;
    pointer-events: none;
}
/* ...and a progress line running along the bottom edge. */
.function-btn.is-busy::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--primary) 50%, transparent 100%);
    background-size: 45% 100%;
    background-repeat: no-repeat;
    animation: fn-progress 1.6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes fn-spin { to { transform: rotate(360deg); } }
@keyframes fn-sheen { 0% { background-position: 150% 0; } 100% { background-position: -150% 0; } }
@keyframes fn-progress { 0% { background-position: -60% 0; } 100% { background-position: 160% 0; } }
@media (prefers-reduced-motion: reduce) {
    .function-btn.is-busy::after, .function-btn.is-busy::before, .function-btn.is-busy .btn-title, .upgrade-btn { animation: none; }
    .function-btn.is-busy .btn-title { color: var(--text-1); background: none; }
}
.btn-title { font-size: 16px; font-weight: 600; line-height: 130%; color: var(--text-1); }
.btn-desc { font-size: 14px; font-weight: 400; line-height: 130%; color: var(--text-2); }

.animate-dots::after { content: ''; animation: dots 3s infinite; }

.editor-content { height: calc(100% - 91px); }

/* The notes themselves (mirrors the tiptap typography) */
.tiptap {
    min-height: 100%;
    margin: 0 40px;
    padding-bottom: 40px;
    caret-color: var(--primary);
    outline: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-1);
}
.tiptap:empty::before { content: attr(data-placeholder); color: var(--disabled); pointer-events: none; }
.tiptap > :first-child { margin-top: 0; }
.tiptap p { margin: 0 0 1em; }
.tiptap ul, .tiptap ol { list-style-type: revert; padding: 0 1rem; margin: 1.25rem 1rem 1.25rem 0.4rem; }
.tiptap li { margin: 0.25em 0; }
.tiptap li p { margin: 0.25em 0; }
.tiptap h1, .tiptap h2, .tiptap h3, .tiptap h4 { line-height: 1.5; font-weight: 600; margin-top: 2.5rem; text-wrap: pretty; }
.tiptap * + h1, .tiptap * + h2 { margin-top: 2.5em; }
.tiptap * + h3, .tiptap * + h4 { margin-top: 2em; }
.tiptap h1 { font-size: 2em; letter-spacing: -0.02em; }
.tiptap h2 { font-size: 1.5em; letter-spacing: -0.01em; }
.tiptap h3 { font-size: 1.25em; }
.tiptap h4 { font-size: 1.125em; }
.tiptap strong { font-weight: 600; }
.tiptap blockquote { border-left: 2px solid var(--accent-line); margin: 1.5rem 0; padding: 0.5rem 0 0.5rem 1rem; color: var(--text-2); font-style: italic; }
.tiptap blockquote cite { display: block; font-size: 12px; font-style: normal; color: var(--text-3); margin-top: 4px; }
.tiptap table { border-collapse: collapse; margin: 1.5rem 0; width: 100%; font-size: 0.9em; }
.tiptap th, .tiptap td { border: 1px solid var(--border-2); background: var(--tertiary); padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; }
.tiptap th { font-weight: 600; }

.editor-footer {
    display: flex;
    height: 78px;
    width: 100%;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 32px;
    border-top: 1px solid var(--border);
    padding: 20px 0;
}

.format-wrap { position: relative; }
.format-btn {
    display: inline-flex;
    height: 32px;
    width: 171px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 6px;
    background: var(--format-bg);
    padding: 0 8px;
    color: var(--text-1);
}
.format-btn-left { display: flex; align-items: center; gap: 4px; }
.format-btn-left span { font-size: 14px; font-weight: 500; line-height: 1.25; white-space: nowrap; }

.toolbar { display: flex; align-items: center; justify-content: center; gap: 24px; }
.toolbar-btn { border-radius: 6px; padding: 4px; color: var(--text-1); display: flex; }
.toolbar-btn:hover:not(:disabled) { background: var(--hover); }
.toolbar-btn:disabled { color: var(--disabled); cursor: default; }

.word-count { display: flex; min-width: 120px; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; line-height: 1.25; color: var(--text-2); }

/* ---------- Ask column ----------
   Mirrors the Chrome extension side panel: plain assistant prose,
   a bubble for the user, a rounded composer with the send button
   tucked in the bottom-right corner. */
.ask-col { width: 360px; min-width: 360px; flex-shrink: 0; overflow: hidden; }
.ask-panel { display: flex; height: 100%; width: 100%; flex-direction: column; }

.ask-header { display: flex; height: 60px; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 0 16px; }
.ask-title { font-size: 18px; font-weight: 700; }
.ask-clear {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-2);
    transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.ask-clear:hover:not(:disabled) { background: var(--hover); color: var(--text-1); }
.ask-clear:disabled { opacity: 0.35; cursor: default; }

.ask-messages { display: flex; flex: 1; min-height: 0; flex-direction: column; overflow-y: auto; overflow-x: hidden; padding: 16px 14px 20px; font-size: 13.5px; line-height: 1.55; scroll-behavior: smooth; }
.ask-messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); }

.msg { margin-bottom: 16px; animation: rise-in 0.25s cubic-bezier(0.22, 0.61, 0.36, 1); }
.msg:last-child { margin-bottom: 0; }

.msg-assistant .msg-body { color: var(--text-1); word-break: break-word; overflow-wrap: anywhere; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 0 0 0.7em; }
.prose > :last-child { margin-bottom: 0; }
.prose p { line-height: 1.65; }
.prose ol, .prose ul { list-style: revert; padding-left: 1.3em; }
.prose li { margin-bottom: 0.25em; }
.prose strong { font-weight: 600; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-size: 1em; font-weight: 600; margin: 0.9em 0 0.35em; line-height: 1.4; }
.prose > h1:first-child, .prose > h2:first-child, .prose > h3:first-child { margin-top: 0; }
.prose code { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 0.9em; background: var(--secondary); padding: 0.1em 0.35em; border-radius: 4px; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 0.7em; font-size: 0.92em; }
.prose th, .prose td { border: 1px solid var(--border-2); padding: 0.4em 0.6em; text-align: left; vertical-align: top; }
.msg-assistant .msg-body.is-error {
    color: #fca5a5;
    font-size: 12.5px;
    padding: 8px 12px;
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.1);
}

/* Message footer (copy) — hidden until hover, as in the side panel */
.msg-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; margin-left: -4px; opacity: 0; transition: opacity 0.15s ease; }
.msg:hover .msg-foot, .msg:focus-within .msg-foot { opacity: 1; }
.msg-foot-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-2);
    padding: 4px 6px;
    border-radius: 7px;
    transition: background 0.12s ease, color 0.12s ease;
}
.msg-foot-btn:hover { color: var(--text-1); background: rgba(255, 255, 255, 0.06); }
.msg-foot-btn svg { width: 13px; height: 13px; }

.ask-quick {
    margin-top: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.ask-quick-label { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 0 2px; }
.ask-suggestions { display: flex; flex-direction: column; gap: 6px; }
.ask-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-1);
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.ask-suggestion:hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); border-color: var(--border-2); }
.ask-suggestion:active:not(:disabled) { transform: scale(0.99); }
.ask-suggestion:disabled { opacity: 0.55; cursor: default; }
.ask-suggestion svg { width: 16px; height: 16px; color: var(--text-2); flex-shrink: 0; }
.ask-suggestion span { min-width: 0; }

.msg-user { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-user .bubble {
    max-width: 85%;
    padding: 8px 13px;
    background: #1e1e24;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px 16px 4px 16px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.6;
    color: var(--text-1);
}

.msg-cite {
    display: inline-block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: var(--accent-soft);
    border-radius: 4px;
    padding: 0 5px;
    line-height: 18px;
    vertical-align: baseline;
    cursor: pointer;
    transition: background 0.15s ease;
}
.msg-cite:hover { background: rgba(255, 74, 54, 0.2); }
.is-streaming .msg-body > :last-child::after { content: ''; display: inline-block; width: 7px; height: 0.85em; background: #fff; margin-left: 3px; vertical-align: text-bottom; animation: blink 1s steps(2, start) infinite; }

/* Pre-stream loader: the side panel's "Solving…" chip — text with a
   silver sheen sweeping across it. */
.tool-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 0; font-size: 12.5px; color: var(--text-2); }
.tool-chip.working .chip-label {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.55) 30%, rgba(255, 255, 255, 0.95) 50%, rgba(255, 255, 255, 0.55) 80%);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmertext 2.25s infinite;
}
@keyframes shimmertext { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Web search step rows above an answer: the chat page's search indicator
   (.web-search-indicator and the .reasoning-* row pieces it is built from),
   with the icon itself shimmering while the search runs. */
.msg-steps { margin-bottom: 2px; }
.web-search-indicator { padding: 0.375rem 0; margin-bottom: 0.25rem; }
.reasoning-toggle-inner.reasoning-static { display: flex; align-items: center; gap: 0.375rem; min-width: 0; padding: 0.25rem 0; color: var(--text-2); }
.reasoning-sparkle { width: 1rem; height: 1rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.reasoning-sparkle svg { width: 1rem; height: 1rem; }
.reasoning-summary { font-size: 0.8125rem; font-weight: 400; line-height: 1.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reasoning-summary.reasoning-shimmer {
    background: linear-gradient(90deg, var(--text-2) 30%, rgba(255, 255, 255, 0.7) 50%, var(--text-2) 80%);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmertext 2.25s infinite;
}
.web-search-indicator.searching .reasoning-sparkle {
    background: linear-gradient(90deg, var(--text-2) 30%, rgba(255, 255, 255, 0.7) 50%, var(--text-2) 80%);
    background-size: 400% 100%;
    animation: shimmertext 2.25s infinite;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='black'%3E%3Cpath fill-rule='evenodd' d='M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z' clip-rule='evenodd'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='black'%3E%3Cpath fill-rule='evenodd' d='M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z' clip-rule='evenodd'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}
.web-search-indicator.searching .reasoning-sparkle svg { visibility: hidden; }

.ask-composer { position: relative; flex-shrink: 0; padding: 6px 12px 14px; background: var(--bg); }
.ask-scroll-latest {
    position: absolute;
    left: 50%;
    top: -46px;
    transform: translateX(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(20, 20, 23, 0.6);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: var(--text-1);
    z-index: 10;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.ask-scroll-latest:hover { background: rgba(38, 38, 43, 0.7); border-color: rgba(255, 255, 255, 0.24); }
.ask-scroll-latest:active { transform: translateX(-50%) scale(0.96); }
.ask-scroll-latest svg { width: 17px; height: 17px; }
.ask-input-box {
    background: var(--input-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 22px;
    cursor: text;
    transition: border-color 0.2s ease;
}
.ask-input-box:hover { border-color: rgba(255, 255, 255, 0.1); }
.ask-input-box:focus-within { border-color: rgba(255, 255, 255, 0.15); }
.ask-input-inner { display: flex; flex-direction: column; gap: 6px; margin: 9px 10px 8px; }
.ask-input {
    width: 100%;
    min-height: 46px;
    max-height: 130px;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    padding: 4px 4px 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-1);
    caret-color: var(--text-1);
}
.ask-input::placeholder { color: rgba(255, 255, 255, 0.35); }
.ask-input:disabled { cursor: default; }
.ask-input-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.ask-input-hint { font-size: 11px; color: var(--text-3); padding-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ask-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-1);
    transition: background 0.15s ease, opacity 0.15s ease;
}
.ask-send:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
.ask-send:disabled { opacity: 0.3; cursor: not-allowed; color: var(--text-2); }
.ask-send svg { width: 16px; height: 16px; }
.ask-send .stop-icon { display: none; }
.ask-send.streaming { background: #ef4444; color: #fff; opacity: 1; }
.ask-send.streaming:hover { background: #dc2626; }
.ask-send.streaming .send-icon { display: none; }
.ask-send.streaming .stop-icon { display: block; }

@keyframes rise-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Mobile tabs ---------- */
.mobile-tabs { display: none; }

/* ---------- Confirm dialog (mirrors /chat) ---------- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1200;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.confirm-overlay.show { opacity: 1; pointer-events: auto; }
.confirm-dialog {
    width: min(360px, calc(100% - 2rem));
    background: #111114;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    color: var(--text-1);
    transform: translateY(6px);
    transition: transform 0.2s ease;
}
.confirm-overlay.show .confirm-dialog { transform: translateY(0); }
.confirm-title { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.confirm-body { font-size: 13.5px; color: var(--text-2); margin: 0 0 16px; line-height: 1.5; overflow-wrap: anywhere; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.confirm-btn {
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.confirm-btn.ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.confirm-btn.ghost:hover { color: var(--text-1); border-color: rgba(255, 255, 255, 0.15); }
.confirm-btn.danger { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border-color: rgba(239, 68, 68, 0.25); }
.confirm-btn.danger:hover { background: rgba(239, 68, 68, 0.2); color: #fee2e2; }
.confirm-btn:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.35); outline-offset: 1px; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    top: 24px;
    transform: translate(-50%, -8px);
    background: var(--panel);
    border: 1px solid var(--border-2);
    color: var(--text-1);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-link { margin-left: 6px; color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.toast-link:hover { filter: brightness(1.15); }

/* ---------- Motion ---------- */
@keyframes blink { to { visibility: hidden; } }
@keyframes blink-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes dots { 0%, 20% { content: ''; } 40% { content: '.'; } 60% { content: '..'; } 80%, 100% { content: '...'; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    .transcripts-list { scroll-behavior: auto; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .ai-note-home { padding: 48px 20px 40px; }
    .home-notes { margin-top: 36px; }
    .home-notes-head { padding: 0 16px; }
    .home-notes-body { padding: 0 16px 16px; }
    .home-notes-list { grid-template-columns: 1fr; }
    .home-promo { height: auto; margin-top: 36px; }
    .home-promo-slide { flex-direction: column-reverse; }
    .home-promo-copy { width: 100%; padding: 20px 20px 68px; }
    .home-promo-media { flex: none; aspect-ratio: 4 / 3; }
    .home-promo-media::after { background: linear-gradient(to top, rgba(15, 15, 17, 0.85), rgba(15, 15, 17, 0) 22%); }
    .home-promo-nav { left: 20px; bottom: 20px; }
    .home-title { font-size: 30px; }
    .start-note-button { height: 52px; font-size: 17px; padding: 0 24px 0 20px; }
    .header { padding: 12px 16px; height: 58px; }

    .note-body { flex-direction: column; overflow: hidden; }
    .col-divider { display: none; }
    .left-col, .editor-col, .ask-col { display: none; width: 100%; min-width: 0; flex: 1; }
    .note-view[data-col="left"] .left-col,
    .note-view[data-col="editor"] .editor-col,
    .note-view[data-col="ask"] .ask-col { display: flex; flex-direction: column; }
    .editor-col { flex-grow: 1; }
    .editor-header { padding: 12px 16px; }
    .function-btns { padding: 12px 16px 16px; flex-direction: column; }
    .function-btn { width: 100%; }
    .tiptap { margin: 0 16px; }
    .editor-footer { gap: 16px; padding: 12px 8px; height: 64px; }
    .format-btn { width: 150px; }
    .word-count { min-width: 80px; }
    .title-wrap { width: auto; flex: 1; }

    .mobile-tabs {
        display: flex;
        flex-shrink: 0;
        border-top: 1px solid var(--border);
        background: var(--bg);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .mobile-tab { flex: 1; padding: 12px 0; font-size: 14px; font-weight: 500; color: var(--text-3); border-top: 2px solid transparent; margin-top: -1px; }
    .mobile-tab.is-active { color: var(--primary); border-top-color: var(--primary); }
}

.fn-icon { color: var(--primary); }
.record-icon rect { fill: #fff; }
