/* ═══════════════════════════════════════════════════════════════════════════
   ponily — a friendly pony game
   Palette v5 "high summer": sky blue + sun gold + lush meadow.
   Rounder, cozier, a little more playful.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 01 · Tokens ────────────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;

  /* Brand palette v5 "high summer" */
  --ponily-bg: #e8f4ff;
  --ponily-bg-elevated: #fffdf6;
  --ponily-ink: #3a3f2e;
  --ponily-ink-muted: #7d8568;
  --brand: #5ea34f; /* meadow green — primary */
  --brand-soft: #8fc978;
  --brand-deep: #3f7a34;
  --brand-blush: #e4f3d6;
  --heart: #e08aa0; /* soft pink — bonding, pregnancy */
  --heart-soft: #f6c4d0;
  --sun: #e0bc68; /* sunny gold — coins, mood */
  --sun-soft: #f5e8b4;
  --sun-deep: #9a8140;

  /* Semantic (light) */
  --bg: var(--ponily-bg);
  --bg-elevated: var(--ponily-bg-elevated);
  --surface: #fffcf5;
  --surface-2: #f5f3e6;
  --ink: var(--ponily-ink);
  --ink-muted: #5f664c; /* dunkler als Brand-Ton — WCAG-Kontrast für Kleintext */
  --accent: var(--brand);
  --accent-soft: var(--brand-soft);
  --accent-ink: var(--brand-deep);
  --on-accent: #fffdf8;
  --line: rgba(168, 188, 120, 0.45);
  --line-strong: rgba(148, 168, 105, 0.7);
  --tint-brand: rgba(94, 163, 79, 0.14);
  --tint-gold: rgba(224, 188, 104, 0.28);
  --tint-heart: rgba(224, 138, 160, 0.14);
  --track: rgba(120, 130, 90, 0.16);
  --ok: #55793f;
  --ok-line: rgba(85, 121, 63, 0.35);
  --ok-bg: rgba(116, 150, 88, 0.13);
  --err: #a63c24;
  --err-line: rgba(166, 60, 36, 0.3);
  --err-bg: rgba(166, 60, 36, 0.09);
  --shadow-rgb: 70, 85, 45;
  --shadow-1: 0 1px 2px rgba(var(--shadow-rgb), 0.04),
    0 3px 10px rgba(var(--shadow-rgb), 0.07);
  --shadow-2: 0 4px 10px rgba(var(--shadow-rgb), 0.06),
    0 16px 40px rgba(var(--shadow-rgb), 0.1);
  --ring: rgba(94, 163, 79, 0.5);
  --glass: rgba(255, 253, 246, 0.88);
  --chip-grad: linear-gradient(180deg, #ffe89a 0%, #f5d46a 100%);
  --tile-grad: linear-gradient(180deg, #fffef8 0%, #f5f8e8 100%);
  --tile-grad-hover: linear-gradient(180deg, #ffffff 0%, #f8fbe8 100%);
  --tile-grad-off: linear-gradient(180deg, #eef0e2 0%, #e4e6d6 100%);
  --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237d8568' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  /* Type — Nunito: round, soft, playful */
  --font-display: "Nunito", ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold",
    system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Metrics — a touch rounder */
  --r-sm: 0.75rem;
  --r-md: 1.1rem;
  --r-lg: 1.4rem;
  --r-xl: 1.75rem;
  --nav-h: 4.35rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Summer twilight — deep sky night, warm amber, soft meadow */
    --bg: #1a2438;
    --bg-elevated: #243248;
    --surface: #2c3a52;
    --surface-2: #344560;
    --ink: #fff4e4;
    --ink-muted: #c4b8a0;
    --brand: #7dcb6a;
    --brand-soft: #9adc84;
    --brand-deep: #5aa84a;
    --brand-blush: #2f4a38;
    --heart: #f0a0b4;
    --heart-soft: #f6c4d0;
    --sun: #f0c86a;
    --sun-soft: #f5e0a0;
    --sun-deep: #d4a84a;
    --accent: var(--brand);
    --accent-soft: var(--brand-soft);
    --accent-ink: #b8e89a;
    --on-accent: #142018;
    --line: rgba(140, 180, 220, 0.22);
    --line-strong: rgba(180, 200, 140, 0.38);
    --tint-brand: rgba(125, 203, 106, 0.16);
    --tint-gold: rgba(240, 200, 106, 0.18);
    --tint-heart: rgba(240, 160, 180, 0.14);
    --track: rgba(140, 170, 200, 0.18);
    --ok: #a9d48c;
    --ok-line: rgba(169, 212, 140, 0.4);
    --ok-bg: rgba(125, 203, 106, 0.14);
    --err: #f0a088;
    --err-line: rgba(240, 160, 136, 0.4);
    --err-bg: rgba(240, 160, 136, 0.12);
    --shadow-rgb: 8, 14, 28;
    --shadow-1: 0 1px 2px rgba(8, 14, 28, 0.35), 0 3px 12px rgba(8, 14, 28, 0.35);
    --shadow-2: 0 4px 12px rgba(8, 14, 28, 0.4), 0 18px 40px rgba(8, 14, 28, 0.45);
    --ring: rgba(125, 203, 106, 0.55);
    --glass: rgba(28, 40, 58, 0.82);
    --chip-grad: linear-gradient(180deg, #5a4a28 0%, #4a3c1e 100%);
    --tile-grad: linear-gradient(180deg, #32445c 0%, #2a3850 100%);
    --tile-grad-hover: linear-gradient(180deg, #3a5068 0%, #32445c 100%);
    --tile-grad-off: linear-gradient(180deg, #263448 0%, #1e2a3c 100%);
    --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23c4b8a0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

/* ─── 02 · Base ──────────────────────────────────────────────────────────── */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
}

body {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--ink);
  /* High-summer: clear sky → sun bloom → meadow floor */
  background-color: var(--bg);
  background-image:
    radial-gradient(circle 18rem at 88% 8%, rgba(255, 220, 90, 0.75), transparent 58%),
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(120, 198, 255, 0.65), transparent 62%),
    radial-gradient(ellipse 70% 45% at 8% 12%, rgba(170, 220, 255, 0.45), transparent 55%),
    radial-gradient(ellipse 85% 50% at 50% 108%, rgba(110, 190, 70, 0.55), transparent 58%),
    radial-gradient(ellipse 55% 40% at 95% 95%, rgba(255, 170, 120, 0.28), transparent 55%),
    radial-gradient(ellipse 40% 30% at 15% 88%, rgba(255, 150, 180, 0.22), transparent 60%),
    linear-gradient(
      180deg,
      #9fd4ff 0%,
      #c8e8ff 22%,
      #fff4c8 48%,
      #e8f5b8 72%,
      #b8e070 100%
    );
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  accent-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: var(--bg);
    /* Summer night: twilight sky, warm moon, meadow dusk */
    background-image:
      radial-gradient(circle 14rem at 86% 10%, rgba(255, 220, 140, 0.42), transparent 55%),
      radial-gradient(circle 5rem at 86% 10%, rgba(255, 245, 210, 0.55), transparent 50%),
      radial-gradient(ellipse 95% 55% at 40% -8%, rgba(90, 140, 220, 0.45), transparent 60%),
      radial-gradient(ellipse 60% 40% at 5% 18%, rgba(180, 120, 200, 0.18), transparent 55%),
      radial-gradient(ellipse 80% 48% at 50% 110%, rgba(70, 150, 70, 0.38), transparent 58%),
      radial-gradient(ellipse 50% 35% at 92% 92%, rgba(255, 140, 100, 0.22), transparent 55%),
      radial-gradient(ellipse 45% 30% at 12% 90%, rgba(255, 130, 170, 0.16), transparent 55%),
      linear-gradient(
        180deg,
        #152038 0%,
        #1c2c48 28%,
        #243848 52%,
        #2a3c30 78%,
        #1e3020 100%
      );
    background-attachment: fixed;
  }
}

::selection {
  background: rgba(134, 191, 111, 0.4);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── 03 · Generic controls ──────────────────────────────────────────────── */

button {
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

button:active {
  transform: scale(0.97);
}

@media (hover: hover) {
  button:hover {
    border-color: var(--accent);
    background: var(--surface-2);
  }
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

button.primary {
  background: linear-gradient(170deg, var(--accent-soft), var(--accent));
  border-color: var(--brand-deep);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 4px 14px rgba(58, 110, 47, 0.22);
}

@media (hover: hover) {
  button.primary:hover {
    background: linear-gradient(170deg, #8fc276, var(--accent));
    border-color: var(--brand-deep);
  }
}

button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-muted);
}

@media (hover: hover) {
  button.ghost:hover {
    background: var(--tint-gold);
    border-color: var(--line-strong);
    color: var(--ink);
  }
}

button.linkish {
  border: none;
  background: none;
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: rgba(87, 150, 74, 0.45);
  text-underline-offset: 3px;
  padding: 0;
  font: inherit;
  cursor: pointer;
  border-radius: 2px;
}

@media (hover: hover) {
  button.linkish:hover {
    color: var(--accent);
    background: none;
    text-decoration-color: currentColor;
  }
}

button.linkish:active {
  transform: none;
}

input,
select {
  font-family: inherit;
}

.field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  margin: 0.8rem 0;
}

.field input,
.field select,
.rename-row input,
#foal-name {
  font-family: inherit;
  font-size: 1rem; /* ≥16px — verhindert iOS-Autozoom */
  font-weight: 500;
  letter-spacing: normal;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  box-shadow: inset 0 1px 2px rgba(var(--shadow-rgb), 0.04);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
  min-width: 0;
  width: 100%;
}

.field input::placeholder,
.rename-row input::placeholder,
#foal-name::placeholder {
  color: var(--ink-muted);
  opacity: 0.55;
}

.field input:focus-visible,
.field select:focus-visible,
.rename-row input:focus-visible,
#foal-name:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(87, 150, 74, 0.18);
}

.field select,
.breed-field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.2rem;
}

.req {
  font-weight: 400;
  opacity: 0.75;
  font-size: 0.85em;
  letter-spacing: normal;
  text-transform: none;
}

/* ─── 04 · Layout shells ─────────────────────────────────────────────────── */

.app {
  min-height: 100dvh;
}

.shell {
  max-width: 28rem;
  margin: 0 auto;
  padding: 1.5rem calc(1rem + var(--safe-l)) 3rem calc(1rem + var(--safe-r));
}

.auth-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: calc(1.5rem + var(--safe-t));
  padding-bottom: 2.5rem;
}

