/* CardMetria — anime ending guide. Ink-night palette, sakura + cyan accents, screentone texture. */
:root {
  --ink: #0b0d17;
  --ink-2: #12152400;
  --surface: #141827;
  --surface-2: #1b2033;
  --line: #262c45;
  --text: #eef0fa;
  --muted: #9aa2c3;
  --faint: #6b7396;
  --sakura: #ff5c8a;
  --sakura-soft: rgba(255, 92, 138, .14);
  --cyan: #4be1ec;
  --cyan-soft: rgba(75, 225, 236, .12);
  --happy: #ffc857;
  --sad: #7aa2ff;
  --bitter: #c58bff;
  --open: #4be1ec;
  --ongoing: #6ee7a8;
  --radius: 14px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
  --head: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--text); font: 16px/1.6 var(--body);
  background-image: radial-gradient(rgba(255, 255, 255, .035) 1px, transparent 1.2px);
  background-size: 14px 14px;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--sakura); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--head); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4vw, 3rem); }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.75rem); }
p { margin: 0 0 1em; }
.wrap { width: min(1240px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(11, 13, 23, .86); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 22px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 1.15rem var(--head); letter-spacing: -.02em; white-space: nowrap; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sakura), #ff8a5c); color: #1a0710; font: 700 1.05rem "Noto Sans JP", var(--head);
  box-shadow: 0 6px 18px -6px var(--sakura);
}
.brand em { font-style: normal; color: var(--sakura); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: .94rem; white-space: nowrap; }
.nav a:hover, .nav a.on { background: var(--surface-2); color: var(--text); }
.search { margin-left: auto; position: relative; }
.search input {
  width: 240px; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 10px;
  padding: 9px 12px 9px 34px; font: inherit; font-size: .92rem;
}
.search input:focus { outline: 2px solid var(--sakura-soft); border-color: var(--sakura); }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.account-link { font-weight: 600; font-size: .92rem; white-space: nowrap; }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 7px 10px; }
@media (max-width: 1120px) {
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--ink); border-bottom: 1px solid var(--line); padding: 10px 16px 16px; }
  .nav.open { display: flex; }
  .menu-toggle { display: block; }
  .search input { width: 160px; }
}
@media (max-width: 560px) { .search { display: none; } .top .wrap { gap: 12px; } .account-link { margin-left: auto; } }

/* ---------- Buttons, chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; border-radius: 11px;
  padding: 11px 18px; font: 600 .95rem var(--body); background: var(--sakura); color: #1a0710;
}
.btn:hover { filter: brightness(1.08); color: #1a0710; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--sakura); color: var(--text); }
.btn.cyan { background: var(--cyan); color: #04181a; }
.btn.small { padding: 7px 12px; font-size: .85rem; border-radius: 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .86rem;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.chip:hover, .chip.on { border-color: var(--sakura); color: var(--text); background: var(--sakura-soft); }
.chip b { color: var(--faint); font-weight: 500; }
.mood { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; }
.mood::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mood-Happy { color: var(--happy); } .mood-Sad { color: var(--sad); } .mood-Bittersweet { color: var(--bitter); }
.mood-Open { color: var(--open); } .mood-Ongoing { color: var(--ongoing); } .mood-Unknown { color: var(--faint); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 56px 0 34px; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 92, 138, .22), transparent 62%); pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; position: relative; z-index: 1; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font: 600 .78rem var(--head); text-transform: uppercase; letter-spacing: .14em; color: var(--cyan); margin-bottom: 14px; }
.eyebrow::before { content: ""; width: 18px; height: 2px; background: currentColor; }
.hero h1 span { background: linear-gradient(90deg, var(--sakura), #ffb38a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 560px; }
.hero-search { display: flex; gap: 10px; margin: 22px 0 16px; max-width: 560px; }
.hero-search input {
  flex: 1; min-width: 0; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit;
}
.poster-stack { position: relative; height: 380px; }
.poster-stack a { position: absolute; width: 46%; aspect-ratio: 2/3; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); transition: transform .25s; }
.poster-stack a img { width: 100%; height: 100%; object-fit: cover; }
.poster-stack a:nth-child(1) { left: 2%; top: 30px; transform: rotate(-7deg); }
.poster-stack a:nth-child(2) { left: 27%; top: 0; z-index: 2; }
.poster-stack a:nth-child(3) { left: 52%; top: 40px; transform: rotate(6deg); }
.poster-stack a:hover { transform: translateY(-6px) rotate(0); z-index: 3; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .poster-stack { display: none; } }

/* ---------- Sections & rows ---------- */
.section { padding: 26px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.section-head a { color: var(--cyan); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: 168px; gap: 16px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; }
.rail > * { scroll-snap-align: start; }
.rail::-webkit-scrollbar { height: 6px; } .rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }

