/* Totem Town — design system (UI-1).
 *
 * One dark system for every page, unified from the three dark mockups in
 * docs/design/ (profile, world feed, birth ceremony), which each carried
 * their own palette. Decisions recorded in
 * docs/DECISIONES-INTERFAZ-2026-09-11.md:
 *
 *   - Ground is the deep navy of the profile/feed mockups.
 *   - Every accent has ONE job (the feed mockup's own idea: "un color fijo
 *     por categoría para reconocer actividad de un vistazo"). Never pick an
 *     accent because it looks nice here: pick the one that means this.
 *   - Lime is the ceremony's "a life ignites" color and stays reserved for
 *     the totem acting on its own; coral is the human's color, and it only
 *     ever appears on a SUGGESTION (constitutional UI rule).
 *
 * Pages import this before their own <style>, and should only add layout
 * that is genuinely page-specific.
 */

:root {
  /* Ground and surfaces */
  --bg: #070b17;
  --panel: #10182a;
  --panel-2: #151f34;
  --line: #263451;
  --line-soft: rgba(255, 255, 255, .08);

  /* Type */
  --text: #f7f8ff;
  --muted: #a9b6cf;
  --faint: #6f7d98;

  /* Semantic accents — one job each */
  --life: #d8ff62;     /* the totem acting: birth, "alive now", its decisions */
  --owner: #ff806e;    /* the human: suggestions, owner CTAs. Never a world action */
  --kuri: #f7c95a;     /* money: salary, Kuri, purchases */
  --social: #39ded5;   /* friends, likes, followers */
  --work: #8bdd7c;     /* shifts, employment, progress */
  --craft: #b7a3ff;    /* skills, courses, moments */
  --world: #75a9ff;    /* zones, events, weather, the world itself */

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 50px rgba(0, 0, 0, .35);

  color-scheme: dark;

  /* -- legacy bridge (TEMPORARY, UI-1) --------------------------------
   * Every page written before the dark system carried the same cream
   * palette under these names. Re-pointing them here turns all of them
   * dark at once, with no markup rewritten, so the product is never
   * half cream and half navy while UI-2..UI-5 rebuild the pages one by
   * one. Each rebuilt page drops its old names; when the last one is
   * done, this block is deleted.
   *
   * --coral deliberately does NOT map to --owner. In the old pages
   * coral was decoration (caption rules, brand); --owner means "a human
   * is suggesting something" and must not leak onto ornament. */
  --card: var(--panel);
  --ink: var(--text);
  --mut: var(--muted);
  --teal: var(--social);
  --teal-d: #1f8a83;
  --coral: var(--craft);
  --chip: var(--panel-2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* An author `display:` beats the UA sheet's [hidden] rule, so any
   component with its own display (a flex card, a grid) would stay
   visible after el.hidden = true. Make hidden mean hidden. */
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 76px; /* room for the mobile tab bar */
}

@media (min-width: 901px) { body { padding-bottom: 24px; } }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 14px; }
.wrap-wide { max-width: 960px; margin: 0 auto; padding: 0 14px; }

/* -- header ---------------------------------------------------------- */

header.top {
  /* Absolute controls (back, share, language) anchor here: see the rev. 6
     regression where they fell back to the viewport and the desktop top
     bar covered them. */
  position: relative;
  background: linear-gradient(160deg, #0d1830 0%, #0a1122 60%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  padding: 46px 18px 22px;
  text-align: center;
}

header.top h1 { font-size: 24px; letter-spacing: -.01em; }
header.top .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
/* Positioning is the PAGE's call, same as .lang: the chapter and moment
   pages lay their back link out in flow above the title, and forcing it
   absolute here dropped it on top of them. Only .float is pinned. */
header.top .back {
  color: var(--muted); text-decoration: none; font-size: 14px;
}
header.top .back.float { position: absolute; top: 14px; left: 14px; }
header.top .back:hover { color: var(--text); }

.eyebrow {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); font-weight: 700;
}

/* -- panels ---------------------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 14px 0;
}

.panel h2 { font-size: 17px; margin-bottom: 2px; }
.panel .note { color: var(--muted); font-size: 13px; }

.section-title {
  font-size: 13px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 24px 0 8px;
}

/* -- stats row ------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
}

.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}

.stat b {
  display: block; font-size: 20px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat.social b { color: var(--social); }
.stat.craft b { color: var(--craft); }
.stat.kuri b { color: var(--kuri); }

/* -- pills and chips -------------------------------------------------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 5px 11px;
  font-size: 12px; font-weight: 700;
  border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted);
}
.pill.life { color: var(--life); border-color: rgba(216, 255, 98, .35); }
.pill.world { color: var(--world); border-color: rgba(117, 169, 255, .35); }
.pill.kuri { color: var(--kuri); border-color: rgba(247, 201, 90, .35); }
.pill.tier { color: var(--craft); border-color: rgba(183, 163, 255, .4); }

/* -- buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 12px; padding: 12px 16px;
  font-size: 14.5px; font-weight: 700; cursor: pointer;
  text-decoration: none; font-family: inherit;
}
.btn:hover { border-color: var(--muted); }

/* The owner's colour. A coral button is ALWAYS a suggestion to the totem,
   never a world action: the constitutional rule made visible. */
.btn.suggest { background: rgba(255, 128, 110, .12); border-color: rgba(255, 128, 110, .45); color: var(--owner); }
.btn.suggest:hover { background: rgba(255, 128, 110, .2); }

