:root {
  --bg: 0.72;
  --fs: 15px;
  /* Warm stone neutrals + one amber accent, taken from the app icon (ink face, cream, yellow sparkle). */
  --tint: 255, 255, 255;        /* rgb of the overlays/lines on dark, used as rgba(var(--tint), a) */
  --base: 16, 17, 20;           /* neutral near-black: warm tints read as faint red when see-through */
  --ink: #1c1917;
  --cream: #fef8ef;             /* primary text, selected states */
  --text-2: #d6d3d1;            /* stone-300, labels */
  --text-3: #a8a29e;            /* stone-400, hints: ~7:1 on the base */
  --accent: #fcbd39;            /* icon yellow, used sparingly */
  --accent-hi: #fdcb5e;
  --accent-soft: rgba(252, 189, 57, 0.18);
  --warn: #e5484d;              /* red: visible in screen share, muted, errors */
  --warn-hi: #f2555a;
  --warn-soft: rgba(229, 72, 77, 0.25);
  --live: #22c55e;              /* green: mic is listening */
  --live-soft: rgba(34, 197, 94, 0.22);
  --surface: #1c1d22;           /* dialog */
  --ease: cubic-bezier(0.2, 0, 0, 1);
}
* { box-sizing: border-box; }
/* The OS cursor shows up in screen shares even though the window doesn't, so it never changes over the overlay. */
*, *::before, *::after { cursor: default !important; }

/* Invisible resize grips along the window edges (see the resize code in app.js). */
.grip { position: fixed; z-index: 1000; -webkit-app-region: no-drag; }
.grip[data-edge=n], .grip[data-edge=s] { left: 10px; right: 10px; height: 5px; }
.grip[data-edge=e], .grip[data-edge=w] { top: 10px; bottom: 10px; width: 5px; }
.grip[data-edge=n] { top: 0; } .grip[data-edge=s] { bottom: 0; }
.grip[data-edge=e] { right: 0; } .grip[data-edge=w] { left: 0; }
.grip[data-edge=ne], .grip[data-edge=nw], .grip[data-edge=se], .grip[data-edge=sw] { width: 10px; height: 10px; }
.grip[data-edge=ne] { top: 0; right: 0; } .grip[data-edge=nw] { top: 0; left: 0; }
.grip[data-edge=se] { bottom: 0; right: 0; } .grip[data-edge=sw] { bottom: 0; left: 0; }
html, body { height: 100%; margin: 0; background: transparent; overflow: hidden; }
body { font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", sans-serif; color: var(--cream); }

#card {
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: rgba(var(--base), var(--bg));
  border: 1px solid rgba(var(--tint), 0.14);
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75); /* keeps text readable at low background */
}
header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px 4px 12px;
  font-size: 12px;
  -webkit-app-region: drag;
  flex: none;
}
header button { -webkit-app-region: no-drag; }
.spacer { flex: 1; }
#dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; box-shadow: 0 0 0 3px rgba(var(--tint), 0.06); transition: background 0.2s, box-shadow 0.2s; }
#dot.ok { background: var(--live); box-shadow: 0 0 0 3px var(--live-soft); }
#dot.error { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
#status { color: var(--warn-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#status:not(.error) { display: none; } /* only problems get words; the dot covers everything else */
#latency { color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.divider { width: 1px; height: 12px; background: rgba(var(--tint), 0.16); margin: 0 2px; flex: none; }