.game-shell {
  max-width: 28rem;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}

.game-main {
  flex: 1;
  padding: 0.9rem calc(1rem + var(--safe-l)) 1.5rem calc(1rem + var(--safe-r));
  width: 100%;
  overflow-anchor: none;
}

.screen {
  display: none;
}

.screen.on {
  display: block;
  animation: screen-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ─── 05 · App bar ───────────────────────────────────────────────────────── */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.65rem + var(--safe-t)) calc(1rem + var(--safe-r)) 0.65rem
    calc(1rem + var(--safe-l));
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}

.app-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 5%,
    var(--sun) 50%,
    transparent 95%
  );
  opacity: 0.55;
  pointer-events: none;
}

.app-bar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.app-bar-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
  color: var(--accent-ink);
}

.app-bar-sub {
  margin: 0.05rem 0 0;
  font-size: 0.74rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}

.logo-sm {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  object-fit: cover;
  box-shadow:
    0 0 0 1px var(--line),
    0 2px 6px rgba(var(--shadow-rgb), 0.12);
}

.gold-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  background: var(--chip-grad);
  border: 1.5px solid rgba(201, 167, 111, 0.65);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 2px 8px rgba(var(--shadow-rgb), 0.1);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .gold-chip {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 1px 3px rgba(0, 0, 0, 0.3);
  }
}

.gold-chip [aria-hidden] {
  color: var(--sun-deep);
  font-size: 0.8em;
}

@media (prefers-color-scheme: dark) {
  .gold-chip [aria-hidden] {
    color: var(--sun);
  }
}

.gold-chip strong {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ─── 06 · Bottom nav ────────────────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 28rem;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  padding: 0.4rem 0.2rem calc(0.4rem + var(--safe-b));
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 28px rgba(var(--shadow-rgb), 0.07);
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.16rem;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.45rem 0.08rem 0.4rem;
  border-radius: 1rem;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}

.nav-item:active {
  transform: scale(0.93);
}