.btn.primary { background: var(--life); border-color: var(--life); color: #14210a; }
.btn.primary:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .5; cursor: default; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row .btn { flex: 1 1 auto; }

.suggest-note {
  color: var(--faint); font-size: 12px; margin-top: 8px; text-align: center;
  line-height: 1.5;
}

/* WALK-2: the owner's own words. The two coral buttons are shortcuts
   for the two commonest things to say; this is the channel itself.
   Production ran 561 turns and produced zero advice with an advice
   board that had no box to write in. */
.advice-box {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 78px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2); color: var(--text);
  padding: 11px 12px; font-family: inherit; font-size: 14px; line-height: 1.55;
}
.advice-box::placeholder { color: var(--faint); }
.advice-box:focus { outline: none; border-color: rgba(255, 128, 110, .55); }

.advice-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.advice-count { font-size: 12px; color: var(--faint); margin-right: auto; }
/* The shortcuts stay coral -- a coral button is always a suggestion --
   but they are smaller than the send button, so the box reads as the
   channel and they read as what they are: two things people say often. */
.advice-shortcuts { margin-top: 12px; }
.advice-shortcuts .btn { padding: 9px 12px; font-size: 13px; }

/* OWNER-1 on the web: today's reason to say something. It describes a
   situation and never recommends -- the moment it recommends, the
   advice stops being the human's (see owner_loop.py). */
.ask {
  font-size: 13.5px; line-height: 1.6; color: var(--text);
  border-left: 2px solid var(--owner); padding-left: 12px; margin-bottom: 14px;
}
.ask ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.ask li { margin-top: 3px; }
.ask-quota { font-size: 12px; color: var(--faint); margin-top: 8px; }

/* -- progress -------------------------------------------------------- */

.bar {
  height: 7px; border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
}
.bar > i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--accent, var(--social));
  transition: width .5s ease;
}

.pillar { margin: 12px 0; }
.pillar .row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-bottom: 5px;
}
.pillar .name { font-size: 13.5px; font-weight: 600; }
.pillar .num {
  font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pillar.met .name { color: var(--muted); }
.pillar.met .num::after { content: " ✓"; color: var(--work); }

/* Each pillar keeps its own colour so the ladder reads at a glance.
   The rotation is FIVE colours, not six: --owner (coral) is excluded on
   purpose. Coral means "a human is suggesting something"; a progress bar
   is the totem's own earned progress, so lending it coral would say the
   owner did it. Never add --owner to this list to get more variety. */
.pillar:nth-child(5n+1) { --accent: var(--work); }
.pillar:nth-child(5n+2) { --accent: var(--social); }
.pillar:nth-child(5n+3) { --accent: var(--kuri); }
.pillar:nth-child(5n+4) { --accent: var(--craft); }
.pillar:nth-child(5n)   { --accent: var(--world); }

.bottleneck {
  background: rgba(183, 163, 255, .1);
  border: 1px solid rgba(183, 163, 255, .3);
  border-radius: var(--radius-sm);
  padding: 12px 14px; margin-top: 14px;
  font-size: 13.5px; line-height: 1.5;
}

/* -- ladder ---------------------------------------------------------- */

.ladder { display: flex; gap: 6px; margin: 14px 0 4px; }
.ladder .step {
  flex: 1; text-align: center; font-size: 10.5px; letter-spacing: .04em;
  color: var(--faint); padding-top: 10px;
  border-top: 3px solid var(--line);
}
.ladder .step.on { color: var(--craft); border-top-color: var(--craft); }
.ladder .step.now { color: var(--text); font-weight: 700; }

/* -- moment cards ---------------------------------------------------- */

.moment {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0;
}
.moment .head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.moment .facts { padding: 10px 16px 0; font-size: 14.5px; line-height: 1.45; }
.moment .caption {
  margin: 10px 16px 0; padding: 9px 12px;
  border-left: 3px solid var(--craft);
  background: var(--panel-2); border-radius: 0 10px 10px 0;
  color: var(--muted); font-size: 13.5px; font-style: italic;
}
.moment .foot {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px 14px; color: var(--faint); font-size: 12.5px;
}
.moment .foot .verified { color: var(--work); font-weight: 700; }

.who .nm { font-weight: 700; font-size: 14.5px; }
.who .hd { color: var(--faint); font-size: 12px; }

/* -- avatar ---------------------------------------------------------- */

.ava {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line);
  flex: none; object-fit: cover;
  /* The art is a 2:3 portrait with the creature standing in frame, so a
     square centre crop lands on its belly. Bias the crop upward: at
     40 px the face is the only thing that identifies a totem. */
  object-position: center 28%;
}
.ava.lg {
  width: 96px; height: 96px; border-width: 2px;
  border-color: rgba(183, 163, 255, .5);
}

/* -- empty / loading -------------------------------------------------- */

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px 18px; text-align: center;
  color: var(--muted); font-size: 13.5px; line-height: 1.6;
}

.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
  border-radius: var(--radius);
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .bar > i { transition: none; }
}

/* -- language switch --------------------------------------------------- */

/* Positioning is the PAGE's call: the feed keeps its controls in a flex
   row, the profile floats them over the header. The system only styles
   the buttons -- adding position here silently moved the feed's row. */
.lang { display: flex; gap: 6px; }
.lang.float { position: absolute; top: 12px; right: 12px; }
.lang button {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.lang button.on { background: var(--text); color: var(--bg); border-color: var(--text); }

footer.note {
  text-align: center; font-size: 12px; color: var(--faint);
  padding: 22px 14px; line-height: 1.6;
}

a { color: var(--social); }
a:hover { color: var(--text); }
