:root {
  --bg: #0f1115;
  --bg2: #161a21;
  --panel: #1b2029;
  --line: #2a313d;
  --text: #e8ebf0;
  --muted: #8b95a5;
  --accent: #66c0f4;
  --accent-ink: #08131b;
  --ok: #4fd08a;
  --run: #f2c14e;
  --todo: #8aa4ff;
  --drop: #e46a6a;
  --want: #ff8bd1;
  --wait: #4fd1e0;
  --radius: 10px;
  --tile: 92px;
  font-family: Inter, system-ui, "Segoe UI", sans-serif;
  color-scheme: dark;
}
body[data-sec="juegos"] { --accent: #66c0f4; }
body[data-sec="animes"] { --accent: #ff9a5c; }
body[data-sec="pelis"]  { --accent: #f5c518; }
body[data-sec="libros"] { --accent: #40d0a8; }
body[data-sec="series"] { --accent: #e57373; }
body[data-sec="gustos"] { --accent: #ff7f9f; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 500px at 85% -200px, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}
button, input, select, textarea { font: inherit; color: inherit; }
h2 { font-family: "Bricolage Grotesque", Inter, sans-serif; margin: 0 0 10px; font-size: 22px; }
code { background: var(--bg2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- cabecera */
.top {
  display: flex; align-items: center; gap: 28px;
  padding: 14px 24px 0;
  flex-wrap: wrap;
}
.brand {
  font-family: "Bricolage Grotesque", Inter, sans-serif;
  font-weight: 800; font-size: 26px; letter-spacing: -0.02em;
}
.sections { display: flex; gap: 4px; flex-wrap: wrap; }
.sections button {
  background: none; border: 0; cursor: pointer;
  padding: 10px 14px 12px; color: var(--muted);
  font-family: "Bricolage Grotesque", Inter, sans-serif; font-weight: 700; font-size: 17px;
  border-bottom: 3px solid transparent;
}
.sections button .n { font-family: Inter, sans-serif; font-weight: 500; font-size: 12px; margin-left: 6px; opacity: .7; }
.sections button:hover { color: var(--text); }
.sections button.active { color: var(--text); border-bottom-color: var(--accent); }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
}
.views { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.views button { border: 0; background: none; padding: 6px 16px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; }
.views button.active { background: var(--accent); color: var(--accent-ink); }
.adder { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-wrap { position: relative; }
#search {
  width: min(380px, 80vw); padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg2); outline: none;
}
#search:focus { border-color: var(--accent); }
.search-mode { background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; }
.results {
  position: absolute; right: 0; top: calc(100% + 6px); width: min(460px, 92vw);
  max-height: 70vh; overflow: auto; z-index: 30;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.results .r { display: flex; gap: 10px; align-items: center; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.results .r:last-child { border-bottom: 0; }
.results .r:hover, .results .r.sel { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.results img, .results .noimg { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; background: var(--bg2); flex: none; }
body[data-sec="juegos"] .results img { width: 92px; height: 34px; }
.results .t { font-weight: 600; }
.results .s { color: var(--muted); font-size: 12px; }
.results .have { margin-left: auto; font-size: 11px; color: var(--ok); white-space: nowrap; }
.results .info { padding: 12px; color: var(--muted); }

.btn {
  border: 1px solid var(--line); background: var(--panel); padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.icon { padding: 8px 11px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: #ff8e8e; }
.btn.danger:hover { border-color: #ff8e8e; }
.btn.small { padding: 5px 10px; font-size: 12px; }

main { padding: 18px 24px 60px; }

/* ---------- filtros */
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.stat {
  border: 1px solid var(--line); background: var(--bg2); border-radius: 12px; padding: 8px 14px; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; min-width: 110px;
}
.stat b { font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 22px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg2)); }
.stat i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

.filters { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.filters label { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.filters select, .filters input[type=search] {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--bg2); border-radius: 999px; padding: 4px 11px;
  font-size: 12.5px; cursor: pointer; user-select: none;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip.sug:not(.on) { border-style: dashed; border-color: var(--accent); }
.chip .x { margin-left: 6px; opacity: .6; }
.chips.static .chip { cursor: default; }

/* ---------- grupos y tarjetas */
.group { margin-top: 22px; }
.group h3 {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px;
  font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 20px; font-weight: 700;
}
.group h3 .n { color: var(--muted); font: 500 13px Inter, sans-serif; }
.group h3::after { content: ""; flex: 1; height: 1px; background: var(--line); transform: translateY(-5px); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.card { cursor: pointer; position: relative; }
.card .cover { transition: transform .15s, box-shadow .15s; }
.card:hover .cover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(0,0,0,.45); }
.card .t { font-weight: 600; margin-top: 8px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .m { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; }
.card .quick {
  position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s;
}
.card:hover .quick { opacity: 1; }
.card .quick button {
  border: 0; background: rgba(10,12,16,.82); color: #fff; border-radius: 6px; padding: 4px 7px; cursor: pointer; font-size: 12px;
}
.card .quick button:hover { background: var(--accent); color: var(--accent-ink); }

.cover {
  aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden; position: relative;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 35%, #222), #1a1d24 70%);
  border: 1px solid rgba(255,255,255,.06);
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover img, .tile img { position: relative; z-index: 1; }
.badge, .ribbon, .score, .tile .tt { z-index: 2; }
.cover .ph {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 10px;
  font-family: "Bricolage Grotesque", Inter, sans-serif; font-weight: 700; font-size: 15px; line-height: 1.15;
}
.cover.big { width: 100%; }
.badge {
  position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 600;
  background: rgba(10,12,16,.85); border-radius: 6px; padding: 3px 7px; display: flex; align-items: center; gap: 5px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.pasado { background: var(--ok); } .dot.en_curso { background: var(--run); }
.dot.pendiente { background: var(--todo); } .dot.abandonado { background: var(--drop); }
.dot.quiero { background: var(--want); }
.dot.al_dia { background: var(--wait); }
.dot.temporadas { background: #b48cff; }
.tv-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tv-row input { width: 90px; }
.dot.platinado { background: #e8d27a; box-shadow: 0 0 0 2px rgba(232,210,122,.3); }
.info-line { font-size: 13px; color: var(--accent); margin-top: -4px; }
.ribbon {
  position: absolute; top: 8px; left: -1px; background: var(--want); color: #2a0b1f;
  font-size: 10.5px; font-weight: 700; padding: 3px 8px 3px 7px; border-radius: 0 6px 6px 0; letter-spacing: .02em;
}
.score {
  position: absolute; right: 6px; bottom: 6px; font-size: 12px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 2px 6px;
}
.empty {
  text-align: center; padding: 70px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; margin-top: 20px;
}
.empty h3 { color: var(--text); font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 22px; margin: 0 0 6px; }

/* ---------- diálogos */
.dlg {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; color: var(--text);
  width: min(560px, 94vw); max-height: 92vh;
}
.dlg.wide { width: min(880px, 96vw); }
.dlg.narrow { width: min(420px, 94vw); }
.dlg::backdrop { background: rgba(4,6,9,.7); backdrop-filter: blur(2px); }
.dlg form { margin: 0; }
.item-edit { display: grid; grid-template-columns: 220px 1fr; gap: 22px; }
@media (max-width: 680px) { .item-edit { grid-template-columns: 1fr; } .cover-col .cover { max-width: 180px; } }
.cover-col { display: flex; flex-direction: column; gap: 10px; }
.form-col { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea, #imp-text, .inline-add input, .thresholds input {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus, #imp-text:focus { border-color: var(--accent); }
.row2 { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row2 > .field { flex: 1; min-width: 110px; }
.row2 > .grow { flex: 3; }
.row2 > .w90 { flex: 0 0 90px; min-width: 90px; }
.hint { font-style: normal; color: var(--accent); margin-left: 6px; }
.upload-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
#ie-cover.drop { outline: 3px dashed var(--accent); outline-offset: 3px; }
.source-link { color: var(--accent); font-size: 13px; text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.tags-small { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.seg { display: flex; flex-wrap: wrap; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.dlg-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; }
.spacer { flex: 1; }
.msg { color: var(--muted); font-size: 13px; }
.inline-add { display: flex; gap: 8px; margin-top: 8px; }
.thresholds { color: var(--muted); align-items: center; gap: 6px; }
.thresholds input { width: 80px; }
#imp-text { resize: vertical; margin: 8px 0 12px; }
.imp-log { max-height: 220px; overflow: auto; font-size: 13px; padding-left: 22px; margin: 12px 0 0; }
.imp-log li { padding: 2px 0; }
.imp-log .ok { color: var(--ok); } .imp-log .warn { color: var(--run); } .imp-log .err { color: #ff8e8e; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .slider { width: 38px; height: 22px; background: var(--line); border-radius: 999px; position: relative; transition: background .15s; flex: none; }
.switch .slider::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(16px); }

/* ---------- tier list */
.tl-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tl-bar select { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 200px; }
.tl-bar .sizes { display: flex; gap: 2px; margin-left: 6px; }
.tl-bar label.chk { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; margin-left: 6px; }
.tierboard { display: flex; flex-direction: column; gap: 14px; }
.tcard { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.tcard-cab { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--c) 14%, transparent);
  border-bottom: 1px solid var(--line); }
.tcard-cab[data-edit] { cursor: pointer; }
.tcard-cab[data-edit]:hover .tcard-nombre::after { content: " ⚙"; font-size: 13px; opacity: .5; }
.tcard-ins { width: 44px; height: 44px; flex: none; border-radius: 14px; background: var(--c); color: #11131a; display: grid; place-items: center;
  font-family: "Bricolage Grotesque", Inter, sans-serif; font-weight: 800; font-size: 24px; transform: rotate(-6deg); }
.tcard-nombre { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tcard-media { flex: none; background: var(--c); color: #11131a; font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 999px; }
.tcard-n { margin-left: auto; flex: none; color: var(--muted); font-size: 13px; }
.tcard-grid { display: flex; flex-wrap: wrap; gap: 12px; padding: 14px 16px 16px; align-content: flex-start; min-height: calc(var(--tile) * 1.5 + 30px); }
.tile {
  width: var(--tile); aspect-ratio: 2 / 3; position: relative; cursor: grab; flex: none;
  background: #222; overflow: hidden; border-radius: 12px; outline: 1px solid rgba(255,255,255,.06);
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.tile .ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 11px; font-weight: 600; padding: 6px; background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 40%, #222), #1a1d24);
}
.tile .tt {
  position: absolute; left: 0; right: 0; top: 0; padding: 4px 5px 14px; font-size: 10.5px; line-height: 1.15; z-index: 2;
  background: linear-gradient(rgba(0,0,0,.9), transparent); opacity: 0; transition: opacity .12s; pointer-events: none;
}
.tile:hover .tt { opacity: 1; }
.tnota { position: absolute; right: 6px; bottom: 6px; z-index: 2; background: rgba(10,12,16,.85); color: #fff; font-size: 12px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px; pointer-events: none; }
.tile.dragging { opacity: .35; }
.tile.ghost { background: color-mix(in srgb, var(--accent) 35%, transparent); outline: 2px dashed var(--accent); outline-offset: -2px; }
.tierboard.hide-titles .tile .tt { display: none; }
.pool-wrap { margin-top: 18px; }
.pool-wrap h3 { font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 18px; margin: 0 0 8px; display: flex; gap: 10px; align-items: baseline; }
.pool-wrap h3 .n { color: var(--muted); font: 500 13px Inter, sans-serif; }
.pool { display: flex; flex-wrap: wrap; gap: 12px; min-height: calc(var(--tile) * 1.5 + 30px); padding: 14px 16px; border: 2px dashed var(--line); border-radius: 18px; background: var(--bg2); align-content: flex-start; }
.pool .hint-empty { color: var(--muted); padding: 30px; margin: auto; text-align: center; }
.palette { display: flex; gap: 6px; flex-wrap: wrap; }
.palette button { width: 30px; height: 30px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.palette button.on { border-color: #fff; }
.palette input[type=color] { width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; }
.tier-ops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

/* ---------- nota */
.rating { display: flex; gap: 8px; align-items: center; }
.rating input[type=range] { flex: 1; accent-color: var(--accent); padding: 0; border: 0; background: none; }
.rating input[type=number] { width: 72px; flex: none; text-align: center; font-weight: 700; }
.chip.gen .x { margin-left: 5px; }

/* ---------- análisis */
.an-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tilestat { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tilestat .k { font-size: 12px; color: var(--muted); }
.tilestat .v { font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 30px; font-weight: 800; line-height: 1.15; margin-top: 2px; }
.tilestat .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tilestat.hero { grid-column: span 2; border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--bg2)), var(--bg2) 70%); }
.tilestat.hero .v { font-size: 38px; }
@media (max-width: 640px) { .tilestat.hero { grid-column: span 1; } }
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
@media (max-width: 640px) { .an-grid { grid-template-columns: 1fr; } }
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.panel h3 { margin: 0 0 4px; font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 18px; }
.panel .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.panel .opts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.bars { display: flex; flex-direction: column; gap: 2px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr 92px; gap: 10px; align-items: center; padding: 4px 6px; border-radius: 6px; }
.bar-row:hover { background: rgba(255,255,255,.04); }
.bar-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { height: 12px; position: relative; }
.bar-row .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row.weak .fill { opacity: .45; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.bar-row .val small { color: var(--muted); margin-left: 4px; }
.hist { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: 6px; }
.hist .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.hist .colbar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; }
.hist .colbar.zero { background: transparent; }
.hist .lbl { font-size: 11px; color: var(--muted); margin-top: 4px; }
.hist .cnt { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.rank { display: flex; flex-direction: column; gap: 6px; }
.rank .ri { display: grid; grid-template-columns: 22px 34px 1fr auto; gap: 10px; align-items: center; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.rank .ri:hover { background: rgba(255,255,255,.04); }
.rank .pos { color: var(--muted); font-size: 12px; text-align: right; }
.rank .mini { width: 34px; height: 51px; border-radius: 4px; overflow: hidden; position: relative; }
.rank .mini .ph { font-size: 7px; padding: 2px; }
.rank .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .sc { font-weight: 700; font-variant-numeric: tabular-nums; }
.torate { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.torate .ri { grid-template-columns: 34px 1fr 76px; }
.torate input { width: 70px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; text-align: center; }
.tiempo-global { margin: -4px 0 16px; font-size: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.an-note { color: var(--muted); font-size: 12.5px; margin-top: 10px; }

/* ---------- mis tier lists */
.mistl-btn { margin-left: auto; font-weight: 600; }
.mistl-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mistl-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.mistl-sec { margin-top: 22px; }
.mistl-sec h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 20px; }
.mistl-sec h3 .n { color: var(--muted); font: 500 13px Inter, sans-serif; }
.mistl-empty { padding: 4px 0 6px; }
.mistl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
@media (max-width: 640px) { .mistl-grid { grid-template-columns: 1fr; } }
.mistl-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; transition: border-color .15s, transform .15s; min-width: 0; }
.mistl-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.mistl-card header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.mistl-card header b { font-size: 15px; }
.mistl-card header .muted { font-size: 12px; }
.mistl-card header .btn { margin-left: auto; }
.mini-board { border: 1px solid #000; background: #1a1a17; border-radius: 4px; overflow: hidden; }
.mini-tier { display: flex; min-height: 38px; border-bottom: 1px solid #000; }
.mini-tier:last-child { border-bottom: 0; }
.mini-label { flex: 0 0 58px; font-size: 10px !important; word-break: break-word; display: flex; align-items: center; justify-content: center; color: #111; font-weight: 700; font-size: 12px; overflow: hidden; text-align: center; line-height: 1; padding: 2px; }
.mini-items { display: flex; flex-wrap: wrap; align-items: flex-start; }
.mini-cover { width: 25px; height: 37px; position: relative; overflow: hidden; background: #2b3140; }
.mini-cover img { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; }
.mini-cover .ph { position: absolute; inset: 0; font-size: 0; background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 40%, #222), #1a1d24); }
.mini-more { align-self: center; font-size: 11px; color: var(--muted); padding: 0 6px; }

.radio { display: flex; gap: 8px; align-items: center; cursor: pointer; padding: 3px 0; }

/* ---------- cuenta y amigos (versión online) */
.usuario { position: relative; }
.usuario-btn { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px 4px 4px; cursor: pointer; font-weight: 600; max-width: 260px; }
.usuario-btn:hover { border-color: var(--muted); }
.usuario-nombre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 240px; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.5); overflow: hidden; }
.usuario-menu button { background: none; border: 0; text-align: left; padding: 11px 14px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.usuario-menu button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; }
.avatar.grande { width: 46px; height: 46px; font-size: 20px; }
.aviso-n { background: #ff5d6c; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.aviso-importar { margin: 12px 24px 0; padding: 10px 14px; border: 1px dashed var(--accent); border-radius: 10px; color: var(--text);
  background: color-mix(in srgb, var(--accent) 8%, transparent); }

.login { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(900px 500px at 70% -100px, rgba(102,192,244,.18), transparent 70%), var(--bg); }
.login-caja { width: min(440px, 100%); text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.login-caja .brand { font-size: 44px; }
.login-btn { font-size: 16px; padding: 12px 22px; }
.login-error { color: #ff8e8e; min-height: 1em; }

.amigo-add { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0 4px; }
.amigo-add input { flex: 1; min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; outline: none; }
.amigo-add input:focus { border-color: var(--accent); }
.amigo-fila { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.amigo-txt { display: flex; flex-direction: column; min-width: 0; }
.amigo-txt b, .amigo-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amigo-txt .muted { font-size: 12.5px; }
.amigo-acc { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.amigos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.amigo-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.amigo-card header { display: flex; gap: 12px; align-items: center; }
.amigo-card header .btn { margin-left: auto; }
.amigo-card .amigo-acc { margin-left: 0; }
.amigo-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.amigo-tabs { margin-left: auto; }
.solo-lectura .card { cursor: default; }
.solo-lectura .card .quick { display: none; }
.v.small-v { font-size: 22px; }
.cmp-fila { display: grid; grid-template-columns: 34px 1fr 52px 52px 52px; gap: 10px; align-items: center; padding: 4px; border-radius: 6px; }
.cmp-fila .mini { width: 34px; height: 51px; border-radius: 4px; overflow: hidden; position: relative; }
.cmp-fila .mini .ph { font-size: 7px; padding: 2px; }
.cmp-fila .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-cab { color: var(--muted); font-size: 12px; font-weight: 600; }
.cmp-nota { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.cmp-nota.suya { color: var(--muted); }
.cmp-dif { text-align: center; font-size: 12.5px; font-weight: 700; border-radius: 6px; padding: 2px 0; font-variant-numeric: tabular-nums; }
.cmp-dif.igual { background: rgba(79,208,138,.18); color: var(--ok); }
.cmp-dif.mas { background: rgba(102,192,244,.16); color: #8fd0f7; }
.cmp-dif.menos { background: rgba(255,139,209,.16); color: var(--want); }
.cmp-tiempo { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 18px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .usuario-nombre { display: none; }
  .usuario-btn { padding: 4px; }
  .aviso-importar { margin: 12px 16px 0; }
}

/* ---------- ruleta */
.ruleta { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
@media (max-width: 780px) { .ruleta { grid-template-columns: 1fr; } }
.ruleta-rueda { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ruleta-marco { position: relative; width: min(420px, 82vw); aspect-ratio: 1; }
.ruleta-marco canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 12px 30px rgba(0,0,0,.45)); }
.ruleta-flecha { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 0; height: 0;
  border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 30px solid #e8ebf0;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.6)); }
.ruleta-ticker { min-height: 1.4em; font-weight: 700; text-align: center; max-width: 420px; }
.ruleta-girar { font-size: 16px; padding: 10px 36px; }
.ruleta-panel { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ruleta-modos { align-self: flex-start; flex-wrap: wrap; border-radius: 12px; }
.ruleta-acc { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ruleta-lista { max-height: 240px; overflow: auto; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.ruleta-op { display: grid; grid-template-columns: auto 26px 1fr auto auto; gap: 10px; align-items: center; padding: 4px 6px; border-radius: 6px;
  cursor: pointer; background: none; border: 0; text-align: left; width: 100%; }
.ruleta-op:hover { background: rgba(255,255,255,.05); }
.ruleta-op .mini { width: 26px; height: 39px; border-radius: 3px; overflow: hidden; position: relative; }
.ruleta-op .mini .ph { font-size: 0; }
.ruleta-op .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ruleta-sug { display: flex; flex-direction: column; gap: 2px; }
.ruleta-sug .ruleta-op { grid-template-columns: 26px 1fr auto auto; }
.ruleta-ganador { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 14px; border-radius: 12px;
  border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg2)); animation: ruleta-in .35s ease-out; }
.ruleta-ganador .cover { width: 120px; }
.ruleta-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ruleta-info h3 { margin: 0; font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 24px; line-height: 1.15; }
@keyframes ruleta-in { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ruleta-ganador { animation: none; } }

/* ---------- generar tier list */
.newtl-paso { display: flex; flex-direction: column; gap: 12px; }
.newtl-lista { max-height: 300px; }
.newtl-lista .nt { font-variant-numeric: tabular-nums; }
.gen-cab { align-items: flex-end; }
.gen-filas { display: flex; flex-direction: column; gap: 6px; }
.gen-fila { display: grid; grid-template-columns: 28px 1fr 90px; gap: 8px; align-items: center; }
.gen-color { width: 28px; height: 28px; border-radius: 6px; }
.gen-fila input { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; outline: none; min-width: 0; }
.gen-fila input:focus { border-color: var(--accent); }
.gen-num { text-align: center; }
#gen-suma.error { color: #ff8e8e; }
.gen-preview { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.gen-prev { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.gen-tag { color: #111; font-weight: 700; border-radius: 6px; padding: 3px 9px; font-size: 13px; }
.gen-it { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 12.5px; }
.gen-it b { color: var(--muted); margin-left: 3px; }
/* Empate de nota partido entre filas: borde naranja por encima de la portada. */
.tile.empate::after { content: ""; position: absolute; inset: 0; border: 3px solid #ff9f1c; border-radius: 12px; z-index: 3; pointer-events: none; }
.gen-it.empate { outline: 2px solid #ff9f1c; outline-offset: -1px; }

/* ---------- tier lists públicas */
#btn-explorar.active, #btn-mistl.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.usuario-nombre small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; line-height: 1.1; }
.usuario-campo { display: flex; align-items: center; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding-left: 10px; }
.usuario-campo input { border: 0 !important; background: none !important; }
.usuario-campo:focus-within { border-color: var(--accent); }
.tl-publica a { color: var(--accent); }
.pub-nota { margin-left: auto; font-weight: 700; color: var(--run); white-space: nowrap; }
.pub-nota small { color: var(--muted); font-weight: 500; }
.pub-autor { color: var(--muted); font-size: 13px; margin: -4px 0 10px; }
.pub-titulo { font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 22px; }
.pub-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .pub-layout { grid-template-columns: 1fr; } }
.pub-lado { display: flex; flex-direction: column; gap: 16px; }
.pub-lado .panel { display: flex; flex-direction: column; gap: 10px; }
.pub-media { font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 40px; font-weight: 800; color: var(--run); display: flex; align-items: baseline; gap: 10px; }
.pub-media small { font: 500 13px Inter, sans-serif; color: var(--muted); }
.pub-coms { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow: auto; }
.pub-com { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.pub-com > div { display: flex; gap: 8px; align-items: center; }
.pub-com > div .btn { margin-left: auto; padding: 2px 8px; }
.pub-com p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
#pub-texto { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; outline: none; }
#pub-texto:focus { border-color: var(--accent); }

/* ---------- Mis Gustos */
.sections .sec-gustos { color: #ff9fb6; }
.sections .sec-gustos::before { content: "★ "; }
.adder.oculto { visibility: hidden; }
.gustos-secs { margin: 4px 0 12px; }
.gustos-secs .chip.on { background: var(--c); border-color: var(--c); color: #10131a; }
.sec-chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-right: 4px;
  color: #10131a; background: var(--c); vertical-align: 1px; }
.top-lista { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 14px; }
.top-fila { display: grid; grid-template-columns: 44px 40px 1fr auto; gap: 12px; align-items: center; padding: 6px 10px;
  border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); cursor: pointer; }
.top-fila:hover { border-color: var(--accent); }
.top-fila .mini { width: 40px; height: 60px; border-radius: 4px; overflow: hidden; position: relative; }
.top-fila .mini .ph { font-size: 7px; padding: 2px; }
.top-pos { font-family: "Bricolage Grotesque", Inter, sans-serif; font-size: 22px; font-weight: 800; text-align: center; color: var(--muted); }
.top-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.top-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-txt .muted { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-nota { font-weight: 800; font-size: 18px; background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 4px 10px; font-variant-numeric: tabular-nums; }
.top-fila.medalla .top-pos { color: #10131a; border-radius: 50%; width: 36px; height: 36px; line-height: 36px; justify-self: center; font-size: 18px; }
.top-fila.m1 .top-pos { background: #f5c518; }
.top-fila.m2 .top-pos { background: #c9d1dc; }
.top-fila.m3 .top-pos { background: #d79a63; }
.rank .nm .sec-chip { margin-left: 4px; }

/* ---------- vista previa de tier lists y barra */
.tl-nombre { font-family: "Bricolage Grotesque", Inter, sans-serif; font-weight: 800; font-size: 20px; background: transparent; border: 1px solid transparent;
  border-radius: 8px; padding: 4px 8px; color: var(--text); min-width: 160px; max-width: 360px; outline: none; }
.tl-nombre:hover { border-color: var(--line); }
.tl-nombre:focus { border-color: var(--accent); background: var(--bg2); }
.tlg-card { cursor: pointer; display: flex; flex-direction: column; }
.tlg-acc { display: flex; gap: 6px; margin-top: 10px; }
.tlg-acc .btn.danger { margin-left: auto; }
.tlg-nueva { min-height: 200px; border: 2px dashed var(--line); border-radius: 12px; background: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 15px; }
.tlg-nueva span { font-size: 42px; line-height: 1; color: var(--accent); }
.tlg-nueva:hover { border-color: var(--accent); color: var(--text); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  padding: 10px 16px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}

@media (max-width: 640px) {
  .top, .toolbar, main { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
  :root { --tile: 64px; }
}