.nav-item .nav-ico {
  font-size: 1.2rem;
  line-height: 1.15;
  filter: grayscale(1);
  opacity: 0.62;
  transition:
    filter 0.2s ease,
    opacity 0.2s ease,
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item.on {
  color: var(--accent-ink);
  background: var(--tint-brand);
}

.nav-item.on .nav-ico {
  filter: none;
  opacity: 1;
  transform: translateY(-1px);
}

.nav-item.on::after {
  content: "";
  position: absolute;
  top: -0.4rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1.15rem;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

@media (hover: hover) {
  .nav-item:hover {
    background: var(--tint-gold);
    border-color: transparent;
  }
  .nav-item.on:hover {
    background: var(--tint-brand);
  }
}

/* ─── 07 · Cards & headings ──────────────────────────────────────────────── */

.card {
  position: relative;
  background: var(--bg-elevated);
  border: 1.5px solid var(--line);
  border-radius: var(--r-xl);
  padding: 1.3rem 1.25rem 1.35rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    var(--shadow-2);
}

@media (prefers-color-scheme: dark) {
  .card {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.05),
      var(--shadow-2);
  }
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-head h1,
.h {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.h {
  margin-bottom: 0.35rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1.1rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--accent-ink);
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.meta {
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.meta.tight {
  margin: 0.2rem 0 0;
}

.pill {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0.02em;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  background: var(--brand-blush);
  color: #33552a;
  border: 1.5px solid rgba(94, 163, 79, 0.35);
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .pill {
    background: var(--tint-brand);
    color: var(--accent-ink);
    border-color: rgba(134, 191, 111, 0.35);
  }
}

.pill[data-state="asleep"] {
  background: var(--tint-gold);
  color: var(--ink-muted);
  border-color: var(--line);
}

.pill[data-state="birth_pending"] {
  background: var(--heart);
  color: #fff8f4;
  border-color: #b95f78;
  animation: pulse-ring 1.9s ease-out infinite;
}

@keyframes pulse-ring {
  from {
    box-shadow: 0 0 0 0 rgba(217, 127, 150, 0.5);
  }
  to {
    box-shadow: 0 0 0 10px rgba(217, 127, 150, 0);
  }
}

.tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0.9rem 0 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: var(--tint-gold);
  border: 1px solid var(--line);
}

.tab {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.5rem 0.7rem;
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.tab:active {
  transform: scale(0.98);
}

.tab.on {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

@media (hover: hover) {
  .tab:hover {
    background: rgba(255, 253, 248, 0.5);
    border-color: transparent;
  }
  .tab.on:hover {
    background: var(--surface);
    border-color: var(--line-strong);
  }
}

@media (prefers-color-scheme: dark) {
  @media (hover: hover) {
    .tab:hover {
      background: rgba(255, 253, 248, 0.06);
    }
    .tab.on:hover {
      background: var(--surface);
    }
  }
}

/* ─── 08 · Auth screen ───────────────────────────────────────────────────── */

.top {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin-bottom: 1.35rem;
}

.logo {
  width: 4.6rem;
  height: 4.6rem;
  border-radius: 1.2rem;
  object-fit: cover;
  background: var(--bg-elevated);
  box-shadow:
    0 0 0 1px var(--line-strong),
    0 0 0 5px rgba(255, 253, 248, 0.55),
    0 10px 28px rgba(var(--shadow-rgb), 0.16);
}

@media (prefers-color-scheme: dark) {
  .logo {
    box-shadow:
      0 0 0 1px var(--line-strong),
      0 0 0 5px rgba(255, 253, 248, 0.06),
      0 10px 28px rgba(0, 0, 0, 0.45);
  }
}

.brand {
  font-family: var(--font-display);
  font-size: 2.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--accent-ink);
}

.tag {
  margin: 0.22rem 0 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.hint {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-top: 1.05rem;
  line-height: 1.6;
}

.ok {
  color: var(--ok);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
  word-break: break-word;
}

.err {
  color: var(--err);
  font-size: 0.88rem;
  margin: 0.5rem 0 0;
  word-break: break-word;
}

#auth-ok,
#auth-err {
  padding: 0.6rem 0.8rem;
  border-radius: var(--r-sm);
  margin-top: 0.75rem;
  animation: toast-in 0.25s ease;
}

#auth-ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-line);
}

#auth-err {
  background: var(--err-bg);
  border: 1px solid var(--err-line);
}

.ok a,
.hint a {
  color: var(--accent-ink);
  word-break: break-all;
}

#auth-actions {
  margin-top: 1.1rem;
}

#auth-actions .primary,
#reset-fields .primary {
  flex: 1;
  padding: 0.72rem 1rem;
  border-radius: var(--r-md);
  font-size: 1rem;
}

/* ─── 09 · Portrait ──────────────────────────────────────────────────────── */

.who {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
}

.back-stable {
  display: inline-flex;
  align-items: center;
  margin: 0 0 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-ink);
  cursor: pointer;
}

.back-stable:hover {
  text-decoration: underline;
}

.horse-title-row {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  min-width: 0;
}

.horse-title-row h1 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sex-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 0.92em;
  line-height: 1;
  letter-spacing: 0;
  translate: 0 0.02em;
}

.sex-mark.sex-f {
  color: #e85a9a;
}

.sex-mark.sex-m {
  color: #3b7ddd;
}

.hc-name .sex-mark {
  margin-left: 0.28rem;
  font-size: 0.95em;
  translate: 0 0.04em;
}

.portrait {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 0.95rem 0 0.55rem;
}

.portrait-stage {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: var(--r-xl);
  background:
    radial-gradient(ellipse 70% 55% at 68% 18%, rgba(255, 252, 245, 0.95), transparent 55%),
    radial-gradient(ellipse 80% 40% at 50% 100%, rgba(168, 200, 120, 0.4), transparent 55%),
    linear-gradient(168deg, #f5efe0 0%, #e8dfc0 45%, #d4c89a 100%);
  border: 1.5px solid var(--line);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 14px 32px rgba(var(--shadow-rgb), 0.12);
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
}

@media (prefers-color-scheme: dark) {
  .portrait-stage {
    background:
      radial-gradient(ellipse 55% 45% at 78% 12%, rgba(255, 220, 140, 0.35), transparent 55%),
      radial-gradient(ellipse 80% 40% at 50% 100%, rgba(80, 140, 70, 0.45), transparent 55%),
      linear-gradient(168deg, #2a3850 0%, #334058 40%, #3a4030 100%);
    border-color: rgba(180, 200, 140, 0.35);
    box-shadow:
      inset 0 1px 0 rgba(255, 230, 180, 0.12),
      0 14px 32px rgba(8, 14, 28, 0.5);
  }
}

/* Light shaft + framed keyline above the canvas */
.portrait-stage::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 251, 240, 0.4);
  border-radius: calc(var(--r-lg) - 5px);
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 248, 230, 0.2) 52%,
    transparent 64%
  );
  pointer-events: none;
  z-index: 2;
  animation: barn-shaft 7s ease-in-out infinite;
}

.portrait-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background:
    repeating-linear-gradient(90deg, rgba(138, 111, 75, 0.07) 0 2px, transparent 2px 11px),
    linear-gradient(to top, rgba(138, 111, 75, 0.18), transparent);
  pointer-events: none;
  z-index: 0;
}

@keyframes barn-shaft {
  0%,
  100% {
    opacity: 0.45;
    transform: translateX(-1.5%);
  }
  50% {
    opacity: 0.85;
    transform: translateX(1.5%);
  }
}

.portrait-glow {
  position: absolute;
  inset: auto 12% 6% 12%;
  height: 16%;
  border-radius: 50%;
  background: rgba(61, 44, 33, 0.12);
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
}

.portrait.react .portrait-stage {
  animation: horse-react 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes horse-react {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.018);
  }
  100% {
    transform: scale(1);
  }
}

.float-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}

/* Viewport layer so bursts stay visible above bars / buttons */
.emoji-burst-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  overflow: visible;
}

