/* Maratona — tema "sala escura". Mobile primeiro; a partir de 900px vira layout com menu lateral. */
:root {
  --bg: #0D0E11;
  --surface: #16181D;
  --surface-2: #1F2229;
  --border: #2A2E36;
  --text: #F3F3F1;
  --soft: #C9CDD3;
  --muted: #A3A8B1;
  --faint: #8A8F98;
  --accent: #F4C430;
  --accent-hover: #FFD95C;
  --on-accent: #14120A;
  --serie: #9CC3FF;
  --anime: #FFA36B;
  --filme: #F4C430;
  --danger: #FF8A80;
  --ok: #8BD7A8;
  --radius: 16px;
  --nav-h: 66px;
  --pad: 20px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-family: var(--display); letter-spacing: -0.3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font-family: inherit; }

.h1 { font-size: 26px; font-weight: 700; line-height: 1.15; }
.h2 { font-size: 18px; font-weight: 700; }
.display { font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: -0.8px; }
.lead { margin: 0; font-size: 16px; line-height: 1.5; color: var(--muted); }
.eyebrow { font-family: var(--font); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.faint { color: var(--faint); }
.strong { font-weight: 600; }
.accent-text { color: var(--accent); font-weight: 600; }
.ok-text { color: var(--ok); }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: 10px; }
.skip:focus { left: 8px; }

