/* ─────────────────────────────────────────────
   pecera de amor · un pequeño tanque de tinta
   ───────────────────────────────────────────── */

:root {
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;

  --bg: #efeade;
  --bg-glow: #faf5e9;
  --bg-glow-2: #e4dcc9;
  --ink: #1c1b17;
  --ink-soft: rgba(28, 27, 23, 0.62);
  --ink-faint: rgba(28, 27, 23, 0.16);
  --paper: #e9e4d5;
  --card: #f8f3e7;
  --line: rgba(28, 27, 23, 0.17);
  --accent: #d97c4e;
  --device: #f3eee2;
  --device-2: #dcd4c1;
  --device-edge: #c7bfab;
  --bezel-ink: #86806f;
  --button: #f7f2e6;
  --shadow: 0 34px 70px -38px rgba(57, 46, 24, 0.55), 0 8px 22px -18px rgba(57, 46, 24, 0.35);

  color-scheme: light;
}

[data-theme="night"] {
  --bg: #0f1114;
  --bg-glow: #1b1f24;
  --bg-glow-2: #08090b;
  --ink: #e8e1d1;
  --ink-soft: rgba(232, 225, 209, 0.6);
  --ink-faint: rgba(232, 225, 209, 0.15);
  --paper: #15181c;
  --card: #1b1f24;
  --line: rgba(232, 225, 209, 0.16);
  --accent: #e08a5f;
  --device: #24272d;
  --device-2: #171a1e;
  --device-edge: #373b42;
  --bezel-ink: #8c8f94;
  --button: #1b1f24;
  --shadow: 0 34px 80px -30px rgba(0, 0, 0, 0.9), 0 10px 24px -16px rgba(0, 0, 0, 0.8);

  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100svh;
  margin: 0;
  font-family: var(--mono);
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg-glow) 0%, transparent 58%),
    radial-gradient(90% 70% at 105% 105%, var(--bg-glow-2) 0%, transparent 62%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  transition: background-color 0.4s ease, color 0.4s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, var(--ink-faint) 1px, transparent 1.2px);
  background-size: 24px 24px;
  opacity: 0.45;
  -webkit-mask-image: radial-gradient(80% 70% at 50% 45%, #000 0%, transparent 100%);
  mask-image: radial-gradient(80% 70% at 50% 45%, #000 0%, transparent 100%);
}

body::after {
  content: "";
  position: fixed;
  z-index: 0;
  left: 50%;
  top: 52%;
  width: min(760px, 92vw);
  height: min(760px, 92vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--bg-glow) 65%, transparent) 0%, transparent 68%);
  opacity: 0.7;
  filter: blur(10px);
}

body.no-scroll { overflow: hidden; }

.page {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding:
    max(16px, env(safe-area-inset-top))
    clamp(14px, 4vw, 30px)
    max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(12px, 2.4vh, 22px);
}

/* ── barra superior ─────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-fish {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: -0.09em;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 11px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--card) 65%, transparent), transparent),
    color-mix(in srgb, var(--bg) 60%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 45%, transparent);
  animation: brandDrift 6s ease-in-out infinite;
}

@keyframes brandDrift {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-2px) rotate(1deg); }
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.brand-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 8px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
}

.chip {
  height: 32px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--button) 78%, transparent);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease;
}

.chip svg { width: 13px; height: 13px; }
.chip:hover { transform: translateY(-1px); background: var(--button); }
.chip:active { transform: translateY(0); }

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: color-mix(in srgb, var(--button) 70%, transparent); transform: rotate(-4deg); }
.icon-btn:active { transform: rotate(0) scale(0.96); }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── la pecera ──────────────────────────────── */

.tank-wrap {
  position: relative;
  z-index: 1;
  width: min(780px, 100%);
  margin: 0 auto;
}