.float-emoji {
  position: absolute;
  left: var(--fx, 50%);
  top: var(--fy, 62%);
  font-size: var(--fs, 1.35rem);
  line-height: 1;
  transform: translate(-50%, 0) scale(0.55) rotate(0deg);
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(61, 44, 33, 0.22));
  animation: float-emoji-up var(--dur, 1.05s) cubic-bezier(0.16, 0.84, 0.32, 1)
    var(--delay, 0ms) forwards;
  will-change: transform, opacity;
}

.float-emoji.from-btn {
  position: fixed;
  z-index: 81;
}

.float-burst.big .float-emoji,
.emoji-burst-layer.big .float-emoji {
  --fs: 1.55rem;
}

@keyframes float-emoji-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.4) rotate(0deg);
  }
  12% {
    opacity: 1;
    transform: translate(calc(-50% + var(--dx, 0px) * 0.2), 0)
      scale(1.15) rotate(calc(var(--rot, 0deg) * 0.3));
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx, 0px)), var(--rise, -110px))
      scale(0.85) rotate(var(--rot, 0deg));
  }
}

@media (prefers-reduced-motion: reduce) {
  .float-emoji {
    animation: float-emoji-fade 0.7s ease forwards;
  }

  @keyframes float-emoji-fade {
    0% {
      opacity: 0;
      transform: translate(-50%, 0) scale(0.8);
    }
    30% {
      opacity: 1;
      transform: translate(-50%, -8px) scale(1);
    }
    100% {
      opacity: 0;
      transform: translate(-50%, -20px) scale(0.95);
    }
  }
}

.horse-voice {
  margin: 0.55rem 0 0.35rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.85rem;
  background: linear-gradient(
    135deg,
    rgba(188, 117, 99, 0.1),
    rgba(197, 170, 128, 0.14)
  );
  border: 1px solid var(--line);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  letter-spacing: 0.005em;
}

.horse-voice[data-mood="gloomy"],
.horse-voice[data-mood="restless"] {
  background: linear-gradient(
    135deg,
    rgba(120, 96, 82, 0.1),
    rgba(188, 117, 99, 0.08)
  );
}

.horse-voice[data-bond="heart"],
.horse-voice[data-bond="soul"],
.horse-voice[data-bond="devoted"] {
  border-color: rgba(224, 138, 160, 0.45);
}

.horse-voice[data-phase="foal"] {
  background: linear-gradient(
    135deg,
    rgba(159, 212, 255, 0.16),
    rgba(197, 170, 128, 0.12)
  );
}

.bar-flavor {
  margin-left: 0.35rem;
  font-style: normal;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--ink-muted);
}

.horse-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  position: relative;
  z-index: 1;
  display: block;
  filter: drop-shadow(0 10px 18px rgba(61, 44, 33, 0.18));
}

.horse-canvas-3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  z-index: 2;
  touch-action: none;
  filter: drop-shadow(0 12px 22px rgba(61, 44, 33, 0.22));
}

.portrait-stage.mode-3d .horse-canvas:not(.horse-canvas-3d) {
  visibility: hidden;
  pointer-events: none;
}

.portrait-stage.mode-2d .horse-canvas-3d {
  display: none;
}

.portrait-meta {
  padding: 0 0.15rem;
}

.portrait-meta .coat {
  margin: 0 0 0.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  font-size: 0.98rem;
  color: var(--ink);
}

.portrait-meta .phase {
  margin: 0;
  font-size: 0.85rem;
}

.portrait-meta .meta {
  margin: 0;
}

.portrait-meta .pedigree,
.portrait-meta .stall-line {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.coat {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  color: var(--accent-ink);
  text-transform: capitalize;
}

.phase {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.phase[data-phase="foal"] {
  color: var(--accent);
}

.phase[data-phase="senior"],
.phase[data-phase="elder"] {
  color: var(--sun-deep);
}

@media (prefers-color-scheme: dark) {
  .phase[data-phase="senior"],
  .phase[data-phase="elder"] {
    color: var(--sun);
  }
}

.pedigree,
.stall-line {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

.pedigree.block {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.stall-line strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ─── 10 · Bars & progress ───────────────────────────────────────────────── */

.bars {
  display: grid;
  gap: 0.4rem;
  margin: 1.05rem 0;
}

.bars label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
}

.bars label span {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
}

.bar {
  height: 0.62rem;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(var(--shadow-rgb), 0.08);
}

.bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-soft));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar.mood i {
  background: linear-gradient(90deg, var(--sun), var(--sun-soft));
}

.bar.bond i {
  background: linear-gradient(90deg, var(--heart), var(--heart-soft));
}

.preg {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.preg span:last-child {
  font-variant-numeric: tabular-nums;
}

.preg-bar {
  height: 0.45rem;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(var(--shadow-rgb), 0.08);
}

.preg-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--heart), var(--heart-soft));
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.timer {
  display: inline-flex;
  align-items: center;
  margin: 0.35rem 0 0.75rem;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  background: var(--tint-gold);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
  animation: soft-pulse 2.6s ease-in-out infinite;
}

@keyframes soft-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.72;
  }
}

.skip-line {
  margin: 0.25rem 0 0.5rem;
  display: block;
}

.care-status {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.next-line {
  margin: 0.55rem 0 0.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.85rem;
  background: linear-gradient(
    135deg,
    rgba(188, 117, 99, 0.12),
    rgba(197, 170, 128, 0.16)
  );
  border: 1px solid var(--line);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  min-height: 2.85em;
  box-sizing: border-box;
}

.horse-day .day-actions {
  margin-top: 0.15rem;
}

.horse-day .portrait {
  margin-top: 0.55rem;
}

.compete-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.compete-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-radius: 0.9rem;
  border: 1px solid var(--line);
  background: var(--bg-elevated, var(--ponily-bg-elevated, #f4efe4));
  color: inherit;
  cursor: pointer;
}

.compete-row strong {
  display: block;
  font-size: 0.95rem;
}

.compete-row em {
  display: block;
  font-style: normal;
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 0.15rem;
}

.compete-row small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-ink, var(--ponily-rose-deep, #984838));
}

.compete-row:disabled,
.compete-row.done {
  opacity: 0.55;
  cursor: not-allowed;
}

.compete-ico {
  font-size: 1.35rem;
  line-height: 1;
}

.compete-chev {
  color: var(--ink-muted);
  font-weight: 700;
}

.sheet-back {
  margin-bottom: 0.5rem;
}

.sheet-breed {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.horse-dock {
  display: grid;
  gap: 0.35rem;
}

.horse-dock .section-label {
  margin-top: 0.65rem;
}

#horse-docks {
  display: none;
}

.herd-card.dispatch {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 0.45rem;
  align-items: center;
}

.herd-card .hc-main {
  display: grid;
  gap: 0.1rem;
  text-align: left;
  min-width: 0;
}

.herd-card .hc-stars {
  flex-shrink: 0;
}

.herd-card .hc-stars .stars {
  font-size: 0.62rem;
}

.herd-card .hc-timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-muted);
  min-width: 2.5rem;
  text-align: right;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--tint-gold, rgba(197, 170, 128, 0.2));
  color: var(--ink);
}

