/* AIwithSpoorthi app: the shared look for every in-app page (Community, Ria, and the areas to come).
   Locked system: cream ground, espresso ink, sand second neutral, terracotta for the primary action,
   Apple's font for every word (SF Pro on an iPhone or a Mac, Inter elsewhere), semibold headings; Instrument Serif only in the
   logo (--mark). Since 5 Oct, at her word "We need to follow the same thing" (Apple's pages). Page-specific styles stay in each page. */
:root {
  color-scheme: light;
  --ground: #F8F4EF;
  --sheet: #FFFDFC;
  --sand: #EADFD6;
  --sand-2: #F1E9E2;
  --ink: #3D2F2A;
  --muted: #6B5A52;
  --faint: #715F57;
  --line: rgba(61, 47, 42, .12);
  --line-strong: rgba(61, 47, 42, .2);
  --accent: #C85C3E;
  --accent-hover: #A64A30;
  --accent-ink: #A64A30;
  --on-accent: #FFFDFC;
  --ok: #2E7D32;
  --ok-soft: rgba(46, 125, 50, .1);
  --warn: #8A5300;
  --warn-soft: rgba(199, 119, 0, .12);
  --err: #B23A2B;
  --ria: #5B4A8B;
  --ria-soft: rgba(91, 74, 139, .1);
  --code-bg: #2A211D;
  --code-ink: #EFE6DF;
  --focus: #C85C3E;
  --mark: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, Inter, 'Segoe UI', Roboto, system-ui, sans-serif;
  --serif: var(--sans); /* the old name, kept so nothing falls back to a browser serif */
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #1C1613;
  --sheet: #241C18;
  --sand: #33281F;
  --sand-2: #2B221D;
  --ink: #F3EAE2;
  --muted: #C4B3A8;
  --faint: #A3928A;
  --line: rgba(243, 234, 226, .1);
  --line-strong: rgba(243, 234, 226, .18);
  --accent: #D9714F;
  --accent-hover: #E58765;
  --accent-ink: #E8906F;
  --on-accent: #1C1613;
  --ok: #7CC47F;
  --ok-soft: rgba(124, 196, 127, .12);
  --warn: #E0A95A;
  --warn-soft: rgba(224, 169, 90, .12);
  --err: #EF8A7B;
  --ria: #B7A6E8;
  --ria-soft: rgba(183, 166, 232, .12);
  --code-bg: #120E0C;
  --focus: #E8906F;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(223, 167, 143, .45); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.ico { width: 18px; height: 18px; flex-shrink: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr) var(--side-w, 300px); min-height: 100%; }
.rail { position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 22px; padding: 22px 14px 18px; background: var(--sand-2); border-right: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; min-height: 40px; padding: 0 10px; font: 400 23px/1 var(--mark); text-decoration: none; white-space: nowrap; }
.wordmark em { font-style: italic; }
.areas { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.areas a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px; border-radius: var(--r-sm); color: var(--muted); font-weight: 500; font-size: 14.5px; text-decoration: none; transition: background .15s, color .15s; }
.areas a:hover { background: var(--sand); color: var(--ink); }
.areas a[aria-current="page"] { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.areas a[aria-current="page"] .ico { color: var(--accent-ink); }
/* areas a signed-in reader can't open yet (app.js areas(); each page's <head> sets data-areas-closed from the last visit) */
html[data-areas-closed~="radar"] .areas [data-area="radar"], html[data-areas-closed~="buildlab"] .areas [data-area="buildlab"],
html[data-areas-closed~="workflows"] .areas [data-area="workflows"], html[data-areas-closed~="library"] .areas [data-area="library"],
html[data-areas-closed~="hood"] .areas [data-area="hood"] { display: none !important; }
/* Ria's opening cards for an area the reader can't open aren't offered (Under the Hood keeps its card: it is left as is) */
html[data-areas-closed~="radar"] .starter[data-area="radar"], html[data-areas-closed~="buildlab"] .starter[data-area="buildlab"],
html[data-areas-closed~="workflows"] .starter[data-area="workflows"], html[data-areas-closed~="library"] .starter[data-area="library"] { display: none !important; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-md); }
.me b { display: block; font-size: 14px; font-weight: 500; }
.me small { display: block; font-size: 12.5px; color: var(--faint); }
.main { min-width: 0; padding: 26px clamp(16px, 3vw, 40px) 80px; }
.col { max-width: 700px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.side { position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; height: 100dvh; overflow-y: auto; display: grid; align-content: start; gap: 26px; padding: 26px 22px; border-left: 1px solid var(--line); }
.head p.preview { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 12.5px; color: var(--faint); }
.preview .ico { width: 15px; height: 15px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.head h1 { margin: 0; font: 600 40px/1.1 var(--sans); letter-spacing: -.015em; }
.head p { margin: 6px 0 0; font-size: 14.5px; color: var(--muted); }
/* avatars: initials on warm tints, no stock faces */
.av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font: 600 13px/1 var(--sans); color: #3D2F2A; background: var(--c, #EADFD6); }
.av.sm { width: 26px; height: 26px; font-size: 11px; }
.av.ria { background: var(--ria-soft); color: var(--ria); }
.av.ria .ico { width: 16px; height: 16px; }
.av.host { overflow: hidden; background: var(--sand); }
.av.host img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; transform: scale(1.5); transform-origin: 50% 12%; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field input, .field textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--sheet); font-size: 15px; line-height: 1.5; }
.field textarea { min-height: 96px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200, 92, 62, .18); }
.field[data-invalid] input { border-color: var(--err); }
/* a password box with Show (sign in, setup, Settings) */
.pwf { display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 6px 0 16px; border-radius: 14px; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--line-strong); transition: box-shadow .15s; }
.pwf:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px rgba(200, 92, 62, .16); }
.pwf[data-invalid] { box-shadow: inset 0 0 0 2px var(--err); }
.pwf input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; font-size: 16px; color: var(--ink); }
.pwf input:focus, .pwf input:focus-visible { outline: none; }
.pw-show { flex-shrink: 0; min-width: 60px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: none; font-size: 14px; font-weight: 600; color: var(--accent-ink); }
.pw-show:hover { background: var(--sand-2); }
.err { font-size: 13px; color: var(--err); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font-weight: 500; font-size: 14.5px; transition: background .15s, border-color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.badge-host { padding: 1px 8px; border-radius: 999px; background: var(--sand); color: var(--accent-ink); font-size: 11.5px; font-weight: 600; }
.badge-ai { padding: 1px 8px; border-radius: 999px; background: var(--ria-soft); color: var(--ria); font-size: 11.5px; font-weight: 600; }
.thinking { display: flex; gap: 6px; padding: 6px 0; }
.thinking i { width: 60px; height: 9px; border-radius: 6px; background: linear-gradient(90deg, var(--sand-2), var(--sand), var(--sand-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.thinking i:nth-child(2) { width: 120px; } .thinking i:nth-child(3) { width: 80px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.btn-sm { min-height: 42px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: .6; cursor: progress; }
.skel { display: grid; gap: 10px; padding: 4px 0; }
.skel i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--sand-2), var(--sand), var(--sand-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skel i:nth-child(2) { width: 70%; }
.skel-feed { padding: 24px 20px; gap: 18px; }
.skel-feed i { height: 64px; border-radius: 12px; }
.gate { display: grid; justify-items: start; gap: 12px; padding: 28px 24px; border-radius: var(--r-lg); background: var(--sheet); box-shadow: 0 0 0 1px var(--line); }
.gate h2 { margin: 0; font: 600 28px/1.12 var(--sans); letter-spacing: -.01em; }
.gate p { margin: 0; color: var(--muted); max-width: 46ch; }
.gate .btn { text-decoration: none; }
/* the note at the end of what a free account reads (AWS.nudge) */
.nudge { display: grid; justify-items: start; gap: 10px; margin: 32px 0 8px; padding: 22px 22px 20px; border-radius: var(--r-lg); background: var(--sheet); box-shadow: 0 0 0 1px var(--line); }
.nudge h2 { margin: 0; font: 600 24px/1.15 var(--sans); letter-spacing: -.01em; color: var(--ink); }
.nudge p { margin: 0; color: var(--muted); font-size: 15.5px; line-height: 1.5; max-width: 52ch; }
.nudge-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.nudge .btn { text-decoration: none; min-height: 44px; }
.gate-alt { font-size: 14px; }
.gate-alt a { color: var(--accent-ink); font-weight: 500; text-underline-offset: .2em; }
.head .preview[hidden] { display: none; }
body.gated .me { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .skel i { animation: none; } }
.head-actions { position: relative; display: flex; gap: 8px; margin-top: 2px; }
.iconbtn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--sheet); color: var(--muted); }
.iconbtn:hover, .iconbtn[aria-expanded="true"] { color: var(--ink); border-color: var(--line-strong); }
.iconbtn[aria-expanded="true"] { background: var(--sand-2); }
.iconbtn.flat { border-color: transparent; background: transparent; }
.iconbtn.acct .av { width: 30px; height: 30px; font-size: 11.5px; }
.badge { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 600 11px/19px var(--sans); text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--ground); }
.badge[hidden] { display: none; }
body.gated .member-only { display: none; }
.pop { position: absolute; z-index: 40; top: 50px; right: 0; width: min(380px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow: auto; overscroll-behavior: contain; border-radius: var(--r-md); background: var(--sheet); box-shadow: 0 0 0 1px var(--line), 0 24px 48px -20px rgba(61, 47, 42, .45); }
.pop[hidden] { display: none; }
.pop-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; background: var(--sheet); border-bottom: 1px solid var(--line); }
.pop-head h2 { margin: 0; font: 600 14px/1.3 var(--sans); }
.linkbtn { min-height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--accent-ink); font-size: 13px; font-weight: 500; }
.linkbtn:hover { background: var(--sand-2); }
.linkbtn[hidden] { display: none; }
.acct-pop { width: 240px; padding: 6px; }
.acct-who { padding: 10px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-who b { display: block; font-weight: 600; font-size: 14px; }
.acct-who small { display: block; font: 12.5px/1.4 var(--mono); color: var(--faint); }
.acct-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; text-align: left; }
.acct-item:hover { background: var(--sand-2); }
.acct-item[hidden] { display: none; }
a.acct-item { color: inherit; text-decoration: none; }
.switch { position: relative; width: 32px; height: 18px; margin-left: auto; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--sheet); transition: transform .15s; }
[aria-checked="true"] .switch { background: var(--accent); }
[aria-checked="true"] .switch::after { transform: translateX(14px); }
.dlg { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--r-lg); background: var(--sheet); color: var(--ink); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .5); }
.dlg::backdrop { background: rgba(28, 22, 19, .45); }
.dlg form { display: grid; gap: 14px; padding: 22px; }
.dlg h2 { margin: 0; font: 600 26px/1.12 var(--sans); letter-spacing: -.01em; }
.dlg p { margin: 0; color: var(--muted); }
.dlg .row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.btn-danger { background: var(--err); color: var(--on-accent); }
.btn-danger:hover { filter: brightness(.94); }
.side .side-h { margin: 0 0 12px; font: 600 13px/1.4 var(--sans); color: var(--ink); }
.side-note { font-size: 13px; color: var(--faint); }
/* toast */
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; display: inline-flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--ground); font-size: 14px; font-weight: 500; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .4); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.on { opacity: 1; transform: none; }
@media (max-width: 1179px) {
  .app { grid-template-columns: 76px minmax(0, 1fr); }
  .side { display: none; }
  .rail { padding-inline: 10px; align-items: center; }
  .wordmark span, .areas a span, .me span { display: none; }
  .wordmark { padding: 0; font-size: 22px; }
  .wordmark::before { content: "A"; }
  .wordmark .full { display: none; }
  .areas a { justify-content: center; padding: 0; width: 48px; }
  .me { padding: 0; }
}
/* iPhone Safari zooms the whole page when a field under 16px gets focus, and doesn't zoom back. On a touch screen every field is at least
   16px (found 30 Sep: Ria's box was 15.5px, Settings and Community's 15px). The one-time code boxes are bigger already and keep their size. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="hidden"]):not(.code-in), textarea, select { font-size: 16px !important; }
}
/* the phone's "More" tab and its sheet (app.js): never on a computer or tablet, where the rail lists every area */
.areas li.more-tab, .more-sheet { display: none; }
@media (max-width: 760px) {
  body { font-size: 15px; }
  .areas li.more-tab:not([hidden]) { display: block; }
  .more-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 56px; min-height: 52px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font: 500 11px/1.2 var(--sans); cursor: pointer; }
  .more-open .rail { z-index: 48; }
  .more-btn .ico { width: 22px; height: 22px; }
  .more-btn[aria-expanded="true"], .more-btn.on { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
  .more-btn.on .ico { color: var(--accent-ink); }
  .more-sheet { display: grid; gap: 2px; position: absolute; z-index: 47; right: 10px; bottom: 100%; margin-bottom: 8px; width: min(280px, calc(100vw - 24px)); padding: 6px; border-radius: var(--r-md); background: var(--sheet); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(42, 31, 27, .16); }
  .more-sheet .more-link { display: flex; width: auto; min-width: 0; flex-direction: row; justify-content: flex-start; align-items: center; gap: 14px; min-height: 52px; padding: 0 14px; border-radius: var(--r-sm); color: var(--ink); font: 500 16px/1.2 var(--sans); text-decoration: none; }
  .more-sheet .more-link .ico { width: 22px; height: 22px; flex-shrink: 0; color: var(--muted); }
  .more-sheet .more-link:hover, .more-sheet .more-link:focus-visible { background: var(--sand); }
  .more-sheet .more-link[aria-current="page"] { background: var(--sand-2); }
  .more-sheet .more-link[aria-current="page"] .ico { color: var(--accent-ink); }

  .app { display: block; }
  .rail { position: fixed; z-index: 20; inset: auto 0 0 0; height: auto; flex-direction: row; justify-content: center; gap: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); border-right: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sand-2) 94%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .wordmark, .me { display: none; }
  .areas { display: flex; width: 100%; justify-content: space-around; }
  .areas li.more-m { display: none; }
  .areas a { width: auto; min-width: 56px; flex-direction: column; gap: 3px; min-height: 52px; font-size: 11px; }
  .areas a span { display: block; }
  .main { padding: 16px 16px 110px; }
  /* a 320 to 374px phone: six tabs of 56px don't fit, so each takes an equal share (More was pushed off the screen) */
  @media (max-width: 374px) {
    .rail { padding-inline: 2px; }
    .areas > li { flex: 1 1 0; min-width: 0; }
    .areas a, .more-btn { min-width: 0; width: 100%; padding-inline: 0; font-size: 10px; }
  }
  .head h1 { font-size: 34px; }
  @media (max-width: 374px) { .head h1 { font-size: 30px; } } /* Community's title and its three buttons on one 320px line */
  .toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