.device {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: clamp(14px, 2.4vw, 22px) clamp(14px, 2.4vw, 22px) 6px;
  border: 1px solid var(--device-edge);
  border-radius: 22px;
  background: linear-gradient(
    142deg,
    color-mix(in srgb, var(--device) 86%, #fff) 0%,
    var(--device) 42%,
    var(--device-2) 100%
  );
  box-shadow:
    var(--shadow),
    inset 0 1px 0 color-mix(in srgb, #fff 58%, transparent),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.screen {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 9px;
  background: var(--paper);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent),
    inset 0 14px 30px rgba(55, 42, 15, 0.07),
    inset 0 -18px 34px rgba(55, 42, 15, 0.05);
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.screen-sheen {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    linear-gradient(116deg, rgba(255, 255, 255, 0.14) 0%, transparent 24%, transparent 72%, rgba(255, 255, 255, 0.05) 100%),
    radial-gradient(110% 80% at 50% 0%, rgba(255, 255, 255, 0.14), transparent 45%);
}

.tank-status {
  position: relative;
  z-index: 6;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 13px 7px;
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px dashed var(--ink-faint);
}

.tank-status .hearts {
  color: var(--accent);
  letter-spacing: 0.08em;
  font-weight: 600;
  transition: transform 0.18s ease;
}

.tank-status .hearts.pop { animation: heartPop 0.35s ease; }

@keyframes heartPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.24); }
  100% { transform: scale(1); }
}

.canvas-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
}

#tank {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: crosshair;
}

.tap-hint {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 5px 10px 6px;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink-soft);
  white-space: nowrap;
  border: 1px solid var(--ink-faint);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(2px);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.tap-hint.gone {
  opacity: 0;
  transform: translate(-50%, 6px);
}

.device-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 5px 3px;
  font-size: 7px;
  letter-spacing: 0.2em;
  color: var(--bezel-ink);
  text-transform: uppercase;
}

.led {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent), 0 0 8px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: ledPulse 4s ease-in-out infinite;
}

@keyframes ledPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.screw {
  position: absolute;
  z-index: 3;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fcf9f0, #cdc5b2 70%, #b3aa96);
  box-shadow:
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.2),
    0 1px 1px rgba(0, 0, 0, 0.14);
  opacity: 0.9;
}

[data-theme="night"] .screw {
  background: radial-gradient(circle at 34% 28%, #555a62, #2b2f35 70%, #202329);
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.5), 0 1px 1px rgba(0, 0, 0, 0.4);
}

.screw::before,
.screw::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 1px;
  background: rgba(75, 65, 45, 0.45);
}

.screw::before { transform: translate(-50%, -50%) rotate(45deg); }
.screw::after { transform: translate(-50%, -50%) rotate(-45deg); }

.screw-tl { top: 8px; left: 8px; }
.screw-tr { top: 8px; right: 8px; }
.screw-bl { bottom: 8px; left: 8px; }
.screw-br { bottom: 8px; right: 8px; }

.tape {
  position: absolute;
  z-index: 3;
  left: -8px;
  top: 38%;
  width: 17px;
  height: 56px;
  border-radius: 2px;
  transform: rotate(-1.5deg);
  background: linear-gradient(180deg, #e9a663, #d88a4a);
  box-shadow: 0 2px 7px rgba(74, 52, 25, 0.22);
  clip-path: polygon(0 2%, 100% 0, 100% 98%, 0 100%);
  opacity: 0.92;
}

.tape::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0 1px, transparent 1px 4px);
}

.stand {
  position: relative;
  z-index: 1;
  width: min(300px, 46%);
  height: 18px;
  margin: -5px auto 0;
  background: linear-gradient(180deg, var(--device-2) 0%, transparent 92%);
  clip-path: polygon(9% 0, 91% 0, 100% 100%, 0 100%);
  opacity: 0.8;
  filter: blur(0.2px);
}

/* ── controles ──────────────────────────────── */

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(600px, 100%);
  margin: 0 auto;
}

.controls button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 58px;
  padding: 10px 5px 9px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--button) 82%, transparent);
  box-shadow:
    0 2px 0 color-mix(in srgb, var(--ink) 10%, transparent),
    0 12px 22px -18px rgba(40, 32, 16, 0.55);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: background-color 0.18s ease, transform 0.12s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.controls button svg {
  width: 19px;
  height: 19px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.controls button span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.controls button:hover {
  background: var(--button);
  transform: translateY(-2px);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--ink) 11%, transparent), 0 16px 26px -18px rgba(40, 32, 16, 0.5);
}