.status-pill.ready {
  background: rgba(87, 150, 74, 0.16);
  border-color: rgba(87, 150, 74, 0.35);
}

.status-pill.sleeping {
  background: rgba(100, 120, 180, 0.16);
}

.status-pill.birth {
  background: rgba(224, 138, 160, 0.22);
  border-color: rgba(224, 138, 160, 0.4);
}

.status-pill.pasture,
.status-pill.retired,
.status-pill.market {
  opacity: 0.85;
}

.stable-extra {
  margin-top: 1rem;
}

.you-links {
  margin-bottom: 0.85rem;
}

.bottom-nav.nav-slim {
  grid-template-columns: repeat(4, 1fr);
}

/* ─── 11 · Action tiles ──────────────────────────────────────────────────── */

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.act-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.horse-day .day-actions .act-grid:not(.care-row):not(.act-grid-rest) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.horse-day .act-grid-rest {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.act-grid:has(> :nth-child(4)) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.act-grid-rest {
  grid-template-columns: 1.4fr 1fr;
}

.reveal-box .act-grid {
  grid-template-columns: 1fr;
}

button.act-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 4.5rem;
  padding: 0.6rem 0.35rem 0.55rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--tile-grad);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 3px 10px rgba(var(--shadow-rgb), 0.07);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: center;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  button.act-tile {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 2px 8px rgba(0, 0, 0, 0.28);
  }
}

@media (hover: hover) {
  button.act-tile:hover {
    border-color: var(--accent);
    background: var(--tile-grad-hover);
    transform: translateY(-2px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.7),
      0 6px 16px rgba(var(--shadow-rgb), 0.1);
  }
}

button.act-tile:active {
  transform: scale(0.96);
}

.act-ico {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5));
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (hover: hover) {
  button.act-tile:hover .act-ico {
    transform: scale(1.08) translateY(-1px);
  }
}

@media (prefers-color-scheme: dark) {
  .act-ico {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
  }
}

.act-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.act-sub {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-muted);
  line-height: 1;
}

.act-sub.muted-sub {
  color: var(--ink-muted);
}

/* Light cream tiles — keep price readable even without muted-sub. */
button.act-tile:not(.act-tile-primary) .act-sub {
  color: var(--sun-deep);
}

button.act-tile-primary {
  background: linear-gradient(165deg, var(--brand-soft), var(--brand));
  border-color: var(--brand-deep);
  color: var(--on-accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 4px 14px rgba(58, 110, 47, 0.22);
}

@media (prefers-color-scheme: dark) {
  button.act-tile-primary {
    color: #142018;
    border-color: rgba(180, 230, 140, 0.45);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.22),
      0 4px 18px rgba(125, 203, 106, 0.28);
  }

  button.primary {
    color: #142018;
    border-color: rgba(180, 230, 140, 0.45);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.22),
      0 4px 18px rgba(125, 203, 106, 0.28);
  }
}

button.act-tile-primary .act-label {
  font-weight: 700;
}

button.act-tile-primary .act-sub:not(.muted-sub) {
  color: rgba(255, 253, 248, 0.85);
}

@media (hover: hover) {
  button.act-tile-primary:hover {
    background: linear-gradient(165deg, #8fc276, var(--brand));
    border-color: var(--brand-deep);
    color: var(--on-accent);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.28),
      0 7px 18px rgba(58, 110, 47, 0.3);
  }
}

.act-tile-compact {
  min-height: 3.6rem;
  min-width: 5.5rem;
  flex: 0 0 auto;
}

.breed-row .act-tile-compact {
  align-self: end;
}

/* done / disabled states */
.act-tile.done {
  opacity: 1;
  border-style: solid;
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(201, 167, 111, 0.18), rgba(201, 167, 111, 0.06)),
    var(--surface-2);
  color: var(--ink-muted);
  box-shadow: none;
}

.act-tile.done .act-ico {
  filter: grayscale(0.4);
  opacity: 0.8;
}

.act-tile.done::after {
  content: "✓";
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  background: var(--ok-bg);
  border: 1px solid var(--ok-line);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ok);
  line-height: 1;
}

button.done {
  opacity: 0.55;
  border-style: dashed;
}

button.act-tile:disabled,
button.act-tile.no-energy,
button.act-tile.no-gold {
  opacity: 1;
  cursor: not-allowed;
  transform: none;
  border-color: var(--line);
  background: var(--tile-grad-off);
  color: rgba(120, 96, 82, 0.55);
  box-shadow: none;
  filter: grayscale(0.85);
}

@media (prefers-color-scheme: dark) {
  button.act-tile:disabled,
  button.act-tile.no-energy,
  button.act-tile.no-gold {
    color: rgba(242, 231, 216, 0.32);
  }
}

@media (hover: hover) {
  button.act-tile:disabled:hover,
  button.act-tile.no-energy:hover,
  button.act-tile.no-gold:hover {
    transform: none;
    border-color: var(--line);
    background: var(--tile-grad-off);
    box-shadow: none;
  }
}

button.act-tile-primary:disabled {
  filter: grayscale(0.75);
  background: linear-gradient(180deg, #a9b59c 0%, #8b9a80 100%);
  border-color: var(--line);
  color: rgba(255, 253, 248, 0.7);
}

/* ─── 12 · Tip, reveal, breed ────────────────────────────────────────────── */

.tip {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0.8rem 0;
  padding: 0.85rem 1rem;
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, var(--tint-heart), transparent 55%),
    var(--tint-gold);
  border: 1.5px solid var(--line);
  font-size: 0.88rem;
  color: var(--ink);
}

.tip p {
  margin: 0;
  line-height: 1.45;
}

.tip .linkish {
  white-space: nowrap;
  padding: 0.15rem 0.1rem;
  flex: 0 0 auto;
}

.reveal-box {
  margin: 0.8rem 0 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--r-md);
  border: 1px solid rgba(217, 127, 150, 0.55);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(242, 185, 198, 0.35), transparent 70%),
    rgba(217, 127, 150, 0.1);
  animation: screen-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-title {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #b95f78;
}

.reveal-sex {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.55rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--accent-ink);
}

.reveal-sex-mark {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  font-size: 0.95rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(185, 95, 120, 0.35);
}

.reveal-sex-mark.sex-f {
  color: #b95f78;
  border-color: rgba(185, 95, 120, 0.45);
}

.reveal-sex-mark.sex-m {
  color: #3d6f8c;
  border-color: rgba(61, 111, 140, 0.45);
}

.horse-abilities {
  margin-top: 1.15rem;
}

.horse-abilities .stats-panel {
  margin-top: 0.15rem;
}

.horse-breed {
  margin-top: 0.85rem;
  padding-top: 0.15rem;
}

.horse-breed .section-label {
  margin-top: 0.35rem;
}

.breed-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem;
}

.breed-row .primary {
  flex: 0 0 auto;
  min-height: 2.75rem;
  padding-inline: 1.1rem;
}

