/* Clawdin Studio. Oscuro primero, acento naranja de Claude (#D97757). */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141413;
  --surface: #1c1b1a;
  --surface-2: #262624;
  --surface-3: #30302e;
  --border: #33322f;
  --border-strong: #4a4945;
  --text: #f0eee6;
  --text-2: #c2c0b6;
  --muted: #9c9a92;
  --accent: #d97757;
  --accent-hover: #e48b6d;
  --accent-ink: #e08a6c;
  --accent-soft: rgba(217, 119, 87, 0.16);
  --on-accent: #141413;
  --focus: #f2a08a;
  --ok: #7cc68d;
  --ok-soft: rgba(124, 198, 141, 0.13);
  --warn: #e5b45a;
  --warn-soft: rgba(229, 180, 90, 0.13);
  --error: #ff8a80;
  --error-soft: rgba(255, 138, 128, 0.12);
  --info-soft: rgba(217, 119, 87, 0.09);
  --console-bg: #0b0b0a;
  --console-text: #e6e3da;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --clawd: #d97757;
  --clawd-eye: #141413;
  /* Las pinzas cuando pasan por delante del cuerpo (tapándose los ojos). */
  --clawd-shade: #a9583d;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #faf9f5;
  --surface: #ffffff;
  --surface-2: #f0eee6;
  --surface-3: #e6e4da;
  --border: #e0ddd2;
  --border-strong: #c9c6ba;
  --text: #141413;
  --text-2: #3d3d3a;
  --muted: #5e5d59;
  --accent: #d97757;
  --accent-hover: #c96846;
  --accent-ink: #a8432a;
  --accent-soft: rgba(217, 119, 87, 0.14);
  --on-accent: #141413;
  --focus: #b8452a;
  --ok: #2f7d43;
  --ok-soft: rgba(47, 125, 67, 0.1);
  --warn: #8a5a00;
  --warn-soft: rgba(196, 140, 20, 0.13);
  --error: #b42318;
  --error-soft: rgba(180, 35, 24, 0.08);
  --info-soft: rgba(217, 119, 87, 0.08);
  --console-bg: #141413;
  --console-text: #e6e3da;
  --shadow: 0 1px 0 rgba(20, 20, 19, 0.04), 0 8px 24px rgba(20, 20, 19, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
}

h1, h2, h3 {
  line-height: 1.25;
  margin: 0 0 0.5em;
  font-weight: 650;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75em; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
code {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 0.3em;
  overflow-wrap: anywhere;
}
ul, ol { padding-left: 1.3em; margin: 0 0 0.75em; }
li + li { margin-top: 0.25em; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--accent);
  color: var(--on-accent);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hint { font-size: 0.87rem; color: var(--muted); }

/* ------------------------------------------------------------------ botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-primary:disabled:hover { background: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; }
/* "Elegida" o "Es el destino OTA": muestran un estado, no están rotos. */
.btn-ghost[aria-disabled="true"] { opacity: 0.85; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 1.02rem; }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 0.85rem; }
.btn-icon { width: 40px; padding: 0; }
.btn-block { width: 100%; }
.btn .icon { flex: none; }
.btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.actions-end { justify-content: flex-end; }

/* ------------------------------------------------------------------ formularios */

label { font-weight: 550; }
input[type="text"],
input[type="password"],
select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 10px;
}
input[type="text"],
input[type="password"] { width: 100%; }
input[aria-invalid="true"] { border-color: var(--error); }
input[type="checkbox"],
input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.field { display: grid; gap: 6px; margin-bottom: 12px; max-width: 420px; }
.field-inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 450; cursor: pointer; min-height: 32px; }
.input-row { display: flex; gap: 8px; align-items: center; }
.field-error { color: var(--error); font-size: 0.9rem; min-height: 1.4em; margin: 4px 0 8px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; display: grid; gap: 4px; }
legend { font-weight: 550; padding: 0; margin-bottom: 4px; }

/* ------------------------------------------------------------------ piezas */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card,
section + section { margin-top: 18px; }