.controls button:hover svg { color: var(--accent); transform: scale(1.06) rotate(-2deg); }
.controls button:active { transform: translateY(1px); box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 12%, transparent); }

.footnote {
  margin: -2px 0 0;
  text-align: center;
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0.7;
}

/* ── modales ────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding:
    max(18px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  background: rgba(16, 14, 10, 0.48);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  animation: overlayIn 0.22s ease both;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100svh - 40px);
  overflow-y: auto;
  padding: clamp(24px, 5vw, 36px);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.55);
  animation: modalIn 0.28s cubic-bezier(0.2, 0.75, 0.3, 1) both;
}

.modal:focus,
.modal:focus-visible { outline: none; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.modal-close:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); transform: rotate(8deg); }

.modal-kicker {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.modal h2 {
  margin: 0 0 20px;
  padding-right: 34px;
  font-family: var(--serif);
  font-size: clamp(27px, 5vw, 36px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.modal h2 em {
  font-style: italic;
  color: var(--accent);
}

/* carta */

.letter-modal {
  max-width: 530px;
  padding: clamp(28px, 6vw, 44px) clamp(24px, 6vw, 42px) clamp(24px, 5vw, 36px);
  color: #251f16;
  background:
    radial-gradient(120% 90% at 50% 0%, #fcf7e9 0%, #f8f0de 55%, #f3ead5 100%);
  border-color: rgba(95, 73, 40, 0.2);
  rotate: -0.35deg;
}

.letter-modal .modal-close {
  color: rgba(60, 46, 25, 0.6);
  border-color: rgba(60, 46, 25, 0.2);
}

.letter-modal .modal-close:hover { background: rgba(60, 46, 25, 0.07); color: #2b2318; }

.letter-modal .modal-kicker { color: #b46a3c; }

.letter-modal h2 {
  font-size: clamp(32px, 7vw, 44px);
  color: #2b2318;
}

.letter-modal h2 em { color: #b46a3c; }

.tape-top {
  position: absolute;
  top: -13px;
  left: 50%;
  width: 116px;
  height: 27px;
  transform: translateX(-50%) rotate(-2deg);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, #e9b179, #dfa160);
  box-shadow: 0 2px 7px rgba(80, 52, 20, 0.16);
  clip-path: polygon(2% 0, 98% 3%, 100% 100%, 0 96%);
  opacity: 0.92;
}

.letter-body {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.7;
  color: #3a3124;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.letter-sign {
  margin: 24px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  text-align: right;
  color: #6c4a32;
}

.letter-hearts {
  margin-top: 20px;
  text-align: center;
  color: #c98767;
  font-size: 15px;
  letter-spacing: 0.2em;
}

/* ajustes */

.settings-modal h2 { margin-bottom: 22px; }

#settingsForm {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#settingsForm label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.5;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

#settingsForm input[type="text"],
#settingsForm input[type="date"],
#settingsForm textarea,
#settingsForm select {
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: 0;
  text-transform: none;
  background: color-mix(in srgb, var(--paper) 52%, transparent);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

#settingsForm input[type="text"]:focus,
#settingsForm input[type="date"]:focus,
#settingsForm textarea:focus,
#settingsForm select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}

#settingsForm textarea {
  resize: vertical;
  min-height: 84px;
}

#settingsForm small {
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  opacity: 0.8;
  text-transform: uppercase;
}

.check-label { justify-content: flex-start; }

.check-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 39px;
  padding: 0 11px;
  font-size: 9px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--paper) 52%, transparent);
}

.check-wrap input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
}

.btn {
  min-height: 39px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--button);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn.primary {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 10px 22px -14px color-mix(in srgb, var(--ink) 70%, transparent);
}

.btn.primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--accent)); }

.btn.ghost { background: transparent; }
.btn.full { width: 100%; margin-top: 4px; }

/* instalar */