.breed-field {
  flex: 1;
  margin: 0;
  min-width: 10rem;
}

.breed-hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

.breed-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--tint-gold);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}

.breed-preview[hidden] {
  display: none !important;
}

.breed-preview .stars {
  font-size: 0.78rem;
}

.breed-preview em {
  font-style: normal;
  font-weight: 600;
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.train-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.45rem 0 0.15rem;
}

.train-focus[hidden] {
  display: none !important;
}

.train-chip {
  border: 1.5px solid var(--line-strong);
  background: var(--tile-grad);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.2;
}

.train-chip.on {
  border-color: var(--brand-deep);
  background: var(--brand-blush);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px rgba(94, 163, 79, 0.35);
}

.train-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stat-row.trainable {
  cursor: pointer;
  border-radius: 0.55rem;
  padding: 0.15rem 0.2rem;
  margin: 0 -0.2rem;
}

.stat-row.trainable:hover,
.stat-row.trainable.on {
  background: rgba(94, 163, 79, 0.1);
}

.stat-row.train-flash {
  background: rgba(94, 163, 79, 0.18);
  animation: train-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.train-delta {
  position: absolute;
  right: 0.15rem;
  top: -0.35rem;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--brand-deep);
  text-shadow: 0 1px 0 rgba(255, 253, 248, 0.8);
  animation: train-delta-up 1.2s ease forwards;
  pointer-events: none;
}

@keyframes train-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes train-delta-up {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  20% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.compete-result-flavor {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--ink);
}

.compete-why {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: var(--r-sm);
  background: var(--tint-gold);
  border: 1px solid var(--line);
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink);
}

.compete-why strong {
  color: var(--accent-ink);
}

.mentor-row {
  align-items: flex-end;
}

.mentor-row button {
  margin-bottom: 1px;
}

.field.optional {
  margin-top: 0.25rem;
}

/* ─── 13 · Stats & line ──────────────────────────────────────────────────── */

.stats-panel {
  margin: 0.85rem 0 0.25rem;
}

.stats-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  margin-bottom: 0.4rem;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* name · stars · skill · training bar · progress word */
.stat-row {
  position: relative;
  display: grid;
  grid-template-columns: 4.6rem auto 2.6rem 1fr auto;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.stat-name {
  font-weight: 600;
  color: var(--ink);
}

.stat-now {
  text-align: right;
  font-weight: 600;
  color: var(--ink);
}

.stars {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  line-height: 1;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.stars-bg {
  opacity: 0.22;
  color: var(--ink-muted);
}

.stars-fill {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  white-space: nowrap;
  color: #d9a534;
}

.stat-bar {
  height: 0.42rem;
  min-width: 2.5rem;
  border-radius: 999px;
  background: var(--tint-gold);
  border: 1px solid var(--line);
  overflow: hidden;
}

.stat-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7fae5f, #4f8a3b);
}

.stat-prog {
  font-size: 0.7rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* Class B + C: words, never bars — these are not things you grind up. */
.trait-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.55rem;
}

.trait-chips.horse-basics {
  margin: 0.45rem 0 0.15rem;
  justify-content: center;
}

.trait-chip {
  font-size: 0.72rem;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: var(--tint-gold);
  border: 1px solid var(--line);
  color: var(--ink);
}

.trait-chip em {
  font-style: normal;
  opacity: 0.65;
  margin-right: 0.3rem;
}

@media (max-width: 26rem) {
  .stat-row {
    grid-template-columns: 4.2rem auto 2.4rem 1fr;
  }

  .stat-prog {
    display: none;
  }
}

.line-panel {
  margin: 0.75rem 0 0.25rem;
  padding: 0.6rem 0.7rem 0.5rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.line-canvas {
  width: 100%;
  height: 72px;
  display: block;
}

/* ─── 14 · Herd / stable ─────────────────────────────────────────────────── */

.herd-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.8rem 0 1rem;
}

button.herd-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.72rem 0.9rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-1);
}

@media (hover: hover) {
  button.herd-card:hover {
    border-color: var(--accent);
    background: var(--surface);
    transform: translateY(-1px);
  }
}

button.herd-card:active {
  transform: scale(0.98);
}

button.herd-card.on {
  border-color: rgba(87, 150, 74, 0.6);
  background:
    linear-gradient(90deg, var(--tint-brand), transparent 70%),
    var(--surface);
  box-shadow:
    inset 3px 0 0 var(--accent),
    var(--shadow-1);
}

.herd-card .hc-name {
  font-weight: 600;
}

.herd-card .hc-meta {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.herd-card > .hc-meta {
  display: inline;
  margin: 0;
  flex: 0 0 auto;
  font-size: 0.9rem;
  color: var(--accent-ink);
}

.herd-card.pasture {
  border-style: dashed;
  opacity: 0.92;
}

.herd-card.retired {
  opacity: 0.72;
}

.rename-row input {
  flex: 1;
  min-width: 8rem;
  width: auto;
}

/* ─── 15 · Market ────────────────────────────────────────────────────────── */

.market-cards {
  display: grid;
  gap: 0.7rem;
  margin: 0.35rem 0 1rem;
}

.market-card {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--line);
  background: var(--tile-grad);
  box-shadow: var(--shadow-1);
}

.market-swatch {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: var(--r-md);
  background:
    radial-gradient(circle at 35% 30%, var(--coat-body), var(--coat-points) 70%);
  border: 1.5px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.market-card-body {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.market-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.market-card-top strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-ink);
}

.market-seller {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--tint-brand);
  color: var(--accent-ink);
  border: 1px solid rgba(94, 163, 79, 0.35);
}

.market-meta,
.market-blurb,
.market-coat {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--ink-muted);
}

.market-blurb {
  color: var(--ink);
  font-weight: 600;
}

.market-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.45rem;
}

.market-price {
  font-style: normal;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--chip-grad);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.market-buy {
  padding: 0.45rem 0.95rem;
  border-radius: var(--r-md);
  font-size: 0.9rem;
}

.market-soon {
  margin: 0.2rem 0 0.5rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--line);
  background: var(--tint-gold);
  font-size: 0.88rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

.market-list-row {
  align-items: end;
}

.market-list-row .field {
  flex: 1;
  min-width: 8rem;
  margin: 0;
}

.dna-controls {
  display: grid;
  gap: 0.65rem;
  margin: 0.5rem 0 0.75rem;
}

.dna-tiers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

@media (min-width: 420px) {
  .dna-tiers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

button.dna-tier {
  display: grid;
  gap: 0.15rem;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--tile-grad);
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

button.dna-tier strong {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent-ink);
}

button.dna-tier span {
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-weight: 600;
}

@media (hover: hover) {
  button.dna-tier:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
  }
}

.dna-results {
  margin-top: 0.35rem;
}

.dna-result-list {
  display: grid;
  gap: 0.4rem;
}

