/* The public page's own look: friendly, bright and rounded. All values come from tokens.css (light by default, a cosy dark on
   request). Nothing here flashes or glows; motion is small, springy and stops for prefers-reduced-motion. */
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--c-ink); background: var(--c-bg); font: var(--w-normal) var(--t-md)/1.5 var(--font); }
body { background-image: radial-gradient(900px 420px at 12% -8%, var(--c-wash-sun), transparent 70%),
                         radial-gradient(800px 480px at 92% 0%, var(--c-wash-sky), transparent 70%); background-attachment: fixed; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }
button, select, input { font: inherit; }
.small { font-size: var(--t-sm); } .muted { color: var(--c-ink-2); }

/* ---- the keeper's strip (the public page has no banner) ---- */
.banner { position: sticky; top: 0; z-index: 40; padding: var(--s-2) var(--s-5); font-size: var(--t-sm); font-weight: var(--w-bold); text-align: center; }

/* ---- header ---- */
header { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); flex-wrap: wrap; max-width: 1280px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: var(--s-3); }
.logo { width: 52px; height: 35px; }
.logo-shell { fill: var(--w-clover); stroke: var(--c-ink); stroke-width: 2.4; }
.logo-seams { fill: none; stroke: var(--c-ink); stroke-width: 1.6; stroke-linecap: round; opacity: .5; }
.logo-head { fill: var(--w-moss); stroke: var(--c-ink); stroke-width: 2; }
.logo-eye { fill: var(--c-ink); }
.brand-name { font-size: var(--t-xl); font-weight: var(--w-heavy); letter-spacing: .01em; }
.sub { flex: 1 1 260px; font-weight: var(--w-bold); color: var(--c-ink-2); }
.conn { padding: var(--s-1) var(--s-3); border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: var(--w-heavy); background: var(--c-surface-2); color: var(--c-ink-2); border: 2px solid var(--c-line); }
.conn.ok { color: var(--c-leaf-ink); border-color: var(--c-leaf); }
.conn.ok::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--c-leaf); }
.theme-toggle { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 40px; padding: var(--s-2) var(--s-4); cursor: pointer; border-radius: var(--r-pill);
  border: 2px solid var(--c-line); background: var(--c-surface); color: var(--c-ink); font-weight: var(--w-bold); box-shadow: var(--sh-1); transition: transform var(--dur) var(--ease-spring); }
.theme-toggle:hover { transform: translateY(-1px) rotate(-1deg); } .theme-toggle:active { transform: scale(.96); }
.theme-toggle .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="dark"] .theme-toggle .ico { fill: var(--c-sun); stroke: var(--c-sun); }
:root[data-theme="light"] .theme-toggle .ico { stroke: var(--c-sun-ink); }

/* ---- layout and panels ---- */
main { padding: var(--s-2) var(--s-5) var(--s-5); display: grid; gap: var(--s-5); max-width: 1280px; margin: 0 auto; }
.panel, .card { background: var(--c-surface); border: 2px solid var(--c-line); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--sh-1); }
.map-panel { padding: var(--s-3); }
h2, h3 { margin: 0 0 var(--s-3); font-size: var(--t-lg); font-weight: var(--w-heavy); color: var(--c-ink); }
h3 { font-size: var(--t-md); }
.legend { margin-top: var(--s-3); color: var(--c-ink-2); font-size: var(--t-sm); padding: 0 var(--s-2); }
footer { text-align: center; padding: var(--s-5); }
.scene-wrap { border: 2px solid var(--c-line); border-radius: var(--r-lg); background: var(--map-frame); box-shadow: none; overflow: hidden; }

