/* El Enamoramómetro — blanco, rosa, rojo y una flor que se abre. */
:root {
  --bg: #FFFFFF;
  --blush: #FFF4F6;
  --blush-2: #FFE9EE;
  --rose: #F7C1CE;
  --petal: #F9AFC1;
  --red: #E0304C;
  --red-deep: #B8213A;
  --ink: #2A1A1F;
  --muted: #8C6E77;
  --line: #F3DDE3;
  --leaf: #2F9E6B;
  --gold: #F4B942;
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --body: 'Nunito', system-ui, -apple-system, sans-serif;
  --mono: 'DM Mono', ui-monospace, 'Cascadia Mono', monospace;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(224, 48, 76, .08), 0 1px 2px rgba(42, 26, 31, .06);
}

* { box-sizing: border-box; min-width: 0; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  padding-inline: clamp(16px, 3vw, 40px);
  padding-block: 0 40px;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
button, input, textarea { font: inherit; color: inherit; }
svg use { pointer-events: none; }

/* Flor compartida */
.petals { fill: var(--petal); transform-origin: 50px 50px; transform-box: view-box; }
.core { fill: var(--red); }

/* Cabecera */
.masthead { max-width: 1240px; margin-inline: auto; padding-block: clamp(24px, 4vw, 48px) clamp(16px, 3vw, 28px); }
.masthead h1 {
  display: flex; align-items: center; gap: .3em;
  font-family: var(--display); font-weight: 600; font-variation-settings: 'SOFT' 50;
  font-size: clamp(2rem, 5.6vw, 4rem); line-height: 1; letter-spacing: -.015em; margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.flower-mark { width: .9em; height: .9em; flex: none; }
.tagline { margin: 0; max-width: 58ch; color: var(--muted); font-size: 1.05rem; }

/* Tablero */
.board { max-width: 1240px; margin-inline: auto; display: grid; grid-template-columns: 200px minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Termómetro que florece */
.thermo { position: sticky; top: 16px; padding: 18px 14px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--blush); }
.read { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: baseline; justify-content: center; text-align: center; }
.num { font-family: var(--display); font-weight: 600; font-size: 3rem; line-height: 1; letter-spacing: -.03em; color: var(--red); }
.delta { font-family: var(--mono); font-size: .8rem; }
.delta.up { color: var(--leaf); }
.delta.down { color: var(--red); }
.delta.same { color: var(--muted); }
.delta.pop { animation: pop .5s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.read-label { grid-column: 1 / -1; font-size: .85rem; color: var(--muted); }

.tube-wrap { position: relative; width: 100%; height: 470px; }
.bloom {
  position: absolute; right: 8px; top: 0; width: 60px; height: 60px; z-index: 2;
  transform: translate(50%, -10%);
}
.thermo .petals { transform: scale(calc(.35 + .65 * var(--pct) / 100)); transition: transform .9s cubic-bezier(.34, 1.4, .64, 1); }
.tube {
  position: absolute; right: 24px; top: 34px; bottom: 54px; width: 28px;
  border-radius: 14px 14px 0 0; background: #fff; border: 2px solid var(--rose); border-bottom: 0;
  box-shadow: inset 3px 0 5px rgba(255, 255, 255, .9), inset -3px 0 6px rgba(224, 48, 76, .08);
  overflow: hidden;
}
.mercury {
  position: absolute; left: 0; right: 0; bottom: -4px;
  height: calc(var(--pct) * 1% + 4px);
  background: linear-gradient(180deg, #FF8AA0, var(--red) 45%);
  transition: height .9s cubic-bezier(.34, 1.4, .64, 1);
}
.bulb {
  position: absolute; right: 12px; bottom: 0; width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FF8AA0, var(--red) 55%, var(--red-deep));
  box-shadow: 0 6px 16px rgba(224, 48, 76, .3);
}
.scale { list-style: none; margin: 0; padding: 0; position: absolute; left: 0; top: 34px; bottom: 54px; right: 60px; }
.scale li {
  position: absolute; right: 0; bottom: calc(var(--at) * 1%); transform: translateY(50%);
  font-family: var(--mono); font-size: .62rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap; padding-right: 12px; transition: color .3s;
}
.scale li::after { content: ''; position: absolute; right: 0; top: 50%; width: 8px; border-top: 1px solid var(--rose); }
.scale li.on { color: var(--red); font-weight: 500; }
.scale li.on::after { border-color: var(--red); }

/* Chat */
.chat { display: flex; flex-direction: column; overflow: hidden; }
.chat-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.names { display: flex; align-items: center; gap: 8px; }
.names label { display: flex; align-items: baseline; gap: 5px; color: var(--muted); font-size: .8rem; }
.names input { width: 8ch; background: transparent; border: 0; border-bottom: 1.5px solid var(--rose); padding: 1px 2px; color: var(--ink); font-weight: 700; }
.names input:focus { border-color: var(--red); outline: 0; }
.names .amp { font-family: var(--display); color: var(--red); font-size: 1.2rem; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

button {
  cursor: pointer; border: 0; border-radius: 999px; padding: 8px 14px;
  background: var(--red); color: #fff; font-weight: 700; font-size: .88rem;
  transition: transform .12s, background .2s, border-color .2s;
}
button:hover { background: var(--red-deep); transform: translateY(-1px); }
button:disabled { opacity: .5; cursor: default; transform: none; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
button.ghost:hover { background: var(--blush); border-color: var(--rose); }

.log {
  list-style: none; margin: 0; padding: 16px; overflow-y: auto;
  min-height: 240px; max-height: 44vh; display: flex; flex-direction: column;
  background: var(--blush) radial-gradient(var(--rose) .8px, transparent .8px) 0 0 / 20px 20px;
}
.log .empty { margin: auto; text-align: center; max-width: 40ch; color: var(--muted); }
.empty-flower { width: 48px; height: 48px; margin-bottom: 4px; }
.log .empty strong { color: var(--ink); font-family: var(--display); font-weight: 600; font-size: 1.35rem; }
.log .empty p { margin: 4px 0; }
.log .day { align-self: center; margin: 12px 0 6px; font-family: var(--mono); font-size: .66rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; }
.msg {
  max-width: min(80%, 520px); padding: 8px 12px; margin: 3px 0; border-radius: 16px;
  font-size: .95rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere;
  animation: slide .25s ease-out;
}
@keyframes slide { from { transform: translateY(6px); opacity: 0; } }
.msg.me { align-self: flex-end; background: var(--blush-2); border: 1px solid var(--rose); border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg time { float: right; margin: 6px 0 0 10px; font-family: var(--mono); font-size: .62rem; color: var(--muted); }

/* Dos móviles */
.phones { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.phone { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.phone.me { border-color: var(--rose); }
.phone-top { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px; }
.phone-top .who { font-weight: 700; font-size: .95rem; }
.phone-top .status { font-size: .72rem; color: var(--muted); font-style: italic; }
.phone.them .status { color: var(--leaf); }
.phone textarea {
  width: 100%; resize: none; min-height: 42px; max-height: 120px; border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 12px; background: var(--blush); color: var(--ink);
}
.phone textarea:focus { border-color: var(--rose); outline: 0; background: #fff; }
.phone textarea::placeholder { color: #B79AA3; }
.phone-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips span {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-family: var(--mono); font-size: .66rem;
  color: var(--muted); border: 1px solid var(--line); cursor: pointer; transition: all .15s; white-space: nowrap;
}
.chips label:hover span { border-color: var(--rose); }
.chips input:checked + span { background: var(--red); color: #fff; border-color: var(--red); }
.chips input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 1px; }
.send { padding: 6px 14px; font-size: .82rem; flex: none; }

/* Veredicto */
.verdict { position: sticky; top: 16px; padding: 20px 22px 18px; }
.eyebrow { margin: 0 0 6px; font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.engine { font-size: .6rem; letter-spacing: .08em; padding: 2px 8px; border: 1px dashed var(--rose); border-radius: 999px; }
.engine.openai { border-style: solid; color: var(--leaf); border-color: var(--leaf); }
.verdict h2 { font-family: var(--display); font-weight: 600; font-variation-settings: 'SOFT' 50; font-size: 2rem; line-height: 1.05; margin: 0 0 6px; letter-spacing: -.01em; }
.verdict-text { margin: 0 0 14px; font-style: italic; color: var(--muted); }
.list h3 { margin: 12px 0 4px; font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.list h3::before { content: ''; width: 8px; height: 8px; border-radius: 50%; }
.list.up h3 { color: var(--leaf); }
.list.up h3::before { background: var(--leaf); }
.list.down h3 { color: var(--red); }
.list.down h3::before { background: var(--red); }
.list ul { list-style: none; margin: 0; padding: 0; }
.list li { position: relative; padding: 3px 0 3px 18px; font-size: .92rem; line-height: 1.4; }
.list li::before { position: absolute; left: 0; top: 5px; font-size: .65rem; }
.list.up li::before { content: '▲'; color: var(--leaf); }
.list.down li::before { content: '▼'; color: var(--red); }
.list li.none { color: var(--muted); padding-left: 0; }
.list li.none::before { content: none; }
.tip { margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--blush); font-size: .88rem; }
.tip:empty { display: none; }

.foot { max-width: 1240px; margin: 32px auto 0; color: var(--muted); font-size: .82rem; }
.foot p { margin: 4px 0; }

/* Importar */
dialog.import { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: #fff; color: var(--ink); width: min(540px, 92vw); box-shadow: 0 24px 80px rgba(42, 26, 31, .25); }
dialog.import::backdrop { background: rgba(42, 26, 31, .45); backdrop-filter: blur(3px); }
dialog.import form { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
dialog.import h2 { font-family: var(--display); font-weight: 600; font-size: 1.7rem; margin: 0; }
.how { margin: 0; color: var(--muted); font-size: .88rem; }
.filebox { display: block; text-align: center; padding: 20px 14px; border: 1.5px dashed var(--rose); border-radius: 14px; color: var(--muted); cursor: pointer; transition: all .15s; background: var(--blush); }
.filebox:hover, .filebox.over { border-color: var(--red); color: var(--ink); background: var(--blush-2); }
.filebox input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.filebox.has { border-style: solid; color: var(--ink); }
.or { margin: 0; text-align: center; font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
dialog.import textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 10px; color: var(--ink); resize: vertical; font-family: var(--mono); font-size: .78rem; }
.who-step p { margin: 0 0 8px; }
.who-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.who-buttons button.on { background: var(--red); color: #fff; border-color: var(--red); }
.err { margin: 0; color: var(--red); font-size: .88rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Móvil y tablet */
@media (max-width: 980px) {
  .board { grid-template-columns: 1fr; gap: 14px; }
  .thermo {
    position: sticky; top: 8px; z-index: 3; padding: 10px 14px;
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 12px;
  }
  .read { grid-template-columns: auto auto; justify-content: start; text-align: left; column-gap: 6px; }
  .num { font-size: 2rem; }
  .read-label { font-size: .78rem; }
  .tube-wrap { height: 22px; }
  .tube { right: 0; left: 0; top: 0; bottom: 0; width: auto; height: 22px; border-radius: 11px; border: 2px solid var(--rose); background: #fff; }
  .mercury { bottom: 0; top: 0; left: -4px; right: auto; height: auto; width: calc(var(--pct) * 1% + 4px); background: linear-gradient(90deg, var(--red), #FF8AA0); transition: width .9s cubic-bezier(.34, 1.4, .64, 1); border-radius: 0 9px 9px 0; }
  .bulb, .scale { display: none; }
  .bloom { position: static; width: 40px; height: 40px; transform: none; grid-column: 3; }
  .verdict { position: static; }
  .log { max-height: 46vh; min-height: 200px; }
  .chat-bar { padding: 10px 12px; }
  .actions button { padding: 7px 11px; font-size: .82rem; }
  .masthead h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); }
}
@media (max-width: 600px) {
  .phones { grid-template-columns: 1fr; padding: 10px 12px 12px; gap: 10px; }
  .log { padding: 12px; }
  .msg { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
