/* El baño es de los dos — marcador de quejas.
   Base neutra (zinc, sin tinte azul). Dos acentos, uno por persona: el color aca
   significa "de quien es la queja", no es decoracion. Radios: 6 / 10 / 14. */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/jetbrains-mono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --line: #e3e3e3;
  --line-soft: #ededed;
  --ink: #121213;
  --ink-2: #6a6a70;
  --ink-3: #9b9ba1;
  --a: #00776a;
  --b: #b1450e;
  --a-wash: #00776a1a;
  --b-wash: #b1450e1a;
  --live: #1a8f4a;

  --r-xs: 6px;
  --r-s: 10px;
  --r: 14px;
  --shadow: 0 1px 2px #12121308, 0 8px 24px #1212130a;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0d;
    --surface: #161618;
    --line: #26262a;
    --line-soft: #1e1e21;
    --ink: #f3f3f4;
    --ink-2: #97979e;
    --ink-3: #6c6c74;
    --a: #34e0c1;
    --b: #ffa03d;
    --a-wash: #34e0c11f;
    --b-wash: #ffa03d1f;
    --live: #3ddc84;
    --shadow: 0 1px 2px #00000040, 0 8px 24px #00000038;
  }
}

* { box-sizing: border-box; }

/* Varias clases setean display, asi que [hidden] necesita ganar siempre. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }

.shell {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
}

/* ---------- barra superior ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 2px;
}
.bar__title { font-size: 1.0625rem; }
.bar__live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--live);
  flex: none;
}
.bar__live[data-state="cargando"] .dot { background: var(--ink-3); }
.bar__live[data-state="error"] .dot { background: var(--b); }
@media (prefers-reduced-motion: no-preference) {
  .bar__live[data-state="vivo"] .dot { animation: latido 2.4s var(--ease) infinite; }
}
@keyframes latido {
  0%, 70%, 100% { opacity: 1; }
  85% { opacity: 0.35; }
}

/* ---------- veredicto ---------- */
.verdict {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px 20px;
  box-shadow: var(--shadow);
}
.verdict__line {
  font-size: clamp(1.5rem, 7.2vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  text-wrap: balance;
}
.verdict__line b { color: var(--v, var(--ink)); font-weight: 700; }
.verdict__sub {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 0.875rem;
}

/* ---------- marcador ---------- */
.score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 14px 18px;
  box-shadow: var(--shadow);
}
.player { text-align: center; min-width: 0; }
.player[data-side="a"] { --c: var(--a); --c-wash: var(--a-wash); }
.player[data-side="b"] { --c: var(--b); --c-wash: var(--b-wash); }

.player__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c-wash);
  color: var(--c);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--c);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
}
.player__name {
  font-size: 0.9375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.player__n {
  margin-top: 6px;
  font-size: clamp(3.5rem, 20vw, 5rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  color: var(--c);
}
.player__unit {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  color: var(--ink-3);
  margin-top: 2px;
}
.player__top {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--ink-2);
  min-height: 1.2em;
}
.player.gano .player__n { text-shadow: 0 0 0 currentColor; }

@media (prefers-reduced-motion: no-preference) {
  .player.subio .player__n { animation: subio 0.65s var(--ease); }
}
@keyframes subio {
  0%   { transform: scale(1); }
  32%  { transform: scale(1.14); }
  100% { transform: scale(1); }
}

.score__vs {
  align-self: center;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  color: var(--ink-3);
  padding-top: 34px;
}

/* ---------- reparto ---------- */
.share { padding: 0 2px; }
.share__track {
  display: flex;
  height: 8px;
  border-radius: var(--r-xs);
  overflow: hidden;
  background: var(--line-soft);
}
.share__seg { display: block; transition: flex-basis 0.7s var(--ease); flex: 0 0 50%; }
.share__seg[data-side="a"] { background: var(--a); }
.share__seg[data-side="b"] { background: var(--b); }
.share__legend {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  color: var(--ink-2);
}
.share__legend span:first-child { color: var(--a); }
.share__legend span:last-child { color: var(--b); }

/* ---------- paneles ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 16px 18px;
  box-shadow: var(--shadow);
}
.panel__title {
  font-size: 0.8125rem;
  color: var(--ink-2);
  font-weight: 500;
  letter-spacing: 0;
  margin-bottom: 14px;
}

/* ---------- grafico de 14 dias ---------- */
.chart {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  align-items: end;
  gap: 4px;
  height: 76px;
}
.col {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  gap: 2px;
  height: 100%;
  width: min(100%, 16px);
  justify-self: center;
  border-radius: var(--r-xs);
  position: relative;
}
.col::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  border-radius: var(--r-xs);
  background: var(--line);
}
.col span {
  display: block;
  border-radius: var(--r-xs);
  min-height: 3px;
  position: relative;
  z-index: 1;
}
.col span[data-side="a"] { background: var(--a); }
.col span[data-side="b"] { background: var(--b); }
.col[data-hoy]::after { background: var(--ink-3); }
.chart__empty { font-size: 0.8125rem; color: var(--ink-3); margin-top: 12px; }

