/* Forever Guide planning page. Colours, type and spacing follow the site's assets/css/site.css
   (spacing 4 8 12 16 24 32 40 48, radius 8 12 16 9999, one easing). No third party requests: the Geist
   fonts load from the site itself when this page is served at /app/, and fall back to the system font
   anywhere else. */

@font-face {
  font-family: "Geist";
  src: url("../assets/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../assets/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #131209;
  --raised: #181818;
  --raised-2: #1f1f1f;
  --raised-3: #272727;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f2f0ea;
  --muted: #a9a59b;
  --gold: #d9a760;
  --gold-hover: #e2b676;
  --on-gold: #131209;
  --ok: #8fd18f;
  --err: #f0a08a;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, p { margin: 0; }
h1, h2 { font-weight: 600; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
code { font-family: var(--mono); }
[hidden] { display: none !important; }
::selection { background: rgba(217, 167, 96, 0.35); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: 0; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon { width: 20px; height: 20px; flex: none; display: block; }

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

/* Top bar */
.top {
  max-width: 720px; margin: 0 auto; padding: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
@media (min-width: 640px) { .top { padding: 24px; } }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; }
.brand svg { color: var(--gold); }
.brand:hover { opacity: 0.8; }
.handle { color: var(--muted); font-size: 14px; line-height: 20px; min-height: 44px; display: inline-flex; align-items: center; }
.handle:hover { color: var(--text); }

/* The link back to the setup page (only when opened from ../start/) */
.setup-step { font-size: 14px; line-height: 20px; }
.setup-step a {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9999px; background: var(--raised); color: var(--muted);
  transition: color 300ms var(--ease), border-color 300ms var(--ease);
}
.setup-step a:hover { color: var(--text); border-color: var(--line-strong); }
.setup-step a:active { transform: translateY(1px); }
.setup-n { color: var(--gold); font-weight: 600; }

/* Headline */
main { padding-bottom: 32px; }
h1 { margin-top: 16px; font-size: 30px; line-height: 36px; letter-spacing: -0.02em; }
@media (min-width: 640px) { h1 { font-size: 36px; line-height: 40px; } }
.lead { margin-top: 12px; color: var(--muted); font-size: 18px; line-height: 28px; }

/* Cards */
.card {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--raised);
}
@media (min-width: 640px) { .card { padding: 24px; } }
.card h2 { display: flex; align-items: center; gap: 12px; font-size: 20px; line-height: 28px; }
.n {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 28px; height: 28px; border-radius: 9999px;
  background: rgba(217, 167, 96, 0.14); color: var(--gold);
  font-size: 14px; line-height: 20px; font-weight: 600;
}
.hint { margin-top: 8px; color: var(--muted); }
.small { font-size: 14px; line-height: 20px; margin-top: 8px; }
.muted { color: var(--muted); }
.err { color: var(--err); }
.chip {
  display: inline-block; padding: 0 8px; border-radius: 6px;
  background: var(--raised-3); border: 1px solid var(--line);
  font-size: 14px; line-height: 22px; color: var(--text); white-space: nowrap;
}
.eyebrow { color: var(--gold); font-size: 14px; line-height: 20px; font-weight: 600; }

/* Fields */
label { display: block; margin-top: 16px; font-size: 14px; line-height: 20px; font-weight: 500; }
input, select, textarea {
  display: block; width: 100%; margin-top: 8px;
  font: inherit; color: var(--text);
  background: var(--raised-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
  transition: border-color 300ms var(--ease);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--gold); }
select { appearance: auto; }
textarea { resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 20px; }
.paste { margin-top: 16px; min-height: 240px; }
@media (min-width: 640px) { .paste { min-height: 320px; } }
.plantext { min-height: 160px; }
::placeholder { color: rgba(169, 165, 155, 0.7); }

.keyform { margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--line); }

/* Buttons */
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 16px;
  border-radius: 9999px;
  font-size: 16px; line-height: 24px; font-weight: 600;
  transition: transform 300ms var(--ease), background-color 300ms var(--ease), border-color 300ms var(--ease), opacity 300ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-primary { background: var(--gold); color: var(--on-gold); }
.btn-primary:hover:not(:disabled) { background: var(--gold-hover); }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.btn-sm { font-size: 14px; line-height: 20px; padding: 8px 12px; }
@media (max-width: 420px) { .row .btn { width: 100%; } }

/* Connection */
.connected { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.dot { width: 8px; height: 8px; border-radius: 9999px; background: var(--ok); flex: none; }

/* Working state */
.status { margin-top: 12px; min-height: 24px; color: var(--muted); }
.status.err { color: var(--err); }
.status.busy::before {
  content: ""; display: inline-block; vertical-align: -3px;
  width: 16px; height: 16px; margin-right: 8px;
  border: 2px solid var(--line-strong); border-top-color: var(--gold); border-radius: 9999px;
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status.busy::before { animation: none; } }

/* Result */
.result { border-color: rgba(217, 167, 96, 0.4); }
.result h2 { margin-top: 8px; font-size: 24px; line-height: 32px; }
#r-count { margin-top: 4px; }
#r-summary { margin-top: 12px; }
#copy-note { color: var(--ok); min-height: 20px; }
details { margin-top: 16px; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; line-height: 20px; min-height: 44px; display: flex; align-items: center; }
summary:hover { color: var(--text); }

/* Footer */
.foot { padding-top: 16px; padding-bottom: 48px; color: var(--muted); font-size: 14px; line-height: 20px; }
.foot p + p { margin-top: 8px; }
.text-link { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.text-link:hover { color: var(--gold); text-decoration-color: var(--gold); }

/* Local mode (the page served by the companion): the setup panel. Unused on the public page. */
.lrow { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.lrow:first-of-type { border-top: 0; padding-top: 0; }
.lrow h3 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--muted); text-transform: none; }
.lline { margin-top: 4px; }
.lline.ok, .small.ok { color: var(--ok); }
.lline.err { color: var(--err); }
.switchrow { display: flex; align-items: center; gap: 12px; margin-top: 8px; min-height: 44px; font-size: 16px; line-height: 24px; font-weight: 500; cursor: pointer; }
.switch {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 44px; height: 26px; min-height: 0; margin: 0; padding: 0;
  border-radius: 9999px; border: 1px solid var(--line-strong); background: var(--raised-3);
  position: relative; cursor: pointer; transition: background-color 300ms var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 9999px; background: var(--muted); transition: transform 300ms var(--ease), background-color 300ms var(--ease);
}
.switch:checked { background: rgba(217, 167, 96, 0.35); border-color: var(--gold); }
.switch:checked::after { transform: translateX(18px); background: var(--gold); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
.notice { margin-top: 16px; padding: 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--raised-2); }
.notice h3 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.notice p { margin-top: 4px; }
.notice .eyebrow { margin-top: 0; }
.notice-err { border-color: rgba(240, 160, 138, 0.45); }
.inuse { color: var(--muted); }
.path { margin-top: 2px; font-family: var(--mono); font-size: 13px; line-height: 20px; color: var(--muted); overflow-wrap: anywhere; }
.lline { overflow-wrap: anywhere; }
.local .paste { min-height: 160px; }
.local #lp-status:empty { min-height: 0; margin-top: 0; }