/* ---------- Poster card ---------- */
.card { position: relative; display: block; }
.card .cover {
  position: relative; aspect-ratio: 2/3; border-radius: var(--radius); overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--line); transition: transform .2s, border-color .2s;
}
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .cover { transform: translateY(-4px); border-color: var(--sakura); }
.card .cover .badge {
  position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 7px; font-size: .72rem; font-weight: 700;
  background: rgba(11, 13, 23, .82); backdrop-filter: blur(6px);
}
.card .cover .score { position: absolute; right: 8px; top: 8px; padding: 3px 7px; border-radius: 7px; font: 700 .74rem var(--head); background: var(--cyan); color: #04181a; }
.card .cover .rank { position: absolute; left: 8px; bottom: 8px; font: 700 2.4rem/1 var(--head); color: #fff; -webkit-text-stroke: 1px rgba(0, 0, 0, .5); text-shadow: 0 4px 16px rgba(0, 0, 0, .6); }
.card h3 { font-size: .96rem; margin: 10px 0 2px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { font-size: .8rem; color: var(--faint); }
.cover-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; font: 700 1rem var(--head); color: var(--muted); }

/* ---------- Theme tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile { padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.tile:hover { border-color: var(--cyan); color: var(--text); background: var(--cyan-soft); }
.tile span { color: var(--faint); font-size: .85rem; }

.mood-band { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.mood-card { padding: 22px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); position: relative; overflow: hidden; }
.mood-card::after { content: attr(data-kanji); position: absolute; right: 10px; bottom: -14px; font: 700 5rem "Noto Sans JP", sans-serif; opacity: .08; }
.mood-card h3 { margin-bottom: 6px; } .mood-card p { color: var(--muted); font-size: .9rem; margin: 0; }
.mood-card:hover { border-color: currentColor; }
@media (max-width: 860px) { .mood-band { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Listing / filters ---------- */
.page-head { padding: 38px 0 14px; }
.page-head p { color: var(--muted); max-width: 720px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); margin: 14px 0 20px; }
.filters select, .filters input, .field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink); color: var(--text); font: inherit; font-size: .92rem;
}
.filters label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.filters label input { width: auto; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 18px; }
.active-filters .chip span { margin-left: 4px; opacity: .7; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sorts { display: flex; gap: 6px; flex-wrap: wrap; }
.pager { display: flex; justify-content: center; gap: 8px; margin: 30px 0 10px; }
.pager a, .pager span { padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); font-size: .9rem; }
.pager span { color: var(--faint); }
.empty { padding: 50px 20px; text-align: center; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); }