button {
  font: inherit;
  font-size: 12px;
  color: var(--text-2);
  background: rgba(var(--tint), 0.1);
  border: 0;
  border-radius: 6px;
  padding: 3px 8px;
}
button:hover { background: rgba(var(--tint), 0.2); }
button.icon {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  transition: background 0.15s, transform 0.1s;
}
button.icon:active { transform: scale(0.92); }
button.icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button.icon.ghost { width: 25px; height: 25px; background: transparent; color: var(--text-3); }
button.icon.ghost svg { width: 14px; height: 14px; }
button.icon.ghost:hover { background: rgba(var(--tint), 0.12); color: var(--cream); }
button.icon.danger:hover { background: var(--warn-soft); color: var(--warn-hi); }
#listen .off-icon, #listen.muted .on-icon { display: none; }
#listen.muted .off-icon { display: block; }
#listen:hover { background: rgba(var(--tint), 0.22); }
#listen.muted { background: var(--warn); color: #fff; }
#listen.muted:hover { background: var(--warn-hi); }
#capture:hover, #now:hover { background: rgba(var(--tint), 0.22); }
#now { background: var(--accent); color: var(--ink); }
#now:hover { background: var(--accent-hi); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#settings {
  flex: 0 1 auto;
  overflow-y: auto;
  padding: 2px 12px 12px;
  border-bottom: 1px solid rgba(var(--tint), 0.12);
  display: grid;
  gap: 8px;
  font-size: 12px;
  text-shadow: none;
}
.group {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(var(--tint), 0.045);
  border: 1px solid rgba(var(--tint), 0.07);
}
.group h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.field { display: flex; align-items: center; gap: 10px; min-height: 26px; }
.label { width: 76px; flex: none; color: var(--text-2); }
.hint { margin: -4px 0 0 86px; color: var(--text-3); font-size: 11.5px; line-height: 1.4; }
.hint:empty { display: none; }
.field input[type=text] {
  flex: 1;
  min-width: 0;
  height: 26px;
  font: inherit;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(var(--tint), 0.08);
  border-radius: 7px;
  padding: 0 9px;
}
.field input[type=text]::placeholder, textarea::placeholder { color: #78716c; }

/* segmented control */
.seg { display: flex; flex: 1; padding: 2px; gap: 2px; border-radius: 8px; background: rgba(0, 0, 0, 0.28); }
.seg button { flex: 1; height: 22px; padding: 0 6px; background: transparent; color: var(--text-2); border-radius: 6px; transition: background 0.15s, color 0.15s; }
.seg button:hover { background: rgba(var(--tint), 0.08); color: var(--cream); }
.seg button.on { background: var(--cream); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }

/* text size stepper */
.stepper { display: flex; align-items: center; padding: 2px; border-radius: 8px; background: rgba(0, 0, 0, 0.28); }
.stepper button { width: 26px; height: 22px; padding: 0; background: transparent; font-size: 14px; line-height: 1; }
.stepper button:hover { background: rgba(var(--tint), 0.1); color: var(--cream); }
.stepper output { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cream); font-weight: 600; }
.stepper output::after { content: 'px'; color: var(--text-3); margin-left: 1px; }

/* live preview of the answer text, using the same classes as the feed */
.preview {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(var(--base), var(--bg));
  border: 1px dashed rgba(var(--tint), 0.16);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  overflow: hidden;
}
.preview .answer li:last-child { margin-bottom: 0; }

/* sliders */
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 18px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(var(--tint), 0.16); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.value { width: 34px; flex: none; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* switch */
.switch-row { align-items: flex-start; }
.switch-text { flex: 1; display: grid; gap: 2px; }
.switch-text .label { width: auto; }
.switch-text .hint { margin: 0; }
.switch {
  position: relative;
  width: 34px;
  height: 20px;
  padding: 0;
  flex: none;
  border-radius: 10px;
  background: rgba(var(--tint), 0.18);
  transition: background 0.2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}
.switch[aria-checked=true] { background: var(--warn); }
.switch[aria-checked=true]::after { transform: translateX(14px); }
.switch:hover { filter: brightness(1.1); }

textarea {
  width: 100%;
  resize: none;
  font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(var(--tint), 0.08);
  border-radius: 7px;
  padding: 7px 9px;
}
textarea:focus-visible, .field input[type=text]:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }
.actions button { height: 24px; padding: 0 10px; }
#contextInfo { color: var(--text-3); font-size: 11px; }
#contextInfo.warn { color: var(--warn-hi); }