/* ---- turtle cards ---- */
.turtles { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: var(--s-5); }
.card.asleep { background: var(--c-surface-2); }
.card .head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.name { font-size: var(--t-lg); font-weight: var(--w-heavy); }
.tag { font-size: var(--t-xs); font-weight: var(--w-heavy); padding: 2px var(--s-3); border-radius: var(--r-pill); background: var(--c-mint); color: var(--c-on-accent); }
.tag.sleep { background: var(--c-sky); }
.where { color: var(--c-ink-2); margin: var(--s-1) 0 var(--s-3); font-weight: var(--w-bold); }
.thought { font-style: italic; min-height: 1.5em; margin-bottom: var(--s-4); font-size: var(--t-md); }
.bars { margin-bottom: var(--s-4); }
.tabs { display: flex; gap: var(--s-2); margin: var(--s-3) 0; flex-wrap: wrap; }
.tabs button { background: var(--c-surface-2); color: var(--c-ink-2); border: 2px solid var(--c-line); border-radius: var(--r-pill); padding: var(--s-1) var(--s-4); cursor: pointer; font-weight: var(--w-bold); min-height: 36px; }
.tabs button.on { background: var(--c-leaf); color: var(--c-on-accent); border-color: var(--c-leaf); }
.pane { max-height: 300px; overflow: auto; border-top: 2px dashed var(--c-line); padding-top: var(--s-3); font-size: var(--t-sm); }
.row { padding: var(--s-1) 0; border-bottom: 1px dashed var(--c-line); word-break: break-word; }
.k { display: inline-block; min-width: 70px; font-size: var(--t-xs); font-weight: var(--w-heavy); color: var(--c-leaf-ink); }
.k.mind { color: var(--c-sky-ink); } .k.felt { color: var(--c-warn-ink); } .k.noticed { color: var(--c-ink-2); }
.fail { color: var(--c-bad); } .why { color: var(--c-ink-2); font-size: var(--t-xs); }

/* ---- forms and buttons ---- */
form { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
input[type=text], select { background: var(--c-surface); color: var(--c-ink); border: 2px solid var(--c-line); border-radius: var(--r-md); padding: var(--s-2) var(--s-3); min-height: 44px; }
input[type=text] { flex: 1; min-width: 220px; }
input:focus, select:focus { border-color: var(--c-focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-focus) 30%, transparent); }
form button { background: var(--c-leaf); color: var(--c-on-accent); border: 0; border-radius: var(--r-pill); padding: var(--s-2) var(--s-5); min-height: 44px; font-weight: var(--w-heavy); cursor: pointer;
  box-shadow: 0 3px 0 rgba(var(--c-shadow), .22); transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur); }
form button:hover { transform: translateY(-2px); box-shadow: 0 5px 0 rgba(var(--c-shadow), .22); }
form button:active { transform: translateY(1px) scale(.98); box-shadow: 0 1px 0 rgba(var(--c-shadow), .22); }

/* ---- details (the page's own panel, used only if the shared panel cannot load) ---- */
.detail .row { display: flex; gap: var(--s-3); } .detail .k { min-width: 92px; flex: none; }
.detail h3 { font-size: var(--t-lg); }

/* ---- homes ---- */
.homes { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: var(--s-4); }
.home-card { border: 2px solid var(--c-line); border-radius: var(--r-lg); padding: var(--s-3); background: var(--c-surface-2); }
.home-svg { width: 100%; height: auto; display: block; border-radius: var(--r-md); }
.home-card .cap { display: flex; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-2); flex-wrap: wrap; align-items: baseline; }
.home-card .turtle { filter: none; transition: none; }
.home-card .tag, .home-card .zz, .home-card .act { display: none; }
.home-card .turtle.asleep .zz { display: block; }

@media (max-width: 700px) {
  main { padding: var(--s-2) var(--s-3) var(--s-4); gap: var(--s-4); }
  header { padding: var(--s-3); gap: var(--s-2) var(--s-3); }
  .brand-name { font-size: var(--t-lg); } .logo { width: 40px; height: 27px; }
  .sub { order: 5; flex-basis: 100%; font-size: var(--t-sm); }
  .panel, .card { padding: var(--s-4); }
  .turtles { grid-template-columns: 1fr; }
  .detail .row { flex-direction: column; gap: 0; }
  .scene .label { font-size: 30px; stroke-width: 6px; }
  .scene .tag { font-size: 26px; }
  .scene .hud-text { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
