/* Estilos propios del Otakumeter. Lo compartido (barra de arriba, botones, tarjetas) está en /assets/base.css. */

.topbar-spacer { width: 44px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.center { text-align: center; }

/* ---------- inicio ---------- */
.intro { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.intro h1 { font-family: var(--font-title); font-weight: 800; font-size: 34px; line-height: 1.05; margin: 0; }
.intro p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.5; }

.block { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text); font-weight: 600; font-size: 14px;
}
.chip-btn:hover { border-color: var(--muted); }
.chip-btn[aria-pressed='true'] { border-color: transparent; background: var(--accent); color: var(--bg); }
.text-input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text); font-family: inherit; font-size: 15px;
}
.text-input:focus { outline: none; border-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.hint.error { color: var(--bad); }
.sub { font-size: 12px; font-weight: 600; color: var(--text-2); margin-top: 4px; }

.games-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.games-score { font-family: var(--font-title); font-weight: 800; font-size: 34px; line-height: 1; }
.games-score small { font-size: 14px; color: var(--muted); font-weight: 600; }
.progress { height: 8px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.game-rows { display: flex; flex-direction: column; gap: 6px; }
.game-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.game-row b { color: var(--text); }

/* ---------- índice ---------- */
.hero { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 14px; }
.who { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--text-2); }
.who img { width: 28px; height: 28px; border-radius: 999px; object-fit: cover; background: var(--chip); }
.ring-wrap { position: relative; width: 170px; height: 170px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-bg { stroke: var(--chip); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.9s ease-out; }
.ring-text { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 52px; }
.ring-text .big { font-family: var(--font-title); font-weight: 800; font-size: 56px; line-height: 1; }
.ring-text .of { font-size: 15px; color: var(--muted); font-weight: 600; }
.rank { font-family: var(--font-title); font-weight: 800; font-size: 22px; color: var(--accent); text-align: center; }

/* ---------- barras ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; flex-direction: column; gap: 4px; }
.bar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.bar-top .name { font-weight: 600; }
.bar-top .name small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.bar-top .val { font-family: var(--font-title); font-weight: 800; font-size: 16px; }
.bar { height: 8px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.bar.soft > span { background: var(--ok); }
.bar-note { font-size: 11px; color: var(--muted); }

/* ---------- números ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile {
  background: var(--surface-2); border-radius: 10px; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; text-align: center;
}
.tile b { font-family: var(--font-title); font-weight: 800; font-size: 20px; line-height: 1.1; }
.tile span { font-size: 11px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 5px 10px; border-radius: 999px; background: var(--chip); color: var(--text-2); }
.chip b { color: var(--text); margin-left: 4px; }

/* ---------- décadas ---------- */
.decades { display: flex; align-items: flex-end; gap: 6px; height: 130px; }
.decade { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 0; }
.decade .col { width: 100%; border-radius: 6px 6px 2px 2px; background: var(--chip); min-height: 3px; }
.decade.best .col { background: var(--accent); }
.decade .n { font-size: 11px; color: var(--text-2); }
.decade .y { font-size: 10px; color: var(--muted); white-space: nowrap; }

/* ---------- opiniones ---------- */
.takes-group { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.take { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; background: var(--surface-2); }
.take img, .take .noimg { width: 36px; height: 52px; border-radius: 4px; object-fit: cover; background: var(--chip); flex: none; }
.take .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.take .t b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.take .t span { font-size: 12px; color: var(--muted); }
.take .d { font-family: var(--font-title); font-weight: 800; font-size: 16px; }
.take .d.down { color: var(--bad); }
.take .d.up { color: var(--ok); }

/* ---------- lista vs juegos: un renglón debajo del índice (2/11/2026; antes era una tarjeta) ---------- */
.versus-line { margin: 0; font-size: 13px; line-height: 1.4; color: var(--text-2); text-align: center; }
.versus-line b { color: var(--text); font-family: var(--font-title); font-weight: 800; }
.versus-line:empty { display: none; }

/* ---------- subir lista ---------- */
.upload summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.upload summary::-webkit-details-marker { display: none; }
.upload summary .label::after { content: ' ▾'; }
.upload[open] summary .label::after { content: ' ▴'; }
.upload-body { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.file-btn { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn .btn { display: inline-flex; align-items: center; padding: 0 14px; height: 40px; pointer-events: none; }
.file-btn:focus-within .btn { border-color: var(--accent); }

/* ---------- perfiles ---------- */
.profiles { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.profiles[hidden] { display: none; }
.profile { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); text-align: center; }
.profile b { font-size: 14px; }
.profile span { font-size: 12px; color: var(--muted); }
.profile:first-child { border: 1px solid var(--accent); }

/* Lista vinculada */
.linked { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.linked span { flex: 1; }
.linked[hidden] { display: none; }
/* Unlink: pastilla con borde e ícono (Juan Cruz, 28/10/2026: "más grande o más vistoso"). */
.link-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--link); background: rgba(255, 90, 54, 0.1); color: var(--link);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.link-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.link-btn svg { flex: none; }

/* ---------- próximo nivel, joya escondida, botones (2/11/2026) ---------- */
.next-level { margin: -2px 0 2px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 90, 54, 0.08); border: 1px dashed rgba(255, 90, 54, 0.45); font-size: 13px; line-height: 1.4; color: var(--text-2); text-align: center; width: 100%; }
.next-level b { color: var(--text); }
.next-level:empty { display: none; }
#gem-card[hidden] { display: none; }
.gem { display: flex; align-items: center; gap: 12px; }
.gem img, .gem .noimg { width: 56px; height: 80px; border-radius: 6px; object-fit: cover; background: var(--chip); flex: none; }
.gem .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gem .t b { font-size: 15px; line-height: 1.25; }
.gem .t span { font-size: 12px; color: var(--muted); }
.share-row { display: flex; flex-direction: column; gap: 8px; }
#card-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.bar-top .name { display: inline-flex; align-items: center; }

/* Tarjeta para compartir (share-card.js) */
.share-card-modal .modal { max-width: 420px; gap: 12px; }
.sc-chips { display: flex; gap: 8px; }
.sc-preview { display: flex; justify-content: center; }
.sc-preview canvas { width: auto; height: auto; max-width: 100%; max-height: calc((100dvh - 250px) / var(--zoom, 1)); aspect-ratio: 4 / 5; border-radius: 12px; border: 1px solid var(--border); }
.sc-preview.tall canvas { aspect-ratio: 9 / 16; }

/* ---------- pantallas anchas ----------
   En el celu los contenedores no existen (display: contents) y todo va en una columna en este orden: índice,
   tarjetas (o1…o6) y al final Unlink + botones. Desde 1000 px: inicio en dos columnas (lista | juegos); resultado en
   UNA pantalla (2/11/2026, Juan Cruz: "que se lea y se entienda", con los laterales de publicidad): índice + botones a
   la izquierda (296 px) y las tarjetas en tres columnas (Breakdown | DNA + números | décadas + opiniones). Con los
   laterales el contenido tiene ~1000 px de ancho (1366 a zoom 1, 1920 a zoom 1,25; fit.js elige el zoom y no baja de 1
   por data-fit-min). Nada de letra de menos de 12 px. */
.res-side, .res-cards, .res-actions, .res-col, .start-cols, .start-main { display: contents; }
.res-cards .o1 { order: 1; } .res-cards .o2 { order: 2; } .res-cards .o3 { order: 3; } .res-cards .o4 { order: 4; }
.res-cards .o5 { order: 5; } .res-cards .o6 { order: 6; }
.res-actions > * { order: 20; }
@media (min-width: 1000px) {
  .app:has(> #screen-result:not([hidden])) { max-width: 1120px; }
  .app:has(> #screen-start:not([hidden])) { max-width: 900px; }
  .start-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
  .start-main { display: flex; flex-direction: column; gap: 14px; }
  #screen-result:not([hidden]) { display: grid; grid-template-columns: 316px minmax(0, 1fr); gap: 10px; align-items: start; }
  .res-side, .res-actions, .res-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
  .res-actions > *, .res-cards .card { order: 0; }
  .res-actions .share-row { order: -1; } /* en la compu, compartir antes que Unlink */
  .res-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
  #screen-result .label { font-size: 12px; }
  /* Índice compacto en la columna. */
  .hero { gap: 5px; padding: 12px 10px; }
  .who { font-size: 13px; }
  .who img { width: 24px; height: 24px; }
  .ring-wrap { width: 100px; height: 100px; }
  .ring-text { padding-top: 30px; }
  .ring-text .big { font-size: 34px; }
  .ring-text .of { font-size: 13px; }
  .rank { font-size: 18px; line-height: 1.15; }
  .next-level { margin: 0; padding: 5px 8px; font-size: 12px; line-height: 1.35; }
  .profiles { gap: 4px; }
  .profile { padding: 4px 8px; }
  .profile b { font-size: 13px; }
  .profile span { font-size: 12px; line-height: 1.3; }
  .versus-line { font-size: 12px; }
  .share-row { gap: 6px; }
  .share-row .btn-lg { height: 40px; font-size: 14px; padding: 0 8px; white-space: nowrap; }
  .share-row .two .btn-lg { height: 34px; font-size: 13px; }
  .linked { gap: 8px; padding: 6px 8px 6px 10px; font-size: 12px; line-height: 1.3; }
  .linked .link-btn { height: 32px; padding: 0 10px; font-size: 13px; }
  /* Tarjetas compactas. */
  .res-cards .block { gap: 6px; padding: 10px 11px; }
  .res-cards .bars { gap: 6px; }
  .bar-row { gap: 3px; }
  .bar-top { font-size: 13px; }
  .bar-top .val { font-size: 15px; }
  .bar { height: 6px; }
  .bar-note { font-size: 12px; line-height: 1.25; }
  .sub { margin-top: 2px; }
  .chip { padding: 3px 8px; }
  .take { padding: 3px; gap: 8px; }
  .take img, .take .noimg { width: 26px; height: 36px; }
  .take .d { font-size: 14px; }
  .takes-group { gap: 4px; margin-top: 2px; }
  .decades { height: 84px; gap: 4px; }
  .decade .n, .decade .y { font-size: 12px; }
  .tiles { gap: 6px; }
  .tile { padding: 6px 4px; }
  .tile b { font-size: 16px; }
  .tile span { font-size: 12px; line-height: 1.2; }
}
/* Columnas parejas SIN estirar filas (2/11/2026, noche; Juan Cruz: "las filas se separaron para llenar el alto y quedó
   feo"): cada tarjeta con su espaciado natural. Las columnas terminan a la misma altura porque la última tarjeta de cada
   una se estira hasta el fondo (con su contenido arriba) y balance() de otakumeter.js llena con contenido: 6–8 géneros
   en el DNA y 2–3 opiniones por grupo. El gráfico de décadas sí crece (más alto = barras más altas). */
@media (min-width: 1000px) {
  #screen-result:not([hidden]) { align-items: stretch; }
  .res-cards { align-items: stretch; }
  .res-col > .card:last-child { flex: 1; }
  /* Décadas + opiniones: lo que sobra lo toma el gráfico de décadas, no la tarjeta de opiniones. */
  .res-col > .o4 { flex: 1; }
  .res-col:has(> .o4) > .o6 { flex: none; }
  .decades { flex: 1; min-height: 84px; }
  .res-side .hero { flex: 1; }
  .linked .link-btn { height: 26px; padding: 0 9px; font-size: 12px; }
  .linked { padding: 4px 6px 4px 10px; }
  /* Para medir el alto natural (balance()): nada estirado. */
  #screen-result.measuring, #screen-result.measuring .res-cards { align-items: start !important; }
  #screen-result.measuring .res-col > .card, #screen-result.measuring .res-side .hero { flex: none !important; }
  #screen-result.measuring .decades { flex: none; height: 84px; }
}
.bar-row[hidden] { display: none; }

/* ---------- Mochi con el medidor y su globito (2/11/2026) ----------
   Arriba del índice: Mochi a la izquierda (pose del medidor, flotando) y el globito a la derecha, con la colita hacia
   ella (estilo de /assets/mochi.css). Lo que dice: un guiño secreto por anime o una frase del nivel. */
.meter-mochi { display: flex; align-items: center; gap: 14px; width: 100%; padding: 0 2px 2px; }
.meter-mochi[hidden] { display: none; }
.mm-img { flex: none; height: 118px; width: auto; animation: mochi-float 3.4s ease-in-out infinite; user-select: none; -webkit-user-drag: none; }
.mm-bubble { flex: 1; min-width: 0; max-width: none; font-size: 14px; line-height: 1.3; padding: 8px 12px 9px; rotate: -1.5deg; }
/* "next ›": pastillita colgada del borde de abajo del globito (no suma alto). */
.mm-bubble:has(.mm-next:not([hidden])) { margin-bottom: 8px; }
.mm-next {
  position: absolute; right: 10px; bottom: -11px; padding: 2px 9px; border-radius: 999px; cursor: pointer;
  border: 2px solid #0E1116; background: var(--accent); color: #0E1116; rotate: 1.5deg;
  font: 700 12px/1.2 var(--font-title, inherit);
}
.mm-next:hover { background: #fff; }
.mm-next[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .mm-img { animation: none; } }

/* ---------- escalera de niveles ---------- */
.ladder { width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 2px 2px 0; }
.ladder-track { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; height: 8px; }
.ladder-track .seg { border-radius: 999px; background: var(--chip); }
.ladder-track .seg.past { background: rgba(255, 90, 54, 0.45); }
.ladder-track .seg.now { background: var(--accent); }
.ladder-dot {
  position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 999px;
  background: var(--text); border: 3px solid var(--accent); box-shadow: 0 0 0 2px var(--surface);
}
.ladder-labels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.ladder-labels span { font-size: 12px; line-height: 1.2; color: var(--muted); text-align: center; white-space: nowrap; letter-spacing: -0.2px; }
.ladder-labels span.now { color: var(--accent); font-weight: 700; }

/* Compu: el índice en una grilla para no sumar alto. Arriba Mochi + globito; después el anillo a la izquierda con
   nombre, nivel y percentil al lado; abajo, a lo ancho, la escalera, Next level, perfiles y lista vs juegos. */
@media (min-width: 1000px) {
  .res-side .hero {
    display: grid; grid-template-columns: 100px minmax(0, 1fr); column-gap: 12px; row-gap: 5px; align-items: center; align-content: start;
    grid-template-areas: 'mochi mochi' 'ring who' 'ring rank' 'ring pct' 'ladder ladder' 'next next' 'prof prof' 'vs vs' 'note note';
    grid-template-rows: auto auto auto auto;
  }
  .hero .meter-mochi { grid-area: mochi; }
  .hero .ring-wrap { grid-area: ring; align-self: center; }
  .hero .who { grid-area: who; align-self: end; }
  .hero .rank { grid-area: rank; text-align: left; }
  .hero #index-pct { grid-area: pct; text-align: left; align-self: start; }
  .hero .ladder { grid-area: ladder; }
  .hero .next-level { grid-area: next; }
  .hero .profiles { grid-area: prof; }
  .hero .versus-line { grid-area: vs; }
  .hero #list-note { grid-area: note; }
  .meter-mochi { gap: 8px; padding: 0; }
  .mm-img { height: 76px; margin-left: -6px; }
  .mm-bubble { font-size: 13px; line-height: 1.25; padding: 6px 10px 7px; }
  .mm-bubble::before { left: -18px; width: 20px; height: 17px; }
  .mm-bubble::after { left: -12px; width: 15px; height: 10px; }
  
}
@media (min-width: 1600px) and (min-height: 1040px) {
  .decades { height: 110px; }
  .bar-top .val { font-size: 17px; }
}
/* iPhone (2/11/2026): 16 px en el celu, si no Safari hace zoom al tocar el cuadro (ver base.css). */
@media (max-width: 1039px), (hover: none) { .text-input { font-size: 16px; } }

/* Botones del resultado: en la compu los tres en una fila (Share card · Copy text · Other list), así la columna del
   índice entra en 1366×768 también con la lista vinculada (2/11/2026, noche). En el celu, como antes. */
.share-row .short { display: none; }
@media (min-width: 1000px) {
  .share-row { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 6px; }
  .share-row .two { display: contents; }
  .share-row .long { display: none; }
  .share-row .short { display: inline; }
  .share-row .btn-lg, .share-row .two .btn-lg { height: 38px; font-size: 13px; padding: 0 6px; }
  #card-btn { gap: 6px; }
  #card-btn svg { width: 16px; height: 16px; }
}