/* ---------- feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}
.feed .item:first-child { border-top: 0; }
.item[data-side="a"] { --c: var(--a); --c-wash: var(--a-wash); }
.item[data-side="b"] { --c: var(--b); --c-wash: var(--b-wash); }
.item__body { min-width: 0; }
.item__meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.item__who { font-size: 0.875rem; font-weight: 700; }
.item__when {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  color: var(--ink-3);
}
.item__text {
  margin-top: 3px;
  font-size: 0.9375rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.item__text--muted { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.item__text--muted svg { width: 15px; height: 15px; flex: none; }
.chip {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: var(--r-s);
  background: var(--c-wash);
  color: var(--c);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
}
.thumb {
  display: block;
  margin-top: 9px;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--line-soft);
  cursor: zoom-in;
  padding: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .item.nuevo { animation: entra 0.5s var(--ease); }
}
@keyframes entra {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- estados ---------- */
.state {
  text-align: center;
  padding: 32px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.state--inline { border: 0; background: none; padding: 18px 8px 8px; }
.state__icon { width: 26px; height: 26px; color: var(--ink-3); }
.state__title { margin-top: 10px; font-weight: 700; }
.state__body { margin-top: 5px; color: var(--ink-2); font-size: 0.875rem; max-width: 34ch; margin-inline: auto; }

.btn {
  margin-top: 16px;
  font: inherit;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--r-s);
  background: var(--ink);
  color: var(--surface);
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------- skeleton ---------- */
.skeleton { display: grid; gap: 14px; }
.sk { background: var(--line-soft); border-radius: var(--r); }
.sk--verdict { height: 108px; }
.sk--score { height: 210px; }
.sk--bar { height: 8px; border-radius: var(--r-xs); }
.sk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (prefers-reduced-motion: no-preference) {
  .sk { animation: latir 1.4s ease-in-out infinite; }
}
@keyframes latir { 50% { opacity: 0.5; } }

/* ---------- pie ---------- */
.foot {
  color: var(--ink-3);
  font-size: 0.75rem;
  text-align: center;
  padding: 4px 8px 0;
  display: grid;
  gap: 4px;
}
.foot__meta { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.6875rem; }

/* ---------- lightbox ---------- */
.lightbox {
  border: 0;
  padding: 0;
  background: none;
  max-width: min(92vw, 560px);
  max-height: 92dvh;
}
.lightbox::backdrop { background: #000000d6; }
.lightbox img { display: block; width: 100%; height: auto; border-radius: var(--r); }
.lightbox__close {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  margin: 0 0 10px auto;
  display: block;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--r-s);
  background: #ffffff;
  color: #121213;
  cursor: pointer;
}

/* ---------- escritorio: dos columnas ---------- */
@media (min-width: 900px) {
  .shell {
    max-width: 1000px;
    grid-template-columns: 1fr 1fr;
    align-content: start;
    gap: 16px;
    padding: 28px 24px 40px;
  }
  .bar, .foot { grid-column: 1 / -1; }
  #app { display: contents; }
  #content { display: contents; }
  .verdict, .score, .share, .panel:not(.panel--feed) { grid-column: 1; }
  .panel--feed { grid-column: 2; grid-row: 2 / span 4; align-self: start; }
  .skeleton, .state:not(.state--inline) { grid-column: 1 / -1; }
  .verdict__line { font-size: 2.125rem; }
  .player__n { font-size: 4.5rem; }
}