/* ---------- Estrutura ---------- */
.main {
  max-width: 1120px; margin: 0 auto;
  padding: var(--pad) var(--pad) calc(var(--nav-h) + 32px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 28px;
}
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(18, 19, 23, 0.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.nav a {
  flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; border-radius: 12px;
}
.nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.nav .nav-brand, .nav .nav-desktop { display: none; }

@media (min-width: 900px) {
  :root { --pad: 40px; }
  .shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
  .nav {
    position: sticky; top: 0; height: 100vh; flex-direction: column; gap: 4px;
    border-top: 0; border-right: 1px solid var(--border); padding: 28px 14px; background: #111216;
  }
  .nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; min-height: 46px; font-size: 15px; }
  .nav a:hover { background: var(--surface); color: var(--text); }
  .nav a[aria-current="page"] { background: var(--surface); }
  .nav .nav-brand { display: flex; align-items: center; gap: 10px; padding: 0 14px 22px; font: 700 22px var(--display); }
  .nav .nav-desktop { display: flex; }
  .nav .nav-spacer { flex: 1; }
  .main { padding-top: 36px; padding-bottom: 56px; }
}
.brand-dot { width: 12px; height: 18px; border-radius: 3px; background: var(--accent); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.month-label { min-width: 0; text-align: center; }
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; }
.section-head a { font-size: 14px; font-weight: 500; text-decoration: none; }
.cols { display: grid; gap: 16px; }
@media (min-width: 900px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }

/* ---------- Botões ---------- */
.btn {
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 15px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #3A3F48; color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: var(--danger); border-color: #5A2A2A; }
.link-btn { background: none; border: 0; padding: 0; min-height: 36px; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 22px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); display: inline-flex; align-items: center; justify-content: center; position: relative; text-decoration: none; cursor: pointer;
}
.icon-btn:hover { color: var(--accent); }
.icon-btn-lg { width: 48px; height: 48px; border-radius: 14px; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
.avatar {
  width: 44px; height: 44px; border-radius: 22px; background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; text-decoration: none; flex-shrink: 0;
}
.avatar:hover { color: var(--on-accent); background: var(--accent-hover); }
.avatar-lg { width: 64px; height: 64px; border-radius: 32px; font-size: 22px; }
.profile-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Chips e filtros ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  min-height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--border); background: transparent;
  color: var(--soft); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; text-decoration: none; flex-shrink: 0;
}
.chip:hover { color: var(--text); border-color: #3A3F48; }
.chip[aria-current="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip .count { font-size: 12px; opacity: 0.7; }
.chip-sm { min-height: 32px; font-size: 13px; padding: 0 12px; }
@media (min-width: 900px) { .chips { margin: 0; padding: 0; flex-wrap: wrap; } }

/* ---------- Pôsteres ---------- */
.poster { aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; background: var(--surface-2); position: relative; flex-shrink: 0; }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster-empty { display: flex; align-items: flex-end; padding: 8px; background: #2B3340; }
.poster-empty span { font: 700 12px/1.15 var(--display); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.poster-sm { width: 40px; border-radius: 6px; }
.poster-sm.poster-empty span, .poster-list.poster-empty span { display: none; }
.poster-md { width: 84px; }
.poster-agenda { width: 60px; border-radius: 8px; }
.poster-list { width: 52px; border-radius: 8px; }
.poster-lg { width: 108px; border-radius: 12px; border: 3px solid var(--bg); }
.poster-wrap { position: relative; }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, 0.55); border-radius: 0 0 10px 10px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* ---------- Tags de tipo ---------- */
.tag { align-self: flex-start; font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; border: 1px solid; border-radius: 6px; padding: 2px 6px; line-height: 1.4; }
.tag-series { color: var(--serie); border-color: #3A4A66; }
.tag-anime { color: var(--anime); border-color: #66463A; }
.tag-movie { color: var(--filme); border-color: #665A2E; }
.kind { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; flex-shrink: 0; }
.kind-series { color: var(--serie); }
.kind-anime { color: var(--anime); }
.kind-movie { color: var(--filme); }

/* ---------- Cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card.pad { padding: 18px; }
a.card:hover { border-color: #3A3F48; }
.stack-cards { display: grid; gap: 12px; }
@media (min-width: 700px) { .stack-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .stack-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.feature { display: flex; gap: 14px; padding: 14px; text-decoration: none; color: var(--text); }
.feature:hover { color: var(--text); }
.feature-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.feature-title { font: 700 17px/1.2 var(--display); }
.feature-top, .feature-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.feature-foot { margin-top: auto; flex-wrap: wrap; }

/* ---------- Trilho horizontal ---------- */
.rail { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad) 4px; scroll-snap-type: x proximity; }
.rail::-webkit-scrollbar { display: none; }
.rail-item { width: 128px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--text); scroll-snap-align: start; }
.rail-item:hover { color: var(--text); }
.rail-item .poster { width: 100%; }
.rail-meta { display: flex; flex-direction: column; gap: 2px; }
.rail-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 900px) {
  .rail { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; overflow: visible; }
  .rail-item { width: auto; }
}

/* ---------- Linhas ---------- */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--surface-2); text-decoration: none; color: var(--text); min-height: 64px; }
.row:hover { color: var(--text); }
.row:hover .row-title { color: var(--accent); }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-chevron { display: flex; }
.datebox { width: 44px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.datebox small { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.datebox b { font: 700 22px/1.1 var(--display); }
.list-rows .row { padding: 12px 0; }

/* ---------- Agenda ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day {
  height: 66px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none;
}
.day:hover { color: var(--text); border-color: #3A3F48; }
.day small { font-size: 11px; font-weight: 600; text-transform: uppercase; }
.day b { font: 700 18px/1.1 var(--display); }
.day i { width: 5px; height: 5px; border-radius: 3px; background: transparent; }
.day.has i { background: var(--accent); }
.day.is-today { border-color: #6B5A22; }
.day[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day[aria-current="true"] i { background: var(--on-accent); }
.day[aria-current="true"]:not(.has) i { background: transparent; }
@media (min-width: 900px) { .week { max-width: 640px; } }

/* ---------- Página do título ---------- */
.hero {
  position: relative; overflow: hidden; height: 230px; background: var(--surface-2);
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 0;
}
.hero::before { content: ""; position: absolute; inset: 0; background: var(--hero, none) center / cover no-repeat; }
.hero-blur::before { filter: blur(22px) brightness(0.55); transform: scale(1.25); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(13, 14, 17, 0.05) 35%, var(--bg)); }
.hero-back { position: absolute; top: 16px; left: 16px; z-index: 2; background: rgba(13, 14, 17, 0.72); border-color: transparent; }
.title-head { display: flex; gap: 16px; align-items: flex-end; margin-top: -100px; position: relative; z-index: 2; }
.title-info { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding-bottom: 4px; }
.title-name { font-size: 24px; }
@media (min-width: 900px) {
  .hero { height: 320px; margin-top: -36px; border-radius: 0 0 24px 24px; }
  .poster-lg { width: 168px; }
  .title-head { margin-top: -140px; padding-left: 8px; }
  .title-name { font-size: 34px; }
}
.status-form { flex: 1; min-width: 200px; max-width: 360px; }
.select-primary {
  width: 100%; height: 48px; border-radius: 14px; border: 1px solid var(--accent); padding: 0 40px 0 16px;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2314120A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--on-accent); font: 600 15px var(--font); appearance: none; -webkit-appearance: none; cursor: pointer;
}
.select-primary option { color: #111; background: #fff; }
.facts { display: flex; gap: 24px; flex-wrap: wrap; }
.facts > div { display: flex; flex-direction: column; gap: 2px; }
.facts b { font: 700 17px var(--display); }
.progress-block { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s; }
.progress-thin { height: 4px; margin-top: 4px; max-width: 260px; }
.overview { margin: 0; font-size: 14px; line-height: 1.6; color: var(--soft); white-space: pre-line; max-width: 72ch; }
.overview.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }

.eps { list-style: none; margin: 0; padding: 0; max-width: 820px; }
.ep { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--surface-2); }
.ep.future { opacity: 0.6; }
.ep-num { width: 28px; padding-top: 12px; font: 700 15px var(--display); color: var(--muted); flex-shrink: 0; }
.ep-body { flex: 1; min-width: 0; }
.ep-body summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-height: 44px; justify-content: center; }
.ep-body summary::-webkit-details-marker { display: none; }
.ep-title { font-size: 15px; font-weight: 500; }
.ep-body[open] .ep-title { color: var(--accent); }
.ep-overview { margin: 6px 0 4px; line-height: 1.55; }
.check {
  width: 44px; height: 44px; border-radius: 22px; border: 1.5px solid #4A4F59; background: transparent; color: #6A6F78;
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background 0.15s, border-color 0.15s;
}
.check:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.check[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check:disabled { cursor: not-allowed; }
.check.busy { opacity: 0.5; }

/* ---------- Busca ---------- */
.search-form { position: relative; max-width: 640px; }
.search-form .input { padding-left: 46px; }
.search-icon { position: absolute; left: 14px; top: 15px; color: var(--muted); pointer-events: none; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 16px; } }
.result { position: relative; min-width: 0; }
.result-link { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); }
.result-link:hover { color: var(--text); }
.result-link:hover .result-name { color: var(--accent); }
.result-link .poster { width: 100%; margin-bottom: 4px; }
.result-name { font-size: 13px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.add-form { position: absolute; top: 4px; right: 4px; }
.add-btn {
  width: 44px; height: 44px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(13, 14, 17, 0.82);
  color: var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.add-btn:hover { background: var(--accent); color: var(--on-accent); }
.in-list {
  position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600;
  background: var(--accent); color: var(--on-accent); padding: 3px 7px; border-radius: 6px;
}

/* ---------- Lista ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font: 700 22px/1.1 var(--display); }
.stat span { font-size: 12px; color: var(--muted); }
@media (min-width: 900px) { .stats { max-width: 640px; } }

/* ---------- Formulários ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field > span.label { font-size: 13px; font-weight: 500; color: var(--soft); }
.input {
  width: 100%; height: 50px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 0 14px; font: 16px var(--font);
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
select.input { appearance: none; -webkit-appearance: none; }
.check-label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--soft); cursor: pointer; }
.check-label input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.code { display: block; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; color: var(--soft); word-break: break-all; }

/* ---------- Telas sem menu (login) ---------- */
.bare-main { max-width: 420px; min-height: 100vh; margin: 0 auto; padding: 56px 24px 32px; display: flex; flex-direction: column; gap: 32px; }
.brand-hero { display: flex; flex-direction: column; gap: 18px; }
.brand-mark { display: flex; gap: 6px; }
.brand-mark i { display: block; width: 40px; height: 56px; border-radius: 8px; }
.brand-mark i:nth-child(1) { background: #3B4A5C; }
.brand-mark i:nth-child(2) { background: #5C3B3B; margin-top: 10px; }
.brand-mark i:nth-child(3) { background: var(--accent); }
.bare-foot { margin: auto 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.bare-foot a { font-weight: 600; text-decoration: none; }

/* ---------- Avisos ---------- */
.flash { padding: 12px 14px; border-radius: 12px; font-size: 14px; border: 1px solid; }
.flash-ok { background: #13261B; border-color: #24503A; color: var(--ok); }
.flash-error { background: #2A1616; border-color: #5A2A2A; color: var(--danger); }
.empty { padding: 32px 18px; border: 1px dashed var(--border); border-radius: 16px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
@media (min-width: 900px) { .toast { bottom: 32px; } }

/* ---------- Tabela (admin) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--surface-2); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.table tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; gap: 8px; justify-content: flex-end; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