/* shortcuts accordion */
#shortcuts summary { display: flex; align-items: center; justify-content: space-between; list-style: none; }
#shortcuts summary::-webkit-details-marker { display: none; }
#shortcuts summary::after { content: ''; width: 6px; height: 6px; border: solid var(--text-3); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin: -3px 2px 0 0; transition: transform 0.2s; }
#shortcuts[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
#shortcuts summary:hover h3 { color: var(--text-2); }
#shortcutList { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 0; align-items: center; }
#shortcutList dt { color: var(--text-2); }
#shortcutList dd { margin: 0; display: flex; gap: 3px; justify-content: flex-end; }
kbd {
  min-width: 20px;
  padding: 1px 5px;
  text-align: center;
  font-family: inherit;
  font-size: 11px;
  line-height: 16px;
  color: var(--text-2);
  background: rgba(var(--tint), 0.1);
  border: 1px solid rgba(var(--tint), 0.1);
  border-bottom-width: 2px;
  border-radius: 5px;
}

/* screen share pill, always at the top left */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px 0 6px;
  flex: none;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 600;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  color: var(--text-2);
  background: rgba(var(--tint), 0.08);
  text-shadow: none;
}
.pill:hover { background: rgba(var(--tint), 0.14); }
.pill svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pill .visible-icon, .pill.exposed .hidden-icon { display: none; }
.pill.exposed .visible-icon { display: block; }
.pill.exposed { color: #fff; background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.pill.exposed:hover { background: var(--warn-hi); }

/* typed confirmation before showing in screen share */
#card { position: relative; }
.modal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(8, 9, 11, 0.7);
  backdrop-filter: blur(6px);
  text-shadow: none;
}
.sheet {
  width: 100%;
  max-width: 320px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid rgba(var(--tint), 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.sheet h2 { margin: 0; font-size: 14px; font-weight: 600; }
.sheet p { margin: 0; font-size: 12px; color: var(--text-2); }
.sheet b { color: var(--cream); font-weight: 600; }
.sheet input {
  height: 30px;
  font: inherit;
  font-size: 13px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(var(--tint), 0.12);
  border-radius: 7px;
  padding: 0 10px;
}
.sheet input:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.sheet .actions button { height: 28px; padding: 0 12px; }
button.warn { background: var(--warn); color: #fff; font-weight: 600; }
button.warn:hover { background: var(--warn-hi); }
button:disabled, button:disabled:hover { opacity: 0.4; cursor: default; background: rgba(var(--tint), 0.1); color: var(--text-2); }

#body { flex: 1 1 0; min-height: 60px; overflow-y: auto; padding: 2px 14px 12px; }
#live, .question { margin: 0 0 6px; font-size: calc(var(--fs) - 3px); }
#live { color: var(--text-3); font-style: italic; }
.question { color: var(--accent); }
#live:empty { display: none; }
.entry { padding: 8px 0; }
.entry + .entry { border-top: 1px solid rgba(var(--tint), 0.14); }
.answer { font-size: var(--fs); font-weight: 500; }
.answer ul { margin: 0; padding-left: 18px; }
.answer li { margin-bottom: 4px; }
.answer p { margin: 0 0 6px; }
.answer pre { margin: 0 0 8px; padding: 8px 10px; overflow-x: auto; border-radius: 6px; background: rgba(0, 0, 0, 0.35); font-size: calc(var(--fs) - 2px); line-height: 1.4; }
.answer code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 400; white-space: pre; }
.answer.err { color: var(--warn-hi); }
.answer.options { display: grid; gap: 6px; }
#jump { position: sticky; bottom: 4px; margin: 4px auto 0; background: var(--accent); color: var(--ink); }
#jump[hidden] { display: none; }
#jump:hover { background: var(--accent-hi); }
.option {
  display: grid;
  gap: 4px;
  padding: 7px 10px;
  border: 1px solid rgba(var(--tint), 0.16);
  border-radius: 8px;
}
.option strong { font-size: calc(var(--fs) - 1px); font-weight: 600; color: var(--cream); }
.option p:last-child, .option li:last-child { margin-bottom: 0; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(var(--tint), 0.16); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--tint), 0.28); }

/* dialog enters with a short scale+fade; exits instantly */
.modal:not([hidden]) { animation: fade 0.18s var(--ease); }
.modal:not([hidden]) .sheet { animation: rise 0.2s var(--ease); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: scale(0.96) translateY(4px); } }
button { transition: background 0.15s var(--ease), color 0.15s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