.dna-result {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr auto;
  gap: 0.4rem;
  align-items: baseline;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-md);
  background: var(--tint-brand);
  border: 1px solid var(--line);
  font-size: 0.82rem;
}

.dna-result strong {
  font-weight: 800;
  color: var(--accent-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dna-result span {
  color: var(--ink-muted);
  font-weight: 600;
}

.dna-result em {
  font-style: normal;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* ─── 16 · Shop ──────────────────────────────────────────────────────────── */

.tack-panel,
.treats-panel {
  margin: 0.65rem 0 0.25rem;
}

.treats-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

button.treat-btn {
  display: grid;
  gap: 0.12rem;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--tile-grad);
  color: var(--ink);
}

button.treat-btn strong {
  font-size: 0.88rem;
  font-weight: 700;
}

button.treat-btn span {
  font-size: 0.72rem;
  color: var(--ink-muted);
  line-height: 1.3;
}

button.treat-btn em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-ink);
}

.tack-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.tack-slot {
  display: grid;
  gap: 0.15rem;
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--tile-grad);
  color: var(--ink);
  min-height: 4.2rem;
}

.tack-slot.on {
  cursor: pointer;
  border-color: rgba(94, 163, 79, 0.45);
}

.tack-slot.empty {
  opacity: 0.72;
}

.tack-slot i,
.tack-own i,
.shop-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  margin-right: 0.35rem;
  vertical-align: -0.05rem;
}

.tack-slot span,
.tack-own span {
  font-size: 0.78rem;
  font-weight: 700;
}

.tack-slot em,
.tack-own em {
  font-style: normal;
  font-size: 0.68rem;
  color: var(--ink-muted);
  line-height: 1.25;
}

.tack-owned {
  margin-top: 0.55rem;
}

.tack-owned-list {
  display: grid;
  gap: 0.35rem;
}

button.tack-own {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

button.tack-own em {
  margin-left: auto;
}

.shop-depts {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

details.shop-dept {
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}

details.shop-dept[open] {
  border-color: rgba(94, 163, 79, 0.4);
  box-shadow: var(--shadow-1);
}

.shop-dept-sum {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.shop-dept-sum::-webkit-details-marker {
  display: none;
}

.shop-dept-ico {
  font-size: 1.25rem;
  line-height: 1;
}

.shop-dept-copy {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.shop-dept-copy strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-ink);
}

.shop-dept-copy em {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.shop-chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--ink-muted);
  border-bottom: 2px solid var(--ink-muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-top: -0.2rem;
}

details.shop-dept[open] > .shop-dept-sum .shop-chevron {
  transform: rotate(225deg);
  margin-top: 0.15rem;
}

.shop-dept-blurb {
  margin: 0 1rem 0.35rem;
}

.shop-dept-body {
  padding: 0 0.75rem 0.85rem;
  display: grid;
  gap: 0.45rem;
}

details.shop-slot,
details.shop-fold {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--tile-grad);
}

details.shop-slot > summary,
details.shop-fold > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
}

details.shop-slot > summary::-webkit-details-marker,
details.shop-fold > summary::-webkit-details-marker {
  display: none;
}

details.shop-slot > summary em,
details.shop-fold > summary em {
  font-style: normal;
  font-weight: 600;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

details.shop-slot .shop-cards,
details.shop-fold .shop-cards {
  padding: 0 0.55rem 0.55rem;
  margin-top: 0;
}

.shop-cards {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

button.shop-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 0.65rem;
  row-gap: 0.18rem;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--tile-grad);
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-1);
}

@media (hover: hover) {
  button.shop-card:hover {
    border-color: var(--accent);
    background: var(--surface);
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
  }
}

button.shop-card:active {
  transform: scale(0.98);
}

.shop-card strong {
  grid-column: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--accent-ink);
}

.shop-card span {
  grid-column: 1;
  font-size: 0.78rem;
  color: var(--ink-muted);
  line-height: 1.35;
}

.shop-card em {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
  font-style: normal;
  font-weight: 700;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  margin-top: 0;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--chip-grad);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

button.shop-card.coming-soon,
button.shop-card:disabled {
  opacity: 0.68;
  cursor: not-allowed;
  filter: grayscale(0.35);
  transform: none;
  box-shadow: none;
}

.shop-card.coming-soon em {
  background: var(--tint-brand);
  border-color: rgba(87, 150, 74, 0.35);
  color: var(--accent-ink);
}

.pass-badge {
  display: inline-block;
  margin: 0.4rem 0 0;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--chip-grad);
  border: 1px solid var(--line-strong);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

/* ─── 16 · You / info ────────────────────────────────────────────────────── */

.info-list {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 1.25rem;
}

.info-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.62rem 0.1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  color: var(--ink-muted);
}

.info-list li:last-child {
  border-bottom: none;
}

