/* Para ver — noche de sofá: azul tinta, estrellas ámbar, propuestas coral */
:root {
  --bg: #101820;
  --bg-2: #15202a;
  --card: #1b2833;
  --field: #22313e;
  --line: rgba(230, 238, 244, .1);
  --ink: #e8eef2;
  --ink-soft: #94a6b4;
  --star: #f5b83d;
  --star-ink: #241703;
  --coral: #ff7a5c;
  --mint: #6fd3b0;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --text: 'Atkinson Hyperlegible', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(120% 60% at 50% -10%, #1d3040 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.5 var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); }
img { display: block; max-width: 100%; }

/* ---------- Marca ---------- */
.brand {
  font: 800 1.35rem/1 var(--display);
  letter-spacing: -.02em;
  display: flex; align-items: center; gap: .55rem;
}
.brand.big { font-size: 2.6rem; justify-content: center; }
.brand-mark {
  width: 1.1em; height: .8em; border-radius: .18em;
  background: linear-gradient(135deg, var(--star), var(--coral));
  position: relative; flex: none;
  box-shadow: 0 0 18px rgba(245, 184, 61, .35);
}
.brand-mark::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: .32em; height: .32em; transform: translate(-40%, -50%);
  clip-path: polygon(0 0, 100% 50%, 0 100%); background: var(--bg);
}

/* ---------- Entrada ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.lead { color: var(--ink-soft); margin: .8rem 0 2rem; }
.login form { display: grid; gap: .7rem; text-align: left; }
.login label { font-weight: 700; }
.confirm { margin-top: 1.4rem; padding: 1rem; background: var(--card); border-radius: var(--radius); }
.confirm .row { justify-content: center; }
.msg { min-height: 1.5em; color: var(--coral); margin-top: 1rem; }

input, textarea, select {
  width: 100%; background: var(--field); border: 1px solid var(--line);
  border-radius: 12px; padding: .75rem .9rem; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--star); }
textarea { resize: vertical; min-height: 84px; }

.btn {
  border: 0; border-radius: 999px; padding: .7rem 1.2rem; font-weight: 700;
  background: var(--field); transition: transform .12s, filter .12s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--star); color: var(--star-ink); }
.btn.coral { background: var(--coral); color: #2a0d05; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { padding: .45rem .85rem; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* ---------- Cabecera y pestañas ---------- */
#app { max-width: 980px; margin: 0 auto; padding-bottom: 110px; }
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px 8px;
}
.me-chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: .35rem .8rem .35rem .35rem; display: flex; align-items: center; gap: .5rem;
}
.tabs {
  position: sticky; top: 0; z-index: 5; display: flex; gap: .3rem; overflow-x: auto;
  padding: 8px 16px; background: rgba(16, 24, 32, .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.tabs button {
  border: 0; background: transparent; padding: .5rem .9rem; border-radius: 999px;
  color: var(--ink-soft); font-weight: 700; white-space: nowrap; position: relative;
}
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); }
.dot {
  position: absolute; top: 6px; right: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--coral);
}
.view { padding: 16px; }

/* ---------- Avatares ---------- */
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; font: 800 .85rem/1 var(--display);
  color: #10151a;
}
.avatar.lg { width: 40px; height: 40px; font-size: 1rem; }

/* ---------- Banderas y países ---------- */
.flag { width: 1.15em; height: .77em; border-radius: 2px; vertical-align: -1px; box-shadow: 0 0 0 1px rgba(0,0,0,.25); flex: none; }
.title-flags {
  position: absolute; top: 6px; right: 6px; z-index: 2; display: flex; gap: 3px;
  background: rgba(10, 14, 18, .75); padding: 3px; border-radius: 6px; line-height: 0;
}
.title-flags .flag { width: 18px; height: 12px; }
.tflag { position: relative; display: inline-block; }
.tflag.no .flag { opacity: .4; }
.tflag.no::after {
  content: ''; position: absolute; left: -2px; right: -2px; top: calc(50% - 1px); height: 2.5px; border-radius: 2px;
  background: var(--coral); transform: rotate(-30deg);
}
.thumb { position: relative; }
.thumb .title-flags { top: auto; bottom: 2px; right: 2px; left: 2px; justify-content: center; gap: 2px; padding: 2px; }
.thumb .title-flags .flag { width: 11px; height: 7px; }
.board-head .thumb .title-flags .flag { width: 14px; height: 9px; }
.avail {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 700;
  padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--line);
}
.avail.yes { color: var(--mint); border-color: rgba(111, 211, 176, .4); }
.avail.no { color: var(--coral); border-color: rgba(255, 122, 92, .4); }
.avail.unk { color: var(--ink-soft); }
.avail-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem;
  padding: .55rem 0; border-bottom: 1px solid var(--line);
}
.avail-line:last-of-type { border-bottom: 0; }
.avail-country { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; min-width: 9.5rem; }
.avail-country small { font-weight: 400; color: var(--ink-soft); }
.avail-line .seg { margin-left: auto; display: flex; gap: .3rem; }
.avail-line .chip { padding: .3rem .7rem; font-size: .85rem; }
.country-pick { display: grid; gap: .6rem; margin-top: 1.2rem; }
.country {
  display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 1.05rem; text-align: left;
}
.country .flag { width: 30px; height: 20px; }
.country.on { border-color: var(--star); }
.item.alert-ready { border-color: rgba(111, 211, 176, .45); background: linear-gradient(90deg, rgba(111,211,176,.12), var(--card) 45%); }
.link.muted { color: var(--ink-soft); }