.install-modal { max-width: 470px; }
.install-lead {
  margin: 0 0 18px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.install-steps {
  counter-reset: install-step;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.install-steps li {
  counter-increment: install-step;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: flex-start;
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.install-steps li > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.install-steps li::before {
  content: counter(install-step);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--button);
}

.install-steps b { color: var(--ink); font-weight: 600; }

.install-note {
  margin: 0 0 18px;
  padding: 10px 12px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 0 6px 6px 0;
}

/* ── ambiente / pantalla completa ───────────── */

body.ambient {
  overflow: hidden;
  background: var(--paper);
}

body.ambient::before,
body.ambient::after { display: none; }

body.ambient .page {
  width: 100%;
  max-width: none;
  min-height: 100svh;
  height: 100svh;
  padding: 0;
  display: block;
}

body.ambient .topbar,
body.ambient .controls,
body.ambient .footnote,
body.ambient .stand,
body.ambient .device-foot,
body.ambient .tape,
body.ambient .screw {
  display: none;
}

body.ambient .tank-wrap {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
}

body.ambient .device {
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--paper);
  box-shadow: none;
}

body.ambient .screen {
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
}

body.ambient .tank-status {
  padding-top: max(9px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  font-size: 9px;
}

.exit-ambient {
  position: fixed;
  z-index: 300;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  height: 32px;
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 72%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.exit-ambient:hover { opacity: 1; }

/* ── utilidades ─────────────────────────────── */

.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;
}

.toast {
  position: fixed;
  z-index: 400;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translate(-50%, 10px);
  max-width: calc(100vw - 32px);
  padding: 9px 14px;
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.5;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-align: center;
  color: var(--bg);
  background: var(--ink);
  border-radius: 999px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── adaptaciones ───────────────────────────── */

@media (max-width: 520px) {
  .page {
    padding-left: 14px;
    padding-right: 14px;
    gap: 12px;
  }

  .brand-sub { display: none; }
  .brand-title { font-size: 12px; }
  .brand-fish { width: 33px; height: 33px; font-size: 8.5px; border-radius: 10px; }

  .device {
    border-radius: 18px;
    padding: 13px 13px 4px;
  }

  .screen { aspect-ratio: 4 / 3; border-radius: 7px; }

  .device-foot { padding: 7px 3px 2px; font-size: 6.5px; }
  .screw { width: 8px; height: 8px; }
  .screw-tl, .screw-tr { top: 6px; }
  .screw-bl, .screw-br { bottom: 6px; }
  .screw-tl, .screw-bl { left: 6px; }
  .screw-tr, .screw-br { right: 6px; }
  .screw::before, .screw::after { width: 4px; }
  .tape { left: -6px; width: 12px; height: 46px; }

  .controls { gap: 6px; }
  .controls button {
    min-height: 54px;
    padding: 9px 3px 8px;
    gap: 5px;
    font-size: 8px;
    letter-spacing: 0.09em;
    border-radius: 12px;
  }
  .controls button svg { width: 17px; height: 17px; }

  .footnote { font-size: 7px; letter-spacing: 0.14em; }
  .tap-hint { font-size: 7px; bottom: 8px; }
  .tank-status { padding: 8px 10px 6px; font-size: 7.5px; }

  .field-row { grid-template-columns: 1fr; }
  .settings-modal { padding: 24px 18px; border-radius: 16px; }
  .letter-modal { rotate: 0deg; }
  .modal { max-height: calc(100svh - 28px); }
  .overlay { padding: 14px; }
}

@media (max-width: 355px) {
  .brand-fish { display: none; }
  .brand-title { font-size: 11.5px; }
  .controls button { font-size: 7.5px; }
  .chip { padding: 0 9px; font-size: 8px; }
}

@media (min-width: 900px) {
  .page { padding-top: 26px; padding-bottom: 26px; }
}

@media (max-height: 690px) and (min-width: 521px) {
  .page { gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .brand-fish { display: none; }
  .device { padding: 13px 13px 4px; }
  .screen { aspect-ratio: 16 / 8.5; }
  .controls button { min-height: 50px; }
  .footnote { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .brand-fish { animation: none; }
  .led { animation: none; opacity: 0.8; }
}