/* ---------- Detail ---------- */
.detail-hero { position: relative; padding: 40px 0 30px; overflow: hidden; }
.detail-hero .backdrop { position: absolute; inset: 0; background-size: cover; background-position: center 30%; filter: blur(40px) saturate(1.3); opacity: .28; transform: scale(1.2); }
.detail-hero .backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 13, 23, .2), var(--ink) 92%); }
.detail-grid { position: relative; display: grid; grid-template-columns: 260px 1fr; gap: 36px; align-items: start; }
.detail-poster { border-radius: 18px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); aspect-ratio: 2/3; background: var(--surface-2); }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.crumbs { font-size: .85rem; color: var(--faint); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.alt-titles { color: var(--muted); font-size: .95rem; margin-top: -4px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0; font-size: .92rem; color: var(--muted); }
.facts b { color: var(--text); font-weight: 600; }
.quick-take { font-size: 1.12rem; border-left: 3px solid var(--sakura); padding: 4px 0 4px 16px; margin: 18px 0; color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.status-pills { display: inline-flex; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.status-pills button { background: var(--surface); color: var(--muted); border: 0; padding: 10px 14px; font: 600 .86rem var(--body); cursor: pointer; border-right: 1px solid var(--line); }
.status-pills button:last-child { border-right: 0; }
.status-pills button.on { background: var(--sakura); color: #1a0710; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } .detail-poster { width: 200px; } }

.layout { display: grid; grid-template-columns: 1fr 320px; gap: 34px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; margin-bottom: 22px; }
.panel h2 { font-size: 1.3rem; }
.prose p { color: #d6daf0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }
.fit h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-bottom: 8px; }
.fit ul { margin: 0; padding-left: 18px; } .fit li { margin-bottom: 4px; }
.fit.yes li::marker { color: var(--ongoing); } .fit.no li::marker { color: var(--sakura); }

/* Ending breakdown */
.ending { position: relative; border-radius: 20px; padding: 26px; margin-bottom: 22px; border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 92, 138, .10), rgba(75, 225, 236, .05) 60%, transparent), var(--surface); }
.ending-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ending-tag { font: 700 .72rem var(--head); text-transform: uppercase; letter-spacing: .14em; color: var(--sakura); }
.beat { border-radius: 14px; padding: 18px; background: rgba(11, 13, 23, .55); border: 1px solid var(--line); margin-bottom: 12px; }
.beat h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 8px; color: var(--cyan); }
.beat p { margin: 0; }
.beat.n2 h3 { color: var(--bitter); } .beat.n3 h3 { color: var(--happy); }
.locked { position: relative; }
.locked .ghost-lines { filter: blur(5px); opacity: .45; user-select: none; pointer-events: none; }
.ghost-lines span { display: block; height: 12px; border-radius: 6px; background: var(--muted); margin: 10px 0; }
.unlock { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; }
.unlock-card { max-width: 420px; background: rgba(11, 13, 23, .92); border: 1px solid var(--sakura); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.unlock-card h3 { margin-bottom: 6px; } .unlock-card p { color: var(--muted); font-size: .92rem; }
.spoiler-gate summary { cursor: pointer; list-style: none; }
.spoiler-gate summary::-webkit-details-marker { display: none; }
.spoiler-gate[open] .if-closed, .spoiler-gate:not([open]) .if-open { display: none; }
.disclaimer { font-size: .8rem; color: var(--faint); margin-top: 12px; }

.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.side-list li:last-child { border-bottom: 0; }
.side-list span { color: var(--faint); }
.watch-links { display: grid; gap: 8px; }
.watch-links a { display: flex; justify-content: space-between; padding: 11px 14px; border-radius: 11px; background: var(--ink); border: 1px solid var(--line); font-weight: 600; font-size: .92rem; }
.watch-links a:hover { border-color: var(--cyan); }
.trailer { position: relative; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; background: #000; }
.trailer iframe, .trailer button { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.trailer button { cursor: pointer; background-size: cover; background-position: center; display: grid; place-items: center; }
.trailer button span { width: 64px; height: 64px; border-radius: 50%; background: var(--sakura); display: grid; place-items: center; color: #1a0710; font-size: 1.4rem; }
.order { counter-reset: o; list-style: none; padding: 0; margin: 0; }
.order li { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.order li span { color: var(--faint); font-size: .8rem; min-width: 96px; }
.order li.current { color: var(--sakura); font-weight: 600; }
.review { padding: 14px 0; border-bottom: 1px solid var(--line); }
.review b { font-size: .9rem; } .review p { margin: 6px 0 0; color: #d6daf0; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; color: var(--muted); }

/* Forms */
.auth { max-width: 440px; margin: 50px auto; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .86rem; color: var(--muted); margin-bottom: 6px; }
.alert { padding: 12px 14px; border-radius: 11px; margin-bottom: 16px; font-size: .92rem; background: var(--sakura-soft); border: 1px solid var(--sakura); }
.alert.ok { background: var(--cyan-soft); border-color: var(--cyan); }
.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }

/* Find */
.find-box { display: grid; gap: 12px; }
.find-box textarea { min-height: 110px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; resize: vertical; }
.why { font-size: .76rem; color: var(--cyan); margin-top: 4px; }

/* Footer */
.foot { border-top: 1px solid var(--line); margin-top: 60px; padding: 36px 0; color: var(--faint); font-size: .9rem; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
.foot h4 { color: var(--text); font-size: .9rem; margin-bottom: 10px; }
.foot a { display: block; padding: 3px 0; color: var(--muted); }
.foot .legal { margin-top: 26px; font-size: .8rem; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