.info-list strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.account-line {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* ─── 17 · Toasts (overlay — never shift page layout) ────────────────────── */

.toast-bar {
  position: fixed;
  left: max(0.75rem, var(--safe-l));
  right: max(0.75rem, var(--safe-r));
  top: calc(0.55rem + var(--safe-t));
  z-index: 85;
  margin: 0;
  max-width: 26rem;
  margin-inline: auto;
  padding: 0.65rem 0.95rem;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
  box-shadow: var(--shadow-2);
  pointer-events: none;
  animation: toast-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast-bar[hidden] {
  display: none !important;
}

/* Solid fills — translucent tokens wash out over the page behind. */
.ok.toast-bar {
  background: #eef6e4;
  border: 1.5px solid #6a984f;
  color: #2f4a28;
}

.err.toast-bar {
  background: #fcece7;
  border: 1.5px solid #c45a3e;
  color: #7a2a18;
}

@media (prefers-color-scheme: dark) {
  .ok.toast-bar {
    background: #2a4030;
    border-color: #7dcb6a;
    color: #e8f8dc;
  }

  .err.toast-bar {
    background: #4a2c28;
    border-color: #f0a088;
    color: #ffe8e0;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ─── 18 · Legacy bits (kept for older markup) ───────────────────────────── */

.muted {
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.wallet {
  margin: 0.75rem 0 1rem;
}

.herd {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 0.25rem;
}

.herd-chip {
  font-size: 0.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.herd-chip.on {
  background: var(--brand-soft);
  border-color: var(--accent);
}

.herd-chip.pasture {
  opacity: 0.75;
  border-style: dashed;
}

.herd-chip.retired {
  opacity: 0.7;
  border-color: var(--ink-muted);
  background: var(--tint-gold);
}

.shop {
  margin: 0.75rem 0 0.5rem;
  padding: 0.55rem 0.65rem 0.65rem;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-strong);
  background: var(--surface);
}

.shop-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.shop-row button {
  font-size: 0.8rem;
}

/* ─── 19 · Responsive ────────────────────────────────────────────────────── */

@media (max-width: 360px) {
  .act-grid:has(> :nth-child(4)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .act-grid-rest {
    grid-template-columns: 1.3fr 1fr;
  }

  .app-bar-sub {
    max-width: 8rem;
  }
}

@media (min-width: 520px) {
  .game-main {
    padding-top: 1.15rem;
  }

  .card {
    padding: 1.5rem;
  }
}

/* ─── 20 · Life & motion ─────────────────────────────────────────────────── */

/* Auth logo breathes gently */
.logo {
  animation: logo-float 6s ease-in-out infinite;
}

@keyframes logo-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Gold chip: twinkling star + occasional shimmer sweep */
.gold-chip {
  position: relative;
  overflow: hidden;
}

.gold-chip [aria-hidden] {
  animation: twinkle 2.8s ease-in-out infinite;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.82) rotate(18deg);
  }
}

.gold-chip::before {
  content: "";
  position: absolute;
  inset: -20% -60%;
  background: linear-gradient(
    100deg,
    transparent 42%,
    rgba(255, 253, 245, 0.55) 50%,
    transparent 58%
  );
  transform: translateX(-120%);
  animation: chip-shimmer 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes chip-shimmer {
  0%,
  72% {
    transform: translateX(-120%);
  }
  88%,
  100% {
    transform: translateX(120%);
  }
}

/* Bars: soft light sweep across the fill */
.bar i {
  position: relative;
  overflow: hidden;
}

.bar i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 70%
  );
  transform: translateX(-130%);
  animation: bar-shine 4.5s ease-in-out infinite;
}

@keyframes bar-shine {
  0%,
  60% {
    transform: translateX(-130%);
  }
  85%,
  100% {
    transform: translateX(130%);
  }
}

/* A butterfly drifts across the portrait now and then */
.portrait {
  position: relative;
}

.portrait::after {
  content: "🦋";
  position: absolute;
  top: 14%;
  left: -6%;
  font-size: 0.95rem;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(61, 44, 33, 0.25));
  animation: flutter 18s ease-in-out infinite 3s;
}

@keyframes flutter {
  0%,
  55% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
  }
  58% {
    opacity: 0.9;
  }
  66% {
    transform: translate(18vw, -3.2rem) rotate(-14deg);
  }
  74% {
    transform: translate(38vw, -1rem) rotate(10deg);
  }
  82% {
    opacity: 0.9;
    transform: translate(58vw, -3.8rem) rotate(-10deg);
  }
  90%,
  100% {
    opacity: 0;
    transform: translate(78vw, -2.2rem) rotate(6deg);
  }
}

/* Nav indicator pops in */
.nav-item.on::after {
  animation: nav-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes nav-pop {
  from {
    transform: translateX(-50%) scaleX(0.2);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) scaleX(1);
    opacity: 1;
  }
}

/* Care-done checkmark bounces in */
.act-tile.done::after {
  animation: check-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes check-in {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

/* TEMPORARY test-gold card — dashed to signal "not a real product" */
button.shop-card-test {
  border-style: dashed;
  border-color: rgba(94, 163, 79, 0.55);
  background:
    linear-gradient(135deg, rgba(134, 191, 111, 0.12), transparent 60%),
    var(--tile-grad);
}

.shop-card-test strong {
  color: var(--ok);
}

.shop-card-test em {
  background: var(--ok-bg);
  border-color: var(--ok-line);
  color: var(--ok);
}

.fair-hint {
  margin: -0.15rem 0 0.55rem;
  font-size: 0.84rem;
}

.fair-grid .fair-tile .act-label {
  font-size: 0.78rem;
}

.fair-tile.done {
  opacity: 0.72;
}

/* ─── 21 · Horse tools + detail sheet ────────────────────────────────────── */

.horse-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}

.horse-tools {
  display: flex;
  gap: 0.35rem;
}

.icon-btn {
  width: 2.15rem;
  height: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--tile-grad);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  background: var(--tile-grad-hover);
}

.icon-btn:active {
  transform: scale(0.94);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.sheet[hidden] {
  display: none;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(40, 48, 28, 0.42);
  cursor: pointer;
  animation: sheet-fade 0.22s ease;
}

.sheet-panel {
  position: relative;
  width: min(32rem, 100%);
  max-height: min(78vh, 40rem);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border: 1.5px solid var(--line);
  border-bottom: 0;
  box-shadow: var(--shadow-2);
  padding: 1rem 1.15rem calc(1.25rem + var(--safe-b));
  animation: sheet-up 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.sheet-head .h {
  margin: 0;
  font-size: 1.2rem;
}

.sheet-body {
  display: grid;
  gap: 0.85rem;
}

.ped-tree {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
  padding: 0.2rem 0 0.35rem;
  width: 100%;
}

.ped-tree.rich {
  gap: 0.55rem;
}

.ped-gen-label {
  width: 100%;
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: center;
}

.ped-node {
  width: min(100%, 16rem);
  text-align: center;
  padding: 0.65rem 0.85rem;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--tile-grad);
  font: inherit;
  color: inherit;
}

button.ped-node {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

button.ped-node:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.ped-node.focus {
  border-color: rgba(94, 163, 79, 0.65);
  background: linear-gradient(180deg, #f4fbe8, #eef6dc);
  box-shadow: 0 0 0 3px rgba(94, 163, 79, 0.12);
}

.ped-node.compact {
  padding: 0.45rem 0.5rem;
}

.ped-node.compact .ped-name {
  font-size: 0.88rem;
}

.ped-node .ped-role {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.12rem;
}

.ped-node .ped-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink);
}

.ped-node .ped-meta {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.ped-parents,
.ped-grandparents {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
}

.ped-gp-pair {
  display: grid;
  gap: 0.35rem;
}

.ped-parents .ped-node,
.ped-grandparents .ped-node {
  width: 100%;
}

.ped-link {
  width: 2px;
  height: 0.65rem;
  background: var(--line-strong);
  border-radius: 2px;
}

.ped-link.tall {
  height: 0.9rem;
}

.kin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  width: 100%;
}

.kin-list li {
  margin: 0;
}

.kin-link {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--tile-grad);
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.kin-link:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.kin-link strong {
  font-family: var(--font-display);
  font-weight: 800;
}

.kin-link span {
  font-size: 0.8rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .ped-node.focus {
    background: linear-gradient(180deg, rgba(94, 163, 79, 0.28), rgba(94, 163, 79, 0.1));
  }
}

.info-grid {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.info-grid div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 0.92rem;
}

.info-grid dt {
  margin: 0;
  color: var(--ink-muted);
  font-weight: 700;
}

.info-grid dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  text-align: right;
}

.sheet-note {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@keyframes sheet-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(12%);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-color-scheme: dark) {
  .ped-node.foal {
    background: linear-gradient(180deg, rgba(94, 163, 79, 0.22), rgba(94, 163, 79, 0.08));
  }
  .sheet-backdrop {
    background: rgba(8, 12, 18, 0.55);
  }
}

/* ─── 22 · Reduced motion ────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