.notice {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--info-soft);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 14px;
}
.notice-ok { border-left-color: var(--ok); background: var(--ok-soft); }
.notice-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.notice-error { border-left-color: var(--error); background: var(--error-soft); }
.notice .actions { margin-top: 10px; }
.notice.small { padding: 8px 12px; font-size: 0.9rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid transparent;
}
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-muted { background: var(--surface-2); color: var(--text-2); }
.badge-soon { background: transparent; color: var(--accent-ink); border: 1px dashed var(--accent); font-size: 0.7rem; letter-spacing: 0.02em; }
h1 .badge { font-size: 0.75rem; margin-left: 6px; vertical-align: 0.3em; }

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 18px;
  color: var(--text-2);
  background: var(--surface);
}

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.spinner {
  width: 12px;
  height: 12px;
  background: var(--accent);
  animation: pixel-blink 0.9s steps(2, start) infinite;
}
@keyframes pixel-blink {
  to { opacity: 0.2; transform: translateX(6px); }
}

progress {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
  color: var(--accent);
}
progress::-webkit-progress-bar { background: var(--surface-3); }
progress::-webkit-progress-value {
  background: repeating-linear-gradient(90deg, var(--accent) 0 10px, var(--accent-hover) 10px 12px);
}
progress::-moz-progress-bar { background: var(--accent); }
progress:indeterminate {
  background: repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 20px) var(--surface-3);
  background-size: 40px 100%;
  animation: progress-walk 0.8s steps(4) infinite;
}
progress:indeterminate::-webkit-progress-bar { background: transparent; }
progress:indeterminate::-moz-progress-bar { background: transparent; }
@keyframes progress-walk { to { background-position: 40px 0; } }
.progress-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.progress-text { margin: 8px 0 0; font-weight: 550; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ marco */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 58px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 12px);
  opacity: 0.55;
  pointer-events: none;
}
/* Clawdin (cosquillas) y el link al inicio van separados: un botón no puede ir dentro de un link. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: -6px;
  min-width: 0;
}
.brand-link {
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-link:hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); }
.brand strong { color: var(--accent-ink); font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.server-pill:empty { display: none; }

.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: calc(100vh - 58px);
}
.sidenav {
  position: sticky;
  top: 58px;
  align-self: start;
  height: calc(100vh - 58px);
  overflow-y: auto;
  padding: 18px 12px;
  border-right: 1px solid var(--border);
}
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-list li + li { margin-top: 0; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 520;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-link[aria-current="page"] .icon { color: var(--accent); }
.nav-link .icon { color: var(--muted); flex: none; }
.nav-soon {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  padding: 0 6px;
}
.nav-group {
  margin: 20px 12px 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 650;
}

.content {
  padding: 28px 32px 64px;
  max-width: 1040px;
  width: 100%;
}
.content:focus { outline: none; }
.page-head { margin-bottom: 22px; }
.page-head h1 { margin-bottom: 6px; }
.lead { color: var(--text-2); font-size: 1.02rem; max-width: 68ch; }
.section-title { margin: 26px 0 12px; }
.step-num {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 3px;
  vertical-align: 1px;
}

/* ------------------------------------------------------------------ entrada */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card { width: min(440px, 100%); padding: 32px 28px; }
.login-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.login-card h1 { text-align: center; font-size: 1.6rem; }
.login-card .lead { text-align: center; font-size: 0.97rem; }
.login-card form { margin-top: 18px; display: grid; gap: 6px; }
.server-line { margin-top: 18px; font-size: 0.87rem; color: var(--text-2); display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ inicio */

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.home-grid > .card { margin: 0; }
.face-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.face-card h2 { align-self: stretch; text-align: left; }
.face-card .field-inline { font-size: 0.9rem; }
.face-frame {
  display: block;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 10 / 11;
  border: 0;
  background: transparent;
  color-scheme: dark;
}
:root[data-theme="light"] .face-frame { color-scheme: light; }
.status-list { margin: 0; display: grid; gap: 0; }
.status-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.status-row:first-child { border-top: 0; padding-top: 4px; }
.status-row dt { color: var(--muted); font-weight: 550; }
.status-row dd { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.shortcut-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.shortcut-grid li + li { margin-top: 0; }
.shortcut {
  display: grid;
  gap: 4px;
  height: 100%;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.12s, transform 0.12s;
}
.shortcut:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.shortcut-icon { color: var(--accent); margin-bottom: 6px; }
.shortcut-title { font-weight: 650; }
.shortcut-text { color: var(--text-2); font-size: 0.9rem; }
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 24px;
  margin-bottom: 22px;
}
.home-hero .page-head { margin-bottom: 0; }
.home-mascot { display: grid; justify-items: center; gap: 2px; }
.mascot-hint { margin: 0; font-size: 0.78rem; color: var(--muted); }

/* ------------------------------------------------------------------ Clawdin vivo */

/* Las medidas de adentro del SVG son píxeles del sprite (16×10): translate(1px)
   corre un píxel de Clawd. Todo con steps() para que siga siendo pixel art. */
.mascot {
  position: relative;
  display: inline-grid;
  place-items: center;
  padding: 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  line-height: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.mascot-svg { display: block; overflow: visible; }
.m-all { transform-origin: 8px 5px; }
.m-claw { transition: transform 0.24s steps(2, end); }
.m-look { transform: translate(var(--look-x, 0px), var(--look-y, 0px)); }
/* Sólo mira el puntero (o a un costado) en reposo: dormido no, y panza arriba se le darían vuelta los ojos. */
.mascot:not([data-mood="idle"]) .m-look { transform: none; }
.m-arm,
.m-face-closed,
.m-face-happy,
.m-face-sad,
.m-face-dizzy,
.m-z { display: none; }
.mascot:not([data-face="open"]) .m-face-open { display: none; }
.mascot[data-face="closed"] .m-face-closed,
.mascot[data-face="happy"] .m-face-happy,
.mascot[data-face="sad"] .m-face-sad,
.mascot[data-face="dizzy"] .m-face-dizzy { display: inline; }

/* Reposo: respira (baja medio píxel y vuelve). Dormido, más lento y con una "z". */
.mascot:is([data-mood="idle"], [data-mood="shy"], [data-mood="peek"]) .m-upper { animation: m-breathe 2.4s steps(1, end) infinite; }
.mascot[data-mood="sleep"] .m-upper { animation: m-breathe 3.6s steps(1, end) infinite; }
.mascot[data-mood="sleep"] .m-z { display: inline; animation: m-z 2.4s steps(4, end) infinite; }
@keyframes m-breathe { 50% { transform: translateY(0.5px); } }
@keyframes m-z { to { transform: translate(2px, -2px); opacity: 0; } }

/* De vez en cuando, una pinza o una patita. */
.mascot[data-mood="idle"][data-fidget="claw-l"] .m-claw-l .m-claw-wave,
.mascot[data-mood="idle"][data-fidget="claw-r"] .m-claw-r .m-claw-wave { animation: m-snip 0.6s steps(1, end); }
.mascot[data-mood="idle"][data-fidget="leg-0"] .m-leg-0,
.mascot[data-mood="idle"][data-fidget="leg-1"] .m-leg-1,
.mascot[data-mood="idle"][data-fidget="leg-2"] .m-leg-2,
.mascot[data-mood="idle"][data-fidget="leg-3"] .m-leg-3 { animation: m-tap 0.6s steps(1, end); }
@keyframes m-snip { 0%, 50% { transform: translateY(-1px); } 25%, 75% { transform: none; } }
@keyframes m-tap { 0%, 66% { transform: translateY(-1px); } 33% { transform: none; } }

/* Pudor de cangrejo: se tapa los ojos con las pinzas; espiando, baja una. */
.mascot[data-mood="shy"] .m-claw-l { transform: translate(3px, -2px); }
.mascot:is([data-mood="shy"], [data-mood="peek"]) .m-claw-r { transform: translate(-3px, -2px); }
.mascot[data-mood="peek"] .m-claw-l { transform: translate(1px, -1px); }
/* Los brazos (más oscuros, como las pinzas) muestran de dónde salen las pinzas. */
.mascot[data-mood="shy"] .m-arm-l,
.mascot:is([data-mood="shy"], [data-mood="peek"]) .m-arm-r { display: inline; }
.mascot:is([data-mood="shy"], [data-mood="peek"]) .m-claw-r rect,
.mascot[data-mood="shy"] .m-claw-l rect { fill: var(--clawd-shade); }

/* Cosquillas: se sacude, agita las pinzas para arriba y patalea. */
.mascot[data-mood="giggle"] .m-all { animation: m-giggle 0.14s steps(1, end) 5; }
.mascot[data-mood="laugh"] .m-all { animation: m-laugh 0.35s steps(1, end) 4; }
.mascot[data-mood="enough"] .m-all { animation: m-tumble 2.4s steps(1, end) forwards; }
.mascot:is([data-mood="giggle"], [data-mood="happy"]) .m-claw-wave { animation: m-wave 0.28s steps(1, end) infinite; }
.mascot[data-mood="laugh"] .m-claw-wave { animation: m-wave-big 0.2s steps(1, end) infinite; }
.mascot:is([data-mood="giggle"], [data-mood="laugh"], [data-mood="happy"]) .m-claw-r .m-claw-wave { animation-delay: -0.1s; }
.mascot:is([data-mood="giggle"], [data-mood="laugh"], [data-mood="enough"]) .m-leg { animation: m-kick 0.2s steps(1, end) infinite; }
.mascot:is([data-mood="giggle"], [data-mood="laugh"], [data-mood="enough"]) :is(.m-leg-1, .m-leg-3) { animation-delay: -0.1s; }
@keyframes m-giggle { 0% { transform: translateX(-0.5px); } 50% { transform: translateX(0.5px); } }
/* La carcajada rebota para arriba; de costado, apenas medio píxel. */
@keyframes m-laugh {
  0%, 50% { transform: translate(0, -1px); }
  25% { transform: translate(0.5px, 0); }
  75% { transform: translate(-0.5px, 0); }
}
/* Seis o más: "¡basta!", se da vuelta panza arriba, mareado, y se endereza. */
/* Sin cuadros a 90°: de costado el sprite mide 10×16 y se saldría del botón. */
@keyframes m-tumble {
  0%, 10% { transform: translateX(-1px); }
  5% { transform: translateX(1px); }
  15%, 72% { transform: rotate(180deg); }
  44% { transform: rotate(180deg) translateY(0.5px); }
  80%, 100% { transform: none; }
}
@keyframes m-wave { 0% { transform: translateY(-1px); } 50% { transform: translateY(-2px); } }
@keyframes m-wave-big { 0% { transform: translateY(-2px); } 50% { transform: translateY(-3px); } }
@keyframes m-kick { 0% { transform: translateY(-0.5px); } 50% { transform: none; } }

/* Contento: un saltito. Triste: niega con la cabeza y baja las pinzas. */
.mascot[data-mood="happy"] .m-all { animation: m-hop 0.9s steps(1, end); }
.mascot[data-mood="sad"] .m-upper { animation: m-no 0.8s steps(1, end) 2; }
.mascot[data-mood="sad"] .m-claw { transform: translateY(1px); }
@keyframes m-hop {
  0% { transform: translateY(0.5px); }
  15%, 50% { transform: translateY(-1px); }
  30% { transform: translateY(-2px); }
  65%, 100% { transform: none; }
}
@keyframes m-no {
  0%, 50% { transform: translateX(-1px); }
  25% { transform: translateX(1px); }
  75%, 100% { transform: none; }
}

/* Pestaña oculta: todo quieto. Movimiento reducido: sin loops ni sacudones, sólo la cara. */
.mascot.is-paused * { animation-play-state: paused !important; }
.mascot.is-still * {
  animation: none !important;
  transition: none !important;
}

/* Las burbujas ("ji", "jaja") flotan sobre Clawdin y se desvanecen. Van en
   absoluto: no corren nada ni agregan scroll. */
.mascot-bubbles {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 4px);
  z-index: 5;
  width: 0;
  height: 0;
  pointer-events: none;
}
.mascot-bubble {
  --rise: -16px;
  position: absolute;
  bottom: 0;
  left: 0;
  width: max-content;
  max-width: min(13em, calc(100vw - 48px));
  transform: translateX(calc(-50% + var(--bx, 0px)));
  padding: 2px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--accent-ink);
  font: 700 0.8rem/1.35 ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  animation: m-bubble var(--life, 1.1s) steps(6, end) forwards;
}
@keyframes m-bubble {
  0% { translate: 0 2px; opacity: 1; }
  70% { opacity: 1; }
  100% { translate: 0 var(--rise); opacity: 0; }
}
/* En la barra no hay lugar arriba: las burbujas salen abajo, hacia la derecha. */
.mascot-brand .mascot-bubbles { left: 6px; top: calc(100% - 4px); bottom: auto; }
.mascot-brand .mascot-bubble { --rise: 8px; top: 0; bottom: auto; transform: translateX(var(--bx, 0px)); }
/* En el inicio Clawdin está arriba de todo y contra el borde derecho: las
   burbujas salen a su izquierda, dentro del encabezado, y suben poco (si no,
   las tapa la barra o la tira del menú, que van fijas). */