/* ---------- Secciones ---------- */
.section { margin-bottom: 2rem; }
.section h2 {
  font: 800 1.25rem/1.2 var(--display); letter-spacing: -.01em;
  margin: 0 0 .25rem; display: flex; align-items: baseline; gap: .5rem;
}
.section .sub { color: var(--ink-soft); margin: 0 0 1rem; font-size: .95rem; }
.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 1.4rem; color: var(--ink-soft); text-align: center;
}

/* ---------- Rejilla de pósters ---------- */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}
.poster-card {
  background: none; border: 0; padding: 0; text-align: left; display: grid; gap: .45rem;
}
.poster {
  aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; background: var(--card);
  position: relative; box-shadow: var(--shadow);
}
.poster img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.poster .kind {
  z-index: 2;
  position: absolute; top: 6px; left: 6px; font-size: .7rem; font-weight: 700;
  background: rgba(10, 14, 18, .75); padding: .15rem .45rem; border-radius: 6px;
}
.poster .fallback {
  position: absolute; inset: 0; display: grid; place-items: center; padding: .8rem;
  text-align: center; font: 700 1rem/1.2 var(--display);
  background: linear-gradient(160deg, #24384a, #172430);
}
.poster-card .name { font-weight: 700; font-size: .95rem; line-height: 1.25; }
.poster-card .meta { color: var(--ink-soft); font-size: .82rem; display: flex; gap: .4rem; align-items: center; }

/* ---------- Nombres secundarios (español / inglés) ---------- */
.alt-names { display: flex; flex-direction: column; gap: .05rem; font-size: .76rem; line-height: 1.3; color: var(--ink-soft); }
.alt-names .lang {
  display: inline-block; font-size: .6rem; font-weight: 700; letter-spacing: .04em; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 .25rem; margin-right: .35rem; vertical-align: 1px;
}
.sheet .alt-names { font-size: .88rem; margin: .1rem 0 .4rem; }
.orig { font: 400 .72em/1.2 var(--text); color: var(--ink-soft); letter-spacing: 0; white-space: normal; }
.alt-names .lang + .lang, .tagged .lang + .lang { margin-left: -.15rem; }
.tagged .lang {
  display: inline-block; font: 700 .6rem/1.4 var(--text); letter-spacing: .04em; color: var(--star);
  border: 1px solid rgba(245, 184, 61, .4); border-radius: 4px; padding: 0 .25rem; margin-right: .35rem; vertical-align: 2px;
}

/* ---------- Estrellas ---------- */
.stars { color: var(--star); letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: rgba(245, 184, 61, .22); }
.star-input { display: flex; gap: .25rem; }
.star-input button {
  background: none; border: 0; padding: .1rem; font-size: 2.2rem; line-height: 1;
  color: rgba(245, 184, 61, .22); transition: transform .1s, color .1s;
}
.star-input button.on { color: var(--star); }
.star-input button:hover { transform: scale(1.12); }

/* ---------- Listas de actividad ---------- */
.feed { display: grid; gap: 10px; }
.item {
  display: flex; gap: .8rem; align-items: flex-start; background: var(--card);
  border-radius: var(--radius); padding: .8rem; border: 1px solid var(--line);
  text-align: left; width: 100%;
}
.item .thumb { width: 48px; aspect-ratio: 2/3; border-radius: 6px; overflow: hidden; flex: none; background: var(--field); }
.item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.item .body { flex: 1; min-width: 0; }
.item .who { font-size: .88rem; color: var(--ink-soft); }
.item .who b { color: var(--ink); }
.item .title { font-weight: 700; }
.item .quote { margin: .3rem 0 0; font-style: italic; color: #cfd9e0; overflow-wrap: anywhere; }
.item.proposal { border-color: rgba(255, 122, 92, .35); background: linear-gradient(90deg, rgba(255,122,92,.1), var(--card) 40%); }
.item.suggest { border-color: rgba(111, 211, 176, .3); }
.item .meta { color: var(--ink-soft); font-size: .85rem; }
.reason { color: var(--mint); font-size: .88rem; margin-top: .25rem; }
.when { color: var(--ink-soft); font-size: .78rem; }

/* ---------- Tablero ---------- */
.board { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); align-items: start; }
.board-card {
  background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--coral);
  border-radius: var(--radius); padding: .9rem; display: grid; gap: .8rem;
}
.board-head { display: flex; gap: .8rem; background: none; border: 0; padding: 0; text-align: left; width: 100%; }
.board-head .thumb { width: 64px; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden; flex: none; background: var(--field); }
.board-head .thumb img { width: 100%; height: 100%; object-fit: cover; }
.board-head .title { font: 700 1.1rem/1.2 var(--display); }
.board-head .meta, .board-card .meta { color: var(--ink-soft); font-size: .85rem; }
.board-props { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.board-props li { display: flex; gap: .6rem; align-items: flex-start; }
.board-props .who { font-size: .9rem; color: var(--ink-soft); }
.board-props .who b { color: var(--ink); }
.board-status { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--ink-soft); align-items: center; }
.board-status > span { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.board-status .avatar { width: 24px; height: 24px; font-size: .72rem; }
.board-status .stars { font-size: .8rem; margin-right: .3rem; }

/* ---------- Filtros ---------- */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters input { flex: 1 1 180px; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: .4rem .8rem; font-size: .9rem; color: var(--ink-soft);
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Botón flotante ---------- */
.fab {
  position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom));
  width: 60px; height: 60px; border-radius: 50%; border: 0; z-index: 10;
  background: var(--star); box-shadow: 0 10px 30px rgba(245, 184, 61, .35);
  display: grid; place-items: center;
}
.fab svg { width: 28px; height: 28px; stroke: var(--star-ink); stroke-width: 2.6; stroke-linecap: round; fill: none; }

