/* Roz's page. Kept out of index.html so the Content-Security-Policy in _headers can
   forbid inline styles. */

/* The site's typeface for its games' text boxes (SIL Open Font License), used here
   for Roz's name only: it is too dense for reading answers. */
@font-face {
  font-family: "Press Start 2P";
  src: url("/fonts/press-start-2p-latin.woff2") format("woff2");
  font-display: swap;
}

/* The site's palette, value for value: Congo's slate neutrals and the montenegro red
   (assets/css/schemes/montenegro.css, palette "B": vivid red on a deep night blue), used the way the site uses them: white or
   neutral-800 behind everything, primary-600/800 for buttons, primary-700/400 for links.
   Plus the colours Roz and Brightbill need to stay visible on each theme. */
:root {
  --bg: #ffffff;              /* neutral */
  --glow: rgba(251, 191, 36, 0.10);
  --surface: #f8fafc;         /* neutral-50 */
  --surface-2: #f1f5f9;       /* neutral-100 */
  --border: #e2e8f0;          /* neutral-200 */
  --text: #0c1220;            /* neutral-900 */
  --muted: #64748b;           /* neutral-500 */
  --primary: #f01626;         /* primary-600: buttons, as the site's */
  --primary-hover: #ff3838;   /* primary-500 */
  --accent: #c80c1e;          /* primary-700: Roz's name, arrows (5.95:1 on white; primary-600 was 4.33, under AA for small text) */
  --on-primary: #ffffff;
  --link: #c80c1e;            /* primary-700: links, as in the site's prose */
  --focus: #ff6363;
  --outline: #2b3138;
  --limb: #55616a;
  --grass: #6a9a4a;
  --geese: #94a3b8;
  --bubble-border: #26314a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151c2c;              /* neutral-800, the site's dark background */
    --glow: rgba(239, 68, 68, 0.10);
    --surface: #1e273b;         /* neutral-700 at half over the background */
    --surface-2: #1a2233;
    --border: #26314a;          /* neutral-700 */
    --text: #e2e8f0;            /* neutral-200 */
    --muted: #94a3b8;           /* neutral-400 */
    --primary: #a00a1b;         /* primary-800: buttons, as the site's */
    --primary-hover: #c80c1e;   /* primary-700 */
    --accent: #ff6363;          /* primary-400 */
    --on-primary: #ffffff;
    --link: #ff6363;            /* primary-400: links, as in the site's prose */
    --focus: #ff6363;
    --outline: #5b6875;
    --limb: #93a1ab;
    --grass: #4d7a35;
    --geese: #64748b;
    --bubble-border: #94a3b8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151c2c;              /* neutral-800, the site's dark background */
  --glow: rgba(239, 68, 68, 0.10);
  --surface: #1e273b;         /* neutral-700 at half over the background */
  --surface-2: #1a2233;
  --border: #26314a;          /* neutral-700 */
  --text: #e2e8f0;            /* neutral-200 */
  --muted: #94a3b8;           /* neutral-400 */
  --primary: #a00a1b;         /* primary-800: buttons, as the site's */
  --primary-hover: #c80c1e;   /* primary-700 */
  --accent: #ff6363;          /* primary-400 */
  --on-primary: #ffffff;
  --link: #ff6363;            /* primary-400: links, as in the site's prose */
  --focus: #ff6363;
  --outline: #5b6875;
  --limb: #93a1ab;
  --grass: #4d7a35;
  --geese: #64748b;
  --bubble-border: #94a3b8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  color: var(--text);
  /* A low sun behind the ground Roz walks on: dawn on the light theme, dusk on the dark. */
  background: radial-gradient(120% 60% at 50% 100%, var(--glow), transparent 70%) var(--bg);
  background-attachment: fixed;
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pixel { font-family: "Press Start 2P", ui-monospace, monospace; letter-spacing: 0.02em; }

/* The site's own header, as Congo draws it: Caesar's Window on the left, back to the
   site, and the same menu on the right (only the logo on phones, where the site has
   its hamburger), inside the site's width and side margins. */
.site-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
}
@media (min-width: 640px) { .site-header { padding: 24px 56px; } }
@media (min-width: 768px) { .site-header { padding: 28px 96px; } }
@media (min-width: 1024px) { .site-header { padding: 32px 128px; } }
.site-logo { display: block; flex: none; }
.site-logo img { display: block; width: 48px; height: 48px; }
@media (min-width: 640px) { .site-logo img { width: 64px; height: 64px; } }
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-dark { display: block !important; }
  :root:not([data-theme="light"]) .logo-light { display: none !important; }
}
.site-right { display: flex; align-items: center; gap: 28px; }
@media (max-width: 639px) { .site-right { gap: 10px; } }
/* ES · EN: the current language in the site's red, the other muted. */
.lang-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.lang-button:hover { border-color: var(--muted); }
.lang-button .on { color: var(--accent); }
.site-nav { display: none; }
@media (min-width: 640px) {
  .site-nav { display: flex; gap: 28px; font-size: 1.125rem; font-weight: 600; }
}
.site-nav a { color: var(--text); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--accent); }

