:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: #0e0e0f;
  --surface-2: #151516;
  --surface-3: #1b1b1d;
  --text: #f5f5f7;
  --muted: #929296;
  --line: rgba(255, 255, 255, 0.09);
  --red: #e63946;
  --red-light: #ff5a66;
  --red-cta: #c92f3b;
  --red-wash: rgba(230, 57, 70, 0.1);
  --good: #58c985;
  --warning: #f0b35b;
  --radius: 16px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ai-viewport-height: 100dvh;
  --ai-viewport-top: 0px;
}

* { box-sizing: border-box; }
html, body, #root { width: 100%; height: 100%; min-height: 100%; margin: 0; }
html { background: var(--bg); }
body {
  background:
    radial-gradient(circle at 50% -16%, rgba(230, 57, 70, 0.08), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, textarea, input { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--red-light);
  outline-offset: 3px;
}
.sr-only {
  clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; overflow: hidden;
  position: absolute; white-space: nowrap; width: 1px;
}
.turnstile-host {
  position: fixed; z-index: 140; inset: 0; display: grid; place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  background: rgba(5,5,5,.76); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.turnstile-host > * {
  max-width: 100%; border-radius: 12px; box-shadow: 0 18px 54px rgba(0,0,0,.55);
}

.ai-page { position: fixed; top: var(--ai-viewport-top, 0px); right: 0; left: 0; height: var(--ai-viewport-height, 100dvh); min-height: 0; overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.ai-header {
  height: calc(68px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line); background: rgba(5, 5, 5, 0.87);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  position: relative; z-index: 20;
}
.ai-header-inner { min-width: 0; height: 68px; max-width: 1440px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.header-leading { min-width: 0; display: flex; align-items: center; gap: 8px; }
.conversation-toggle { display: none; flex: 0 0 44px; width: 44px; height: 44px; place-items: center; border-radius: 11px; border: 1px solid transparent; background: transparent; color: #d4d4d8; cursor: pointer; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 900; letter-spacing: .03em; }
.brand img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.back-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.header-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }
.allowance {
  min-height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.035);
  color: #d4d4d7; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.allowance-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px rgba(230,57,70,.65); }
.allowance-compact { display: none; }
.header-action, .account-control {
  min-height: 44px; padding: 0 13px; border-radius: 12px; border: 1px solid var(--line);
  background: transparent; cursor: pointer; color: #dcdce0; font-size: 11px; font-weight: 760; white-space: nowrap;
}
.header-action:hover, .account-control:hover, .conversation-toggle:hover { border-color: rgba(230,57,70,.55); background: var(--red-wash); }
.header-action:disabled, .account-control:disabled { opacity: .42; cursor: not-allowed; }
.new-button { flex: 0 0 44px; width: 44px; padding: 0; display: grid; place-items: center; }
.mobile-label { display: none; }
.account-control.signed-in { display: inline-flex; align-items: center; gap: 8px; padding-left: 6px; }
.account-avatar { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: var(--red-wash); color: var(--red-light); font-size: 10px; letter-spacing: .02em; }

.offline-bar { position: fixed; z-index: 50; top: calc(69px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: #2b2014; color: #f7d49a; border: 1px solid rgba(240,179,91,.35); padding: 8px 14px; border-radius: 0 0 10px 10px; font-size: 12px; }
.ai-layout { min-height: 0; max-width: 1440px; width: 100%; margin: 0 auto; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.conversation-rail { min-width: 0; min-height: 0; border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.018), transparent 35%); }
.conversation-rail-content { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 24px 14px max(16px, env(safe-area-inset-bottom)); }
.conversation-rail-top { min-width: 0; }
.conversation-rail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 0 7px 15px; }
.conversation-rail-head .coach-kicker { margin-bottom: 0; }
.rail-conversations { min-height: 0; display: grid; align-content: start; gap: 5px; overflow-y: auto; overscroll-behavior: contain; padding: 1px 3px 12px; scrollbar-gutter: stable; touch-action: pan-y pinch-zoom; }
.rail-conversation { width: 100%; min-height: 58px; display: grid; align-content: center; gap: 5px; padding: 10px 11px; border-radius: 11px; border: 1px solid transparent; background: transparent; color: #b7b7bc; text-align: left; cursor: pointer; }
.rail-conversation strong, .rail-conversation span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-conversation strong { color: #d5d5d9; font-size: 11px; line-height: 1.35; }
.rail-conversation span { color: #77777d; font-size: 9px; }
.rail-conversation:hover { border-color: var(--line); background: rgba(255,255,255,.035); }
.rail-conversation.active { border-color: rgba(230,57,70,.28); background: var(--red-wash); }
.rail-conversation.active strong { color: #fff; }
.rail-conversation:disabled { opacity: .55; cursor: wait; }
.rail-empty { margin: 6px 8px; color: #818187; font-size: 11px; line-height: 1.55; }
.rail-load-more { width: 100%; min-height: 44px; margin-top: 4px; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; background: transparent; color: #aaaab0; cursor: pointer; font-size: 10px; font-weight: 750; }
.rail-load-more:hover { border-color: rgba(230,57,70,.35); background: var(--red-wash); color: #fff; }
.rail-load-more:disabled { opacity: .55; cursor: wait; }
.rail-load-error { margin: 5px 8px 0; color: #c98b91; font-size: 9px; line-height: 1.45; }
.drawer-new-chat { grid-row: 3; justify-self: start; z-index: 4; min-width: 134px; min-height: 52px; display: none; align-items: center; justify-content: center; gap: 10px; margin: 10px 10px 0; padding: 0 21px; border-radius: 999px; background: linear-gradient(180deg, var(--red), var(--red-cta)); color: #fff; box-shadow: 0 12px 28px rgba(201,47,59,.27), inset 0 1px rgba(255,255,255,.16); font-size: 15px; font-weight: 800; letter-spacing: -.01em; cursor: pointer; transition: transform .16s var(--ease), filter .16s var(--ease), box-shadow .16s var(--ease); -webkit-tap-highlight-color: transparent; }
.drawer-new-chat svg { width: 22px; height: 22px; }
.drawer-new-chat:hover { filter: brightness(1.07); box-shadow: 0 14px 32px rgba(201,47,59,.33), inset 0 1px rgba(255,255,255,.18); }
.drawer-new-chat:focus-visible { outline-color: #fff; }
.drawer-new-chat:active { transform: scale(.975); }
.drawer-new-chat:disabled { opacity: .52; filter: saturate(.7); box-shadow: none; cursor: wait; }
.conversation-rail-note { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 8px; align-items: start; margin: 8px 4px 0; padding: 12px; border-top: 1px solid var(--line); color: #85858b; }
.conversation-rail-note p { margin: 0; font-size: 9px; line-height: 1.5; }
.privacy-dot { width: 7px; height: 7px; margin-top: 3px; border-radius: 50%; background: #5e9f75; box-shadow: 0 0 10px rgba(88,201,133,.26); }
.conversation-drawer-backdrop { --conversation-drawer-width: min(86vw, calc(100vw - 44px), 340px); position: fixed; z-index: 90; inset: 0; background: rgba(0,0,0,.68); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); touch-action: pan-y pinch-zoom; }
.conversation-drawer { position: absolute; inset: 0 auto 0 0; width: var(--conversation-drawer-width); min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; padding: calc(23px + env(safe-area-inset-top)) 10px max(16px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); border-right: 1px solid rgba(255,255,255,.13); background: #0b0b0c; box-shadow: 24px 0 80px rgba(0,0,0,.6); animation: drawer-in .24s var(--ease) both; touch-action: pan-y pinch-zoom; }
.conversation-drawer:focus { outline: none; }
.conversation-drawer .conversation-rail-content { display: contents; }
.conversation-drawer .conversation-rail-top { grid-row: 1; }
.conversation-drawer .rail-conversations { grid-row: 2; }
.conversation-drawer .conversation-rail-note { grid-row: 4; }
.drawer-search { position: absolute; z-index: 2; top: max(9px, env(safe-area-inset-top)); right: 8px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 11px; background: transparent; color: #bcbcc1; cursor: pointer; }
.drawer-search:hover, .drawer-search.active { background: rgba(255,255,255,.05); color: #fff; }
.drawer-return-zone { position: absolute; z-index: 3; top: 0; left: calc(100% + 1px); width: calc(100vw - var(--conversation-drawer-width)); height: 100%; display: none; place-items: center; padding: 0; border-left: 1px solid rgba(255,255,255,.04); background: rgba(18,18,19,.82); color: #929297; cursor: pointer; touch-action: pan-y pinch-zoom; -webkit-tap-highlight-color: transparent; }
.drawer-return-zone:hover { background: rgba(21,21,22,.88); color: #b0b0b4; }
.drawer-return-zone:focus-visible { outline: none; }
.drawer-return-glyph { width: 44px; height: 52px; display: grid; place-content: center; justify-items: center; gap: 7px; border-radius: 13px; transition: color .16s var(--ease), transform .16s var(--ease), box-shadow .16s var(--ease); }
.drawer-return-glyph span { display: block; height: 3px; border-radius: 999px; background: currentColor; }
.drawer-return-glyph span:first-child { width: 28px; }
.drawer-return-glyph span:last-child { width: 18px; }
.drawer-return-zone:focus-visible .drawer-return-glyph { box-shadow: 0 0 0 2px var(--red-light); color: #fff; }
.drawer-return-zone:active .drawer-return-glyph { transform: translateX(-2px); color: #d0d0d3; }
.conversation-search { min-height: 44px; display: flex; align-items: center; gap: 9px; margin: 0 7px 12px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.035); color: #8f8f95; }
.conversation-search:focus-within { border-color: rgba(230,57,70,.55); background: rgba(255,255,255,.05); color: #d7d7db; }
.conversation-search svg { flex: 0 0 19px; }
.conversation-search input { min-width: 0; width: 100%; height: 42px; border: 0; outline: 0; background: transparent; color: #fff; font-size: 16px; }
.conversation-search input::placeholder { color: #77777d; opacity: 1; }
.coach-panel { min-height: 0; padding: 28px 22px; border-right: 1px solid var(--line); overflow-y: auto; }
.coach-kicker { margin: 0 0 10px; color: var(--red-light); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.coach-panel h2 { font-size: 25px; line-height: 1.03; letter-spacing: -.035em; margin: 0; font-weight: 850; }
.coach-summary { color: #b1b1b5; font-size: 13px; line-height: 1.55; margin: 13px 0 0; }
.disclaimer { margin: 15px 0 0; padding: 12px; color: var(--muted); font-size: 11px; line-height: 1.5; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 12px; }
.starter-title { margin: 28px 0 10px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.starter-list { display: grid; gap: 7px; }
.starter {
  width: 100%; min-height: 44px; padding: 10px 11px; text-align: left; cursor: pointer;
  border-radius: 11px; border: 1px solid transparent; background: transparent; color: #c8c8cc;
  transition: background .18s, border-color .18s, color .18s;
}
.starter:hover { background: rgba(255,255,255,.04); border-color: var(--line); color: #fff; }
.starter strong { display: block; color: var(--red-light); font-size: 10px; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .08em; }
.starter span { display: block; font-size: 12px; line-height: 1.35; }

.chat { min-width: 0; min-height: 0; display: grid; grid-template-rows: 1fr auto; position: relative; }
.messages { min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; padding: 34px max(24px, calc((100% - 820px) / 2)) 20px; scroll-behavior: auto; scrollbar-gutter: stable; }
.empty-state { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 0 76px; }
.coach-mark { width: 52px; height: 52px; border: 1px solid rgba(230,57,70,.35); border-radius: 16px; display: grid; place-items: center; background: var(--red-wash); color: var(--red-light); font-size: 18px; font-weight: 900; }
.empty-state h2 { max-width: 620px; margin: 20px 0 8px; font-size: clamp(26px, 4vw, 42px); line-height: 1.02; letter-spacing: -.045em; }
.empty-state p { max-width: 530px; color: var(--muted); margin: 0; font-size: 14px; line-height: 1.55; }
.empty-starters { width: min(720px, 100%); margin-top: 24px; }
.empty-starters .starter-list { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.empty-starters .starter { min-height: 74px; padding: 11px 12px; border-color: var(--line); background: rgba(255,255,255,.025); }
.empty-identity { width: min(680px, 100%); display: grid; gap: 5px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); }
.empty-identity small { color: #717177; font-size: 9px; line-height: 1.5; }
.mobile-starters { display: none; }
.message-row { display: flex; margin: 0 0 20px; }
.message-row.user { justify-content: flex-end; }
.message { max-width: min(760px, 90%); font-size: 14px; line-height: 1.62; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { border-radius: 18px 18px 4px 18px; padding: 11px 14px; background: #242426; border: 1px solid rgba(255,255,255,.07); }
.message.assistant { width: 100%; color: #e7e7ea; }
.message-role { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.message-role span:first-child { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; background: var(--red-wash); color: var(--red-light); }
.message-role-name { min-width: 0; }
.response-pulse { flex: 0 0 8px; width: 8px; height: 8px; margin-left: -2px; border-radius: 50%; background: var(--red-light); box-shadow: 0 0 0 0 rgba(230,57,70,.26); animation: response-pulse 1.05s ease-in-out infinite; }
.assistant-copy { display: grid; gap: 8px; white-space: normal; }
.assistant-copy p { margin: 0; }
.streaming-cursor { display: inline-block; width: 2px; height: .95em; margin-left: 3px; border-radius: 1px; background: var(--red-light); vertical-align: -.1em; animation: streaming-cursor .72s steps(1, end) infinite; }
.assistant-section-title { display: block; margin-top: 4px; color: #f2f2f4; font-size: 13px; line-height: 1.35; }
.assistant-bullet { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 5px; }
.assistant-bullet > span:first-child { color: var(--red-light); }
.assistant-resources { display: grid; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); white-space: normal; }
.assistant-resource { display: grid; gap: 2px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.assistant-resource > strong { color: #cfcfd3; font-size: 11px; }
.assistant-resource-link { width: fit-content; color: #ededf0; text-decoration: underline; text-decoration-color: rgba(230,57,70,.45); text-underline-offset: 3px; }
.assistant-resource-link:hover { color: #fff; text-decoration-color: var(--red-light); }
.assistant-videos { gap: 7px; }
.video-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.video-card { position: relative; min-width: 0; overflow: hidden; display: grid; grid-template-rows: auto 1fr; color: #f3f3f5; text-decoration: none; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: #151517; box-shadow: 0 10px 28px rgba(0,0,0,.22); transition: transform .18s var(--ease), border-color .18s ease, background .18s ease; }
.video-card:hover { transform: translateY(-2px); border-color: rgba(230,57,70,.5); background: #19191b; }
.video-card:focus-visible { outline: 2px solid var(--red-light); outline-offset: 3px; }
.video-card-media { position: relative; display: block; overflow: hidden; aspect-ratio: 16 / 9; background: radial-gradient(circle at 50% 45%, rgba(230,57,70,.23), transparent 34%), #0a0a0b; }
.video-card-media img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .25s var(--ease); }
.video-card:hover .video-card-media img { transform: scale(1.025); }
.video-card-media::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 52%, rgba(0,0,0,.48)); pointer-events: none; }
.video-card-play { position: absolute; z-index: 1; left: 50%; top: 50%; translate: -50% -50%; width: 39px; height: 28px; display: grid; place-items: center; padding-left: 2px; border-radius: 9px; color: #fff; background: rgba(211,39,52,.94); box-shadow: 0 5px 16px rgba(0,0,0,.36); font-size: 12px; }
.video-card-copy { min-width: 0; display: grid; align-content: start; gap: 3px; padding: 10px 34px 11px 11px; }
.video-card-copy strong { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: #f4f4f6; font-size: 12px; line-height: 1.4; }
.video-card-copy > span { overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.video-card-arrow { position: absolute; right: 11px; bottom: 11px; color: #9c9ca3; font-size: 13px; }
.assistant-sources ul { display: grid; gap: 3px; margin: 1px 0 0; padding-left: 17px; }
.message-files { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.message-file { padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 11px; }
.message-error { margin: 8px 0 0; color: #ff9ea5; font-size: 12px; }
.message-stopped { width: fit-content; display: block; margin: 7px 0 0 auto; padding: 3px 7px; border: 1px solid rgba(255,255,255,.1); border-radius: 999px; color: #a0a0a6; font-size: 9px; font-weight: 750; line-height: 1.2; }
.retry-button { margin-top: 8px; padding: 7px 10px; min-height: 44px; border-radius: 9px; border: 1px solid rgba(230,57,70,.4); background: var(--red-wash); cursor: pointer; font-size: 12px; font-weight: 750; }
.message-actions { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 11px; margin-left: -7px; }
.message-actions button { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 9px; background: transparent; color: #8f8f95; cursor: pointer; font-size: 10px; font-weight: 700; }
.message-actions button svg { width: 15px; height: 15px; }
.message-actions button:hover { background: rgba(255,255,255,.04); color: #d5d5d9; }
.message-actions button:disabled { opacity: .38; cursor: not-allowed; }
.message-copy-feedback { min-height: 40px; display: inline-flex; align-items: center; padding: 0 5px; color: #8faf9b; font-size: 9px; }
.message-copy-feedback.error { color: #c98b91; }
.history-loading { min-height: 32px; display: grid; place-items: center; margin: 0 auto 12px; color: #8f8f95; font-size: 10px; }

@media (hover: hover) and (pointer: fine) {
  .message-actions { opacity: 0; transform: translateY(-2px); transition: opacity .16s ease, transform .16s ease; }
  .message-row:hover .message-actions, .message-row:focus-within .message-actions { opacity: 1; transform: translateY(0); }
}

.conversation-loading { grid-row: 1; grid-column: 1; z-index: 8; display: grid; place-items: center; align-content: center; gap: 11px; background: rgba(5,5,5,.82); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); color: #a9a9ae; font-size: 11px; }
.conversation-loading-mark { width: 24px; height: 24px; border: 2px solid rgba(230,57,70,.22); border-top-color: var(--red); border-radius: 50%; animation: spin .75s linear infinite; }
.composer-wrap { grid-row: 2; position: relative; z-index: 10; padding: 8px max(18px, env(safe-area-inset-right), calc((100% - 860px) / 2)) calc(9px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left), calc((100% - 860px) / 2)); background: linear-gradient(180deg, transparent, rgba(5,5,5,.94) 34%); }
.composer-wrap.keyboard-open { padding-bottom: 8px; }
.composer {
  border: 1px solid rgba(255,255,255,.12); background: rgba(24,24,25,.97); border-radius: 27px;
  box-shadow: 0 12px 34px rgba(0,0,0,.4); transition: border-color .2s, box-shadow .2s;
}
.composer.has-files { border-radius: 18px; }
.composer.locked { border-color: rgba(255,255,255,.08); box-shadow: none; }
.composer:focus-within, .composer.dragging { border-color: rgba(230,57,70,.46); box-shadow: 0 12px 34px rgba(0,0,0,.44), 0 0 0 2px rgba(230,57,70,.065); }
.attachment-tray { display: flex; gap: 8px; padding: 11px 11px 0; overflow-x: auto; }
.attachment-card { position: relative; flex: 0 0 106px; height: 76px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #0b0b0c; }
.attachment-card img { width: 100%; height: 100%; display: block; object-fit: cover; }
.attachment-card .file-fallback { height: 100%; display: grid; place-items: center; padding: 8px; color: var(--muted); font-size: 10px; text-align: center; }
.attachment-remove { position: absolute; top: 0; right: 0; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: transparent; cursor: pointer; font-size: 16px; }
.attachment-remove svg { width: 28px; height: 28px; padding: 5px; border-radius: 50%; background: rgba(0,0,0,.82); }
.attachment-status { position: absolute; inset: auto 0 0; padding: 4px 6px; background: rgba(0,0,0,.82); color: #ddd; font-size: 9px; }
.attachment-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.15); }
.attachment-progress span { display: block; height: 100%; background: var(--red); }
.composer-input { display: flex; align-items: flex-end; gap: 5px; padding: 4px 5px; }
.attachment-menu-wrap { position: relative; flex: 0 0 44px; }
.attachment-menu { position: absolute; z-index: 20; left: 0; bottom: calc(100% + 9px); width: min(250px, calc(100vw - 30px)); display: grid; gap: 3px; padding: 6px; border: 1px solid rgba(255,255,255,.13); border-radius: 14px; background: #171719; box-shadow: 0 18px 56px rgba(0,0,0,.62); animation: menu-in .18s var(--ease) both; }
.attachment-menu button { min-height: 52px; display: grid; grid-template-columns: 34px minmax(0,1fr); align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px; background: transparent; color: #d4d4d8; text-align: left; cursor: pointer; }
.attachment-menu button:hover { background: rgba(255,255,255,.055); }
.attachment-menu button > svg { justify-self: center; color: #b2b2b7; }
.attachment-menu button > span { min-width: 0; display: grid; gap: 2px; }
.attachment-menu strong { font-size: 11px; }
.attachment-menu small { overflow: hidden; color: #838389; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.attach-button, .send-button, .stop-button { flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; }
.attach-button { background: transparent; color: #c4c4c8; border: 1px solid transparent; }
.attach-button:hover { background: rgba(255,255,255,.05); border-color: var(--line); }
.send-button { background: var(--red-cta); color: #fff; font-size: 18px; font-weight: 900; }
.send-button:disabled, .attach-button:disabled { opacity: .38; cursor: not-allowed; }
.stop-button { background: #2a2021; color: #ffabb1; border: 1px solid rgba(230,57,70,.28); }
.composer textarea { min-width: 0; min-height: 44px; max-height: 144px; flex: 1; resize: none; overflow-y: auto; border: 0; outline: 0; background: transparent; padding: 11px 4px 10px; line-height: 1.45; font-size: 15px; }
.composer textarea::placeholder { color: #9a9aa0; }
.composer-error { margin: 0 0 8px; color: #ff9da4; font-size: 11px; }

.limit-wall { max-width: 760px; margin: 6px auto 10px; padding: 17px 18px; border: 1px solid rgba(230,57,70,.28); border-radius: 15px; background: linear-gradient(135deg, rgba(230,57,70,.095), rgba(20,20,21,.96)); }
.limit-wall h3 { margin: 0 0 6px; font-size: 16px; }
.limit-wall p { margin: 0; color: #aaaab0; font-size: 12px; line-height: 1.5; }
.limit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 13px; }
.primary, .secondary { min-height: 44px; padding: 0 15px; border-radius: 12px; cursor: pointer; font-size: 12px; font-weight: 800; }
.primary { background: var(--red-cta); color: #fff; }
.secondary { background: transparent; border: 1px solid var(--line); color: #e4e4e7; }
.store-note { margin-top: 9px !important; font-size: 10px !important; color: #9a9aa0 !important; }

.boot { height: var(--ai-viewport-height, 100dvh); display: grid; place-items: center; text-align: center; padding: 24px; }
.boot-mark { width: 44px; height: 44px; margin: 0 auto 15px; border: 2px solid rgba(230,57,70,.2); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
.boot h1 { margin: 0; font-size: 20px; }
.boot p { color: var(--muted); max-width: 420px; line-height: 1.5; font-size: 13px; }
.boot button { margin-top: 14px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); background: rgba(0,0,0,.72); backdrop-filter: blur(10px); }
.modal { width: min(440px, 100%); min-height: 0; max-height: min(720px, 100%); overflow-y: auto; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; background: #121213; box-shadow: 0 30px 100px rgba(0,0,0,.78); padding: 22px; animation: modal-in .25s var(--ease) both; }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.modal h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.modal h2:focus { outline: none; }
.modal-copy { margin: 7px 0 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-close { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 10px; background: transparent; cursor: pointer; color: var(--muted); font-size: 20px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; gap: 3px; background: #09090a; border-radius: 12px; margin-bottom: 16px; }
.auth-tabs button { min-height: 44px; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 750; }
.auth-tabs button.active { color: #fff; background: #202022; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { color: #c4c4c7; font-size: 11px; font-weight: 750; }
.field input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 11px; background: #09090a; padding: 0 12px; outline: 0; font-size: 14px; }
.field input:focus { border-color: rgba(230,57,70,.6); }
.field small { color: #9a9aa0; font-size: 10px; }
.auth-error { color: #ff9da4; font-size: 11px; line-height: 1.45; margin: 4px 0 12px; }
.auth-success { color: #a9e4be; background: rgba(88,201,133,.08); border: 1px solid rgba(88,201,133,.22); border-radius: 11px; padding: 11px; font-size: 12px; line-height: 1.45; margin-bottom: 13px; }
.auth-submit { width: 100%; }
.auth-submit:disabled { opacity: .5; cursor: wait; }
.privacy-note { color: #9a9aa0; font-size: 10px; line-height: 1.45; margin: 12px 0 0; }
.google-auth-control { position: relative; width: 100%; min-height: 44px; display: grid; place-items: center; }
.google-auth-control.busy { opacity: .58; pointer-events: none; }
.google-auth-slot { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.google-auth-slot iframe { max-width: 100%; }
.google-auth-status { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 0 14px; border: 1px solid var(--line); border-radius: 4px; background: #0d0d0e; color: #a6a6ab; text-align: center; font-size: 11px; line-height: 1.35; }
.google-auth-status.error { color: #ffb0b6; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: #808086; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.allowance-meter { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); }
.allowance-meter-copy { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #cfcfd3; font-size: 11px; }
.allowance-meter-copy strong { font-size: 12px; }
.allowance-meter small { color: #8f8f95; font-size: 10px; }
.allowance-track { height: 5px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.08); }
.allowance-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #bd2c38, var(--red-light)); transition: width .35s var(--ease); }

.limit-modal-backdrop { z-index: 115; }
.limit-modal { width: min(640px, 100%); max-height: 100%; }
.limit-modal .allowance-meter { margin-bottom: 15px; }
.product-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
.product-card { display: flex; flex-direction: column; min-height: 250px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #0c0c0d; }
.product-eyebrow { color: var(--red-light); font-size: 10px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.product-card h3 { margin: 9px 0 12px; font-size: 17px; line-height: 1.24; letter-spacing: -.025em; }
.product-card ul { display: grid; gap: 7px; margin: 0 0 18px; padding-left: 17px; color: #aaaab0; font-size: 11px; line-height: 1.45; }
.product-cta { width: 100%; margin-top: auto; }
.limit-store-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.store-unavailable { min-height: 44px; display: inline-flex; align-items: center; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; color: #77777d; font-size: 11px; font-weight: 750; }
.download-qr { width: fit-content; display: grid; grid-template-columns: 82px auto; align-items: center; gap: 12px; margin-top: 14px; color: #aaaab0; font-size: 10px; }
.download-qr svg { width: 82px; height: 82px; border-radius: 9px; }

.account-popover-backdrop { position: fixed; inset: 0; z-index: 105; background: rgba(0,0,0,.34); }
.account-popover {
  position: absolute; top: calc(74px + env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right), calc((100vw - 1440px) / 2));
  width: min(410px, calc(100vw - 28px)); max-height: calc(var(--ai-viewport-height, 100dvh) - 92px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto;
  padding: 17px 17px max(17px, env(safe-area-inset-bottom)); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: #111112;
  box-shadow: 0 28px 90px rgba(0,0,0,.72); animation: modal-in .22s var(--ease) both;
}
.account-popover:focus { outline: none; }
.account-popover-head { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 9px; margin-bottom: 12px; }
.account-popover-head > div { min-width: 0; display: grid; gap: 3px; }
.account-popover-head strong, .account-popover-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-popover-head strong { font-size: 13px; }
.account-popover-head span { color: var(--muted); font-size: 10px; }
.account-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 13px 0 10px; padding: 3px; border-radius: 11px; background: #09090a; }
.account-tabs button { min-height: 40px; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 750; }
.account-tabs button.active { color: #fff; background: #202022; }
.account-section { display: grid; gap: 10px; }
.account-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #d0d0d4; font-size: 11px; }
.account-section-head button { min-height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 10px; }
.conversation-list, .memory-list { display: grid; gap: 6px; max-height: 248px; overflow-y: auto; }
.conversation-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px; border: 1px solid var(--line); border-radius: 11px; background: #0b0b0c; overflow: hidden; }
.conversation-row.active { border-color: rgba(230,57,70,.35); }
.conversation-open { min-width: 0; display: grid; gap: 3px; padding: 10px; text-align: left; background: transparent; cursor: pointer; }
.conversation-open strong, .conversation-open span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-open strong { font-size: 11px; }
.conversation-open span { color: #7f7f85; font-size: 9px; }
.conversation-delete { min-height: 44px; padding: 0 10px; background: transparent; color: #b57d82; cursor: pointer; font-size: 9px; }
.memory-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; color: #c0c0c4; font-size: 10px; line-height: 1.4; }
.memory-row button { min-height: 36px; padding: 0 8px; border-radius: 8px; background: transparent; color: #b57d82; cursor: pointer; font-size: 9px; }
.account-help, .account-empty { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.privacy-action { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; color: #bcbcc0; font-size: 10px; }
.privacy-action.danger { color: #c9848a; border-color: rgba(230,57,70,.2); }
.account-footer-actions { display: grid; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.account-link { min-height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: transparent; color: #99999f; cursor: pointer; font-size: 10px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes response-pulse { 0%, 100% { opacity: .42; transform: scale(.82); box-shadow: 0 0 0 0 rgba(230,57,70,.2); } 50% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 4px rgba(230,57,70,0); } }
@keyframes streaming-cursor { 0%, 48% { opacity: 1; } 49%, 100% { opacity: .15; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes drawer-in { from { opacity: .7; transform: translateX(-24px); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }

@media (max-width: 900px) {
  .ai-layout { grid-template-columns: 228px minmax(0, 1fr); }
  .conversation-rail-content { padding-inline: 10px; }
  .coach-panel { padding: 24px 16px; }
  .coach-panel h2 { font-size: 21px; }
  .starter { padding-inline: 8px; }
}
@media (max-width: 720px) {
  body { overflow: hidden; }
  .ai-page { min-height: 0; }
  .ai-header { height: calc(58px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(9px, env(safe-area-inset-right)) 0 max(9px, env(safe-area-inset-left)); }
  .ai-header-inner { height: 58px; }
  .header-leading { gap: 2px; }
  .conversation-toggle { display: grid; }
  .brand img { width: 29px; height: 29px; }
  .back-label { display: none; }
  .header-meta { margin-left: auto; gap: 7px; }
  .header-action, .account-control { min-height: 44px; min-width: 44px; padding: 0 8px; border-radius: 10px; font-size: 9px; }
  .new-button { display: none; }
  .account-control:not(.signed-in) { padding-inline: 12px; }
  .account-control.signed-in { min-width: 44px; padding: 0 4px; }
  .account-control.signed-in .account-label { display: none; }
  .account-avatar { width: 28px; height: 28px; }
  .allowance { font-size: 10px; padding: 0 10px; }
  .allowance-full { display: none; }
  .allowance-compact { display: inline; }
  .offline-bar { top: calc(59px + env(safe-area-inset-top)); }
  .ai-layout { display: block; height: 100%; }
  .conversation-rail { display: none; }
  .drawer-new-chat { display: inline-flex; }
  .drawer-return-zone { display: grid; }
  .coach-panel { display: none; }
  .chat { height: 100%; }
  .messages { padding: 22px 15px 12px; }
  .empty-state { justify-content: flex-start; padding: 48px 0 32px; }
  .empty-state h2 { font-size: 29px; }
  .empty-state p { font-size: 13px; }
  .empty-starters { display: none; }
  .mobile-starters { width: 100%; display: flex; gap: 8px; overflow-x: auto; padding: 24px 2px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .mobile-starters::-webkit-scrollbar { display: none; }
  .mobile-starters .starter { flex: 0 0 188px; min-height: 76px; padding: 10px; background: rgba(255,255,255,.025); border-color: var(--line); scroll-snap-align: start; }
  .message { max-width: 94%; }
  .message.assistant { max-width: 100%; }
  .message-actions button { min-height: 44px; }
  .composer-wrap { padding: 7px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .composer-wrap.keyboard-open { padding-bottom: 7px; }
  .composer { border-radius: 27px; }
  .composer.has-files { border-radius: 17px; }
  .composer textarea { max-height: 120px; font-size: 16px; touch-action: manipulation; }
  .limit-wall { margin-inline: 0; }
  .limit-actions .primary { flex: 1 1 100%; }
  .account-popover { position: absolute; top: calc(64px + env(safe-area-inset-top)); right: max(7px, env(safe-area-inset-right)); left: max(7px, env(safe-area-inset-left)); width: auto; max-height: calc(var(--ai-viewport-height, 100dvh) - 72px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding-bottom: max(17px, env(safe-area-inset-bottom)); border-radius: 16px; }
  .account-tabs button, .account-section-head button, .privacy-action, .account-link, .memory-row button { min-height: 44px; }
  .product-card { min-height: 0; }
  .limit-modal { padding: 17px; }
  .download-qr { display: none; }
}

@media (hover: none) and (pointer: coarse) and (min-width: 721px) {
  body { overflow: hidden; }
  .ai-page { min-height: 0; }
  .conversation-toggle { display: grid; }
  .header-meta { margin-left: auto; }
  .new-button { display: none; }
  .ai-layout { display: block; height: 100%; }
  .conversation-rail, .coach-panel { display: none; }
  .drawer-new-chat { display: inline-flex; }
  .drawer-return-zone { display: grid; }
  .chat { height: 100%; }
}

@media (max-width: 360px) {
  .ai-header { padding-left: max(6px, env(safe-area-inset-left)); padding-right: max(6px, env(safe-area-inset-right)); }
  .ai-header-inner { gap: 3px; }
  .brand { min-width: 44px; justify-content: center; gap: 7px; font-size: 12px; }
  .brand img { width: 26px; height: 26px; }
  .brand > span:not(.back-label) { display: none; }
  .header-meta { gap: 5px; }
  .allowance { min-width: 44px; min-height: 44px; justify-content: center; gap: 5px; padding: 0 6px; font-size: 9px; }
  .allowance-dot { width: 6px; height: 6px; }
  .composer-wrap { padding-left: max(6px, env(safe-area-inset-left)); padding-right: max(6px, env(safe-area-inset-right)); }
  .composer-input { gap: 3px; padding: 4px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .ai-header { height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }
  .ai-header-inner { height: 52px; }
  .header-meta { margin-left: auto; }
  .new-button { display: none; }
  .offline-bar { top: calc(53px + env(safe-area-inset-top)); }
  .ai-layout { display: block; height: 100%; }
  .conversation-toggle { display: grid; }
  .conversation-rail { display: none; }
  .drawer-new-chat { display: inline-flex; }
  .drawer-return-zone { display: grid; }
  .coach-panel { display: none; }
  .chat { height: 100%; }
  .messages { padding-top: 14px; padding-bottom: 8px; }
  .empty-state { justify-content: flex-start; padding: 18px 0 20px; }
  .empty-state h2 { margin-top: 12px; font-size: 26px; }
  .empty-state p { font-size: 12px; }
  .empty-starters { display: none; }
  .mobile-starters { display: flex; width: 100%; gap: 8px; overflow-x: auto; padding: 14px 2px 2px; }
  .mobile-starters .starter { flex: 0 0 188px; min-height: 68px; }
  .composer-wrap { padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom)); }
  .composer-wrap.keyboard-open { padding-bottom: 5px; }
  .composer-wrap.keyboard-open .composer-error { max-height: 32px; overflow-y: auto; margin-bottom: 4px; line-height: 1.35; -webkit-overflow-scrolling: touch; }
  .composer textarea { max-height: 88px; font-size: 16px; touch-action: manipulation; }
  .account-popover { top: calc(58px + env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); left: max(14px, env(safe-area-inset-left)); width: auto; max-height: calc(var(--ai-viewport-height, 100dvh) - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding-bottom: max(17px, env(safe-area-inset-bottom)); }
}

@media (pointer: coarse) {
  .message-actions button { min-height: 44px; }
  .composer textarea { font-size: 16px; touch-action: manipulation; }
  .field input { font-size: 16px; }
}

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