/* ---------- Hoja inferior ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(4, 8, 12, .6); z-index: 20; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 21;
  width: 100%; max-width: 620px; max-height: 92dvh; overflow-y: auto;
  background: var(--bg-2); border-radius: 22px 22px 0 0; border: 1px solid var(--line);
  padding: 22px 16px max(28px, env(safe-area-inset-bottom));
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translate(-50%, 40px); opacity: 0; } }
.sheet-close {
  position: sticky; top: 0; float: right; margin: -8px -4px 0 0; width: 36px; height: 36px;
  border-radius: 50%; border: 0; background: var(--card); font-size: 1.4rem; line-height: 1; z-index: 2;
}
.sheet h3 { font: 800 1.4rem/1.15 var(--display); margin: 0 0 .3rem; }
.sheet h4 { font: 700 1rem/1.2 var(--display); margin: 1.4rem 0 .6rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; }
.detail-head { display: flex; gap: 14px; }
.detail-head .poster { width: 110px; flex: none; }
.detail-head .info { min-width: 0; }
.overview { color: #c7d2da; font-size: .93rem; margin-top: .8rem; }
.genres { color: var(--ink-soft); font-size: .85rem; }
.avg { font: 800 1.6rem/1 var(--display); color: var(--star); margin-top: .5rem; }
.avg small { font: 400 .85rem var(--text); color: var(--ink-soft); }
.box { background: var(--card); border-radius: var(--radius); padding: 1rem; display: grid; gap: .7rem; }
.link { color: var(--star); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-size: .9rem; }
.danger { color: var(--coral); }
.inline-confirm { background: rgba(255,122,92,.12); border-radius: 12px; padding: .8rem; }

/* ---------- Búsqueda ---------- */
.kind-switch { display: flex; gap: .4rem; margin: .8rem 0; }
.results { display: grid; gap: 8px; margin-top: 1rem; }
.result {
  display: flex; gap: .8rem; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: .5rem; text-align: left; width: 100%;
}
.result .thumb { width: 44px; aspect-ratio: 2/3; border-radius: 6px; overflow: hidden; background: var(--field); flex: none; }
.result .thumb img { width: 100%; height: 100%; object-fit: cover; }
.result .already { color: var(--mint); font-size: .8rem; }

/* ---------- Aviso ---------- */
.toast {
  position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: var(--bg); font-weight: 700; padding: .65rem 1.1rem;
  border-radius: 999px; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center;
}

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
  .sheet { bottom: 50%; transform: translate(-50%, 50%); border-radius: 22px; animation: none; }
  .detail-head .poster { width: 150px; }
}