.mascot-hero .mascot-bubbles { left: auto; right: calc(100% - 6px); top: 22%; bottom: auto; }
.mascot-hero .mascot-bubble { --rise: -8px; top: 0; bottom: auto; left: auto; right: 0; transform: translateX(var(--bx, 0px)); }

/* ------------------------------------------------------------------ firmware */

.flash-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 20px;
  align-items: start;
}
.flash-face .face-frame { max-width: 200px; margin-inline: auto; }
.howto li::marker { color: var(--accent-ink); font-weight: 700; }
.flash-steps {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.flash-steps li + li { margin-top: 0; }
.flash-step { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.step-dot { width: 10px; height: 10px; background: var(--surface-3); border: 1px solid var(--border-strong); }
.flash-step.is-active { color: var(--text); font-weight: 600; }
.flash-step.is-active .step-dot { background: var(--accent); border-color: var(--accent); animation: pixel-pulse 0.8s steps(2) infinite; }
.flash-step.is-done { color: var(--text-2); }
.flash-step.is-done .step-dot { background: var(--ok); border-color: var(--ok); }
.flash-step.is-error { color: var(--error); font-weight: 600; }
.flash-step.is-error .step-dot { background: var(--error); border-color: var(--error); }
@keyframes pixel-pulse { 50% { opacity: 0.35; } }
.log-details { margin-top: 18px; }
.log-details summary,
.advanced summary { cursor: pointer; color: var(--text-2); font-weight: 550; min-height: 32px; display: list-item; }
.advanced { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.advanced-body { display: grid; gap: 8px; padding: 10px 0 0 4px; }
.flash-log {
  margin: 10px 0 0;
  max-height: 260px;
  overflow: auto;
  background: var(--console-bg);
  color: var(--console-text);
  border-radius: 8px;
  padding: 12px;
  font: 12.5px/1.45 ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.flash-log:empty::before { content: "Todavía no hay nada."; color: #8b8a84; }
#modo-descarga.is-highlighted { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.summary-title { display: inline; margin: 0; font-size: 1.15rem; color: var(--text); }
details > summary { cursor: pointer; }
.version-detail { margin-top: 6px; }

/* ------------------------------------------------------------------ actualizaciones */

.ota-summary { color: var(--text-2); }
.version-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.version-list li + li { margin-top: 0; }
.version-card.is-target { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); box-shadow: inset 4px 0 0 var(--accent), var(--shadow); }
.version-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 4px; }
.version-head h3 { margin: 0; font-size: 1.1rem; }
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.meta { color: var(--muted); font-size: 0.87rem; margin-bottom: 8px; }
.changelog { color: var(--text-2); }
.changelog ul { margin-bottom: 8px; }
.changelog-title { font-weight: 650; color: var(--text); margin-bottom: 4px; }
.changelog-preview { margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: var(--surface-2); }
.upload-card { margin-top: 26px; }
.dropzone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 26px 16px;
  margin: 14px 0;
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: center;
}
.dropzone p { margin: 0; color: var(--text-2); }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.file-slots { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.file-slots li + li { margin-top: 0; }
.file-slot {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(0, 1.2fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  min-height: 48px;
}
.file-slot.is-missing { background: transparent; border: 1px dashed var(--border-strong); }
.slot-label { font-weight: 600; display: grid; }
.slot-label small { font-weight: 400; color: var(--muted); }
.slot-file small { color: var(--muted); }
.checks { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.checks li + li { margin-top: 0; }
.check { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; align-items: start; }
.check-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 3px; font-weight: 800; font-size: 0.8rem; margin-top: 1px; }
.check-error .check-mark { background: var(--error-soft); color: var(--error); }
.check-warn .check-mark { background: var(--warn-soft); color: var(--warn); }
.check-ok .check-mark { background: var(--ok-soft); color: var(--ok); }

/* ------------------------------------------------------------------ consola */

.console-card { padding: 14px; }
.console-toolbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.toolbar-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.console-status { margin: 10px 2px; color: var(--text-2); font-size: 0.9rem; }
.console-output {
  height: clamp(320px, 62vh, 760px);
  overflow: auto;
  background: var(--console-bg);
  color: var(--console-text);
  border-radius: 10px;
  padding: 10px 12px;
  font: 12.5px/1.5 ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.console-output:empty::before { content: "Conectá la placa para ver lo que escribe."; color: #8b8a84; }
.ln { min-height: 1.5em; }
.ln .ts { display: none; color: #7d7b74; user-select: none; }
.show-ts .ln .ts { display: inline; }
.ln-E { color: #ff8a80; }
.ln-W { color: #f0c46b; }
.ln-I { color: #9fdba8; }
.ln-D, .ln-V { color: #9d9b94; }
.ln-S { color: #f2a08a; font-style: italic; }

/* ------------------------------------------------------------------ voz */

.voice-grid {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.voice-grid li + li { margin-top: 0; }
.voice-card { display: flex; flex-direction: column; margin: 0; }
.voice-card .actions { margin-top: auto; padding-top: 12px; }
.voice-card.is-active { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent), var(--shadow); }
.voice-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.voice-head h3 { margin: 0 0 4px; }
.voice-desc { color: var(--text-2); font-size: 0.92rem; margin-bottom: 6px; }
.voice-id { margin: 0; font-size: 0.8rem; color: var(--muted); }

/* ------------------------------------------------------------------ próximamente */

.soon-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; border-style: dashed; }
.soon-icon { color: var(--accent); padding: 10px; background: var(--accent-soft); border-radius: 12px; line-height: 0; }

/* ------------------------------------------------------------------ avisos y diálogo */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease-out;
}
.toast p { margin: 0; flex: 1; }
.toast-ok { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--error); }
.toast-close {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.toast-close:hover { background: var(--surface-2); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.dialog {
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 22px;
  width: min(460px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.dialog::backdrop { background: rgba(10, 10, 9, 0.6); }
.dialog-body { color: var(--text-2); }

/* ------------------------------------------------------------------ angosto */

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav {
    position: sticky;
    top: 58px;
    z-index: 10;
    height: auto;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .nav-list { display: flex; gap: 4px; }
  .nav-link { white-space: nowrap; padding: 6px 10px; }
  .nav-link[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); }
  .nav-group { display: none; }
  .content { padding: 22px 16px 56px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .flash-layout { grid-template-columns: minmax(0, 1fr); }
  .flash-face { order: -1; }
  .flash-face .face-frame { max-width: 160px; }
}

@media (max-width: 560px) {
  h1 { font-size: 1.45rem; }
  .brand-link strong { display: none; }
  .home-hero { grid-template-columns: minmax(0, 1fr); }
  .home-mascot { justify-self: center; }
  /* Apilado: Clawdin queda debajo del título, así que las burbujas pueden volver a salir arriba. */
  .mascot-hero .mascot-bubbles { left: 50%; right: auto; top: auto; bottom: calc(100% - 4px); }
  .mascot-hero .mascot-bubble { --rise: -16px; top: auto; bottom: 0; left: 0; right: auto; transform: translateX(calc(-50% + var(--bx, 0px))); }
  .server-pill { display: none; }
  .card { padding: 16px; }
  .file-slot { grid-template-columns: minmax(0, 1fr) auto; }
  .file-slot .slot-file { grid-column: 1 / -1; grid-row: 2; }
  .soon-card { grid-template-columns: minmax(0, 1fr); }
  .status-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .mascot *,
  .mascot-bubble {
    animation: none !important;
    transition: none !important;
  }
}