.app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.roz-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--accent);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.avatar canvas { image-rendering: pixelated; }
.title { min-width: 0; flex: 1; }
.title h1 { margin: 0; font-size: 0.95rem; line-height: 1.4; color: var(--accent); }
.title p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.3; }
.tools { flex: none; display: flex; gap: 6px; }
.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
}
.icon-button:hover { color: var(--text); border-color: var(--muted); }
.icon-button svg { width: 18px; height: 18px; }
.icon-button[hidden] { display: none; }
/* The theme button shows where it will take you: a moon on light, a sun on dark. */
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-dark { display: block; }
  :root:not([data-theme="light"]) .theme-icon-light { display: none; }
}
.accent { color: var(--accent); }

#log {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overscroll-behavior: contain;
}

.intro { margin: auto 0; text-align: center; padding: 12px 0; }
.intro h2 { margin: 0 0 14px; font-size: 1.15rem; line-height: 1.5; }
.intro .why { margin: 0 auto 6px; max-width: 32em; }
.intro .why em { font-style: italic; }
.intro details { margin: 0 auto 14px; max-width: 32em; color: var(--muted); font-size: 0.92rem; }
.intro summary { cursor: pointer; color: var(--link); list-style: none; display: inline-block; }
.intro summary::-webkit-details-marker { display: none; }
.intro details p { margin: 8px 0 0; }
.intro .ask { margin: 0 auto 18px; color: var(--muted); max-width: 32em; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.suggestions button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}
.suggestions button:hover { border-color: var(--accent); }

.msg { flex: none; max-width: 88%; padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: var(--on-primary);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.assistant p { margin: 0 0 0.6em; }
.msg.assistant p:last-child, .msg.assistant ul:last-child, .msg.assistant ol:last-child { margin-bottom: 0; }
.msg.assistant ul, .msg.assistant ol { margin: 0 0 0.6em; padding-left: 1.3em; }
.msg.assistant code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.msg.error { align-self: center; color: var(--muted); font-size: 0.9rem; text-align: center; }
.msg.assistant:empty { display: none; }
/* Under each answer: helpful or not, copy, share. */
.msg-actions { flex: none; align-self: flex-start; display: flex; gap: 4px; margin-top: -6px; }
.msg-actions .act {
  min-width: 34px; height: 30px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--muted); font: inherit; font-size: 0.9rem; cursor: pointer;
}
.msg-actions .act:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.msg-actions .act:disabled { cursor: default; opacity: 0.45; }
.msg-actions .act.on { opacity: 1; border-color: var(--accent); background: var(--surface); }
/* Two questions to keep going, written by Roz for this answer. */
.followups { flex: none; align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; max-width: 88%; }
.followups button {
  padding: 6px 11px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.86rem; cursor: pointer; text-align: left;
}
.followups button::before { content: "→ "; color: var(--accent); font-weight: 700; }
.followups button:hover { border-color: var(--accent); }

/* Where Roz and Brightbill live: a strip of ground just above the box. */
#stage {
  position: relative;
  flex: none;
  height: 104px;
  margin: 0 16px;
}
#stage canvas { position: absolute; inset: 0; image-rendering: pixelated; cursor: pointer; }
.bubble {
  position: absolute;
  bottom: 40px;
  padding: 7px 11px;
  border: 2px solid var(--bubble-border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.35;
  text-align: left;
  box-shadow: 3px 3px 0 var(--border);
  cursor: default;
  z-index: 2;
  animation: pop 0.18s steps(3);
}
.bubble[data-question="1"] { cursor: pointer; border-color: var(--accent); }
.bubble[data-question="1"]::before { content: "→ "; color: var(--accent); font-weight: 700; }
/* The tail points sideways, at Roz's head. */
.bubble::after {
  content: "";
  position: absolute;
  bottom: 12px;
  border: 6px solid transparent;
}
.bubble[data-side="right"]::after { right: 100%; border-right-color: var(--bubble-border); }
.bubble[data-side="left"]::after { left: 100%; border-left-color: var(--bubble-border); }
.bubble[data-question="1"][data-side="right"]::after { border-right-color: var(--accent); }
.bubble[data-question="1"][data-side="left"]::after { border-left-color: var(--accent); }
@keyframes pop { from { transform: translateY(4px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .bubble { animation: none; } }

form {
  display: flex;
  gap: 8px;
  padding: 0 16px calc(12px + env(safe-area-inset-bottom));
}
textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 140px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  overflow-y: hidden;
}
textarea::placeholder { color: var(--muted); }
form button {
  flex: none;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: var(--on-primary);
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
form button:hover:not(:disabled) { background: var(--primary-hover); }
form button:disabled { opacity: 0.5; cursor: default; }

footer { padding: 0 16px 10px; color: var(--muted); font-size: 0.75rem; text-align: center; }
/* Her version, after the notice: small, in her pixel font, a step quieter than the text. */
footer .version { display: inline-block; margin-left: 0.4em; font-family: "Press Start 2P", ui-monospace, monospace; font-size: 0.5rem; letter-spacing: 0.04em; opacity: 0.75; white-space: nowrap; }
footer .version::before { content: "·"; margin-right: 0.6em; font-family: system-ui, sans-serif; font-size: 0.75rem; }
#turnstile { display: flex; justify-content: center; }
#turnstile:empty { display: none; }

@media (max-width: 480px) {
  #stage { height: 96px; }
}

/* Read by assistive technology only (the finished answer is announced from here). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
