/* ZYRAVENTH — black, deep purple, dark red, a trace of cyan. No orange. */
:root {
  --bg: #040208;
  --panel: #0d0815;
  --panel-2: #140c20;
  --line: rgba(139, 92, 246, .26);
  --line-2: rgba(139, 92, 246, .55);
  --violet: #a78bfa;
  --purple: #7c3aed;
  --red: #d1213f;
  --red-d: #7d1230;
  --cyan: #67e8f9;
  --text: #efeaf8;
  --muted: #a9a0be;
  --sans: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --row: 14.5rem;
  --head: 3.4rem;
  --tabbar: 3.6rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; width: 100%; overflow-x: hidden;
  background: transparent; color: var(--text); font: 400 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
}
img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: .5rem; top: -4rem; z-index: 100; background: var(--panel); padding: .6rem 1rem; border: 1px solid var(--line-2); border-radius: .5rem; }
.skip:focus { top: .5rem; }
.mono { font-family: var(--mono); }
.brk { word-break: break-all; overflow-wrap: anywhere; }

/* ---- atmosphere: static, light, no animation ---- */
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; }
body::before {
  background:
    radial-gradient(60rem 40rem at 88% -8%, rgba(91, 33, 182, .30), transparent 62%),
    radial-gradient(48rem 36rem at -12% 42%, rgba(125, 18, 48, .18), transparent 62%),
    radial-gradient(42rem 28rem at 62% 112%, rgba(34, 211, 238, .07), transparent 66%);
}
body::after {
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(255, 255, 255, .9), transparent),
    radial-gradient(1px 1px at 120px 80px, rgba(167, 139, 250, .9), transparent),
    radial-gradient(1.5px 1.5px at 200px 150px, rgba(103, 232, 249, .8), transparent),
    radial-gradient(1px 1px at 70px 190px, rgba(255, 255, 255, .7), transparent),
    radial-gradient(1px 1px at 170px 230px, rgba(209, 33, 63, .85), transparent),
    radial-gradient(1px 1px at 240px 60px, rgba(255, 255, 255, .6), transparent);
  background-size: 270px 270px;
  opacity: .5;
}

.wrap { width: 100%; max-width: 96rem; margin: 0 auto; padding-left: max(.75rem, env(safe-area-inset-left)); padding-right: max(.75rem, env(safe-area-inset-right)); }

/* ---- header ---- */
.top { position: sticky; top: 0; z-index: 30; background: rgba(4, 2, 8, .94); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: .75rem; height: var(--head); }
.logo { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: .24em; font-size: .92rem; white-space: nowrap; }
.logo svg { flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0; border: 1px solid var(--line); border-radius: .75rem; background: var(--panel); cursor: pointer; flex: none; }
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn svg, .tabs svg, .field svg, .back svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* navigation: bottom bar on phones, inline on larger screens */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(4, 2, 8, .97); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; min-height: var(--tabbar); font-size: .74rem; color: var(--muted); }
.tabs a[aria-current="page"] { color: var(--text); box-shadow: inset 0 2px 0 var(--red); background: linear-gradient(180deg, rgba(125, 18, 48, .25), transparent); }

/* ---- views ---- */
.view { padding: 1rem 0 2rem; }
.vhead { margin: .25rem 0 1rem; }
.vhead h1 { font-size: clamp(1.5rem, 4.5vw, 2.1rem); line-height: 1.15; letter-spacing: .01em; font-weight: 700; }
.vhead p { margin-top: .3rem; color: var(--muted); font-size: .92rem; max-width: 60ch; }
.count b { color: var(--cyan); font-weight: 600; font-variant-numeric: tabular-nums; }
.boot { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* ---- grid & cards (fixed row height lets far-away cards collapse safely) ---- */
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .7rem; grid-auto-rows: var(--row); }
.grid-auto { grid-auto-rows: auto; }

.card {
  position: relative; display: grid; grid-template-columns: 7.25rem minmax(0, 1fr); height: 100%; overflow: hidden;
  background: linear-gradient(155deg, #130c21 0%, #08050e 72%); border: 1px solid var(--line); border-radius: .9rem;
  box-shadow: 0 .7rem 1.5rem -1rem rgba(0, 0, 0, .95);
}
.card:hover { border-color: rgba(103, 232, 249, .35); }
.grid-auto .card { height: auto; min-height: 13rem; }
.cimg { display: block; height: 100%; min-height: 100%; background: radial-gradient(circle at 50% 30%, #2b1457, #07040d); }
.cimg img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.cbody { display: flex; flex-direction: column; gap: .28rem; min-width: 0; min-height: 0; padding: .65rem .75rem .7rem; }
.cbody h3 { font-size: 1rem; line-height: 1.28; font-weight: 650; max-height: 2.56rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cbody h3 a:hover { color: var(--cyan); }
.cid { font: 500 .625rem/1.3 var(--mono); letter-spacing: -.01em; color: #86e3ef; word-break: break-all; overflow-wrap: anywhere; }
.cdesc { font-size: .8rem; line-height: 1.4; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cloc { display: flex; flex-direction: column; gap: .1rem; font-size: .75rem; line-height: 1.15rem; min-width: 0; }
.tag { display: block; max-width: 100%; padding-left: .85rem; position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cfc6e6; }
.tag::before { content: ""; position: absolute; left: 0; top: .42rem; width: .45rem; height: .45rem; border-radius: 50%; background: var(--violet); }
.tag-s::before { background: var(--red); }
a.tag:hover { color: var(--cyan); }
.btn { display: inline-flex; align-items: center; justify-content: center; align-self: flex-start; margin-top: auto; min-height: 2.5rem; padding: 0 1.1rem; border: 1px solid #b8203d; border-radius: .6rem; background: linear-gradient(180deg, #8a1634, #5c0f25); color: #fff; font-weight: 600; font-size: .86rem; cursor: pointer; }
.btn:hover { background: linear-gradient(180deg, #a31a3c, #6d1230); }
.btn.ghost { margin-top: 0; background: transparent; border-color: var(--line-2); color: var(--text); }
.btn.ghost:hover { border-color: var(--cyan); background: rgba(103, 232, 249, .06); }

@media (min-width: 36em) {
  :root { --row: 30rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr)); gap: 1rem; }
  .card { display: flex; flex-direction: column; }
  .grid-auto .card { min-height: 0; }
  .cimg { flex: none; height: 14rem; min-height: 0; }
  .cbody { flex: 1; gap: .35rem; padding: .9rem 1rem 1rem; }
  .cbody h3 { font-size: 1.08rem; max-height: 2.8rem; }
  .cid { font-size: .72rem; letter-spacing: 0; }
  .cdesc { font-size: .88rem; line-height: 1.45; -webkit-line-clamp: 3; }
  .cloc { font-size: .8rem; }
}

/* ---- detail pages ---- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: .25rem 0 1rem; }
.back { display: inline-flex; align-items: center; gap: .25rem; min-height: 2.5rem; padding: 0 .8rem .0 .5rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--panel); cursor: pointer; font-size: .9rem; }
.back:hover { border-color: var(--line-2); }
.trail { display: inline-flex; flex-wrap: wrap; gap: .45rem; font-size: .85rem; color: var(--muted); }
.trail a:hover, .facts a:hover { color: var(--cyan); }
.detail { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); margin-bottom: 2rem; }
.dportrait { border: 1px solid var(--line-2); border-radius: 1rem; overflow: hidden; background: #08050e; box-shadow: 0 1.2rem 2.5rem -1.5rem rgba(124, 58, 237, .6); aspect-ratio: 5 / 6; max-width: 26rem; width: 100%; }
.dportrait.square { aspect-ratio: 1 / 1; }
.dportrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dinfo { min-width: 0; }
.dinfo h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.12; font-weight: 700; }
.dinfo h1:focus { outline: none; }
.idline { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .6rem 0 1rem; }
.cid.big { font-size: .82rem; }
.chip { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 .85rem; border: 1px solid var(--line-2); border-radius: 2rem; background: var(--panel); font-size: .8rem; cursor: pointer; }
.chip:hover { border-color: var(--cyan); }
.lead { font-size: 1.05rem; line-height: 1.6; max-width: 62ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .6rem; margin: 1.25rem 0; }
.facts > div { min-width: 0; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--panel); }
.facts dt { font-size: .72rem; color: var(--muted); letter-spacing: .03em; }
.facts dd { margin-top: .1rem; font-size: .92rem; overflow-wrap: anywhere; }
.starlog h2, .more h2 { font-size: 1.15rem; margin-bottom: .5rem; }
.starlog p { color: #d5cde9; max-width: 62ch; line-height: 1.65; }
.pager { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.more { margin: 1.5rem 0 2rem; }
.more h2 { margin-bottom: .8rem; }
.empty { padding: 2.5rem 0; max-width: 32rem; }
.empty h1 { font-size: 1.5rem; }
.empty p { margin: .6rem 0 1.2rem; color: var(--muted); }

@media (min-width: 52em) {
  .detail { grid-template-columns: minmax(16rem, 26rem) minmax(0, 1fr); gap: 2rem; align-items: start; }
  .dportrait { position: sticky; top: calc(var(--head) + 1rem); }
}

/* ---- search sheet ---- */
.sheet { position: fixed; inset: 0; z-index: 60; overflow-y: auto; overscroll-behavior: contain; background: rgba(3, 1, 8, .9); padding: max(.75rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) max(.75rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left)); }
.sheet-in { max-width: 44rem; margin: 0 auto; padding: .9rem; background: var(--panel); border: 1px solid var(--line-2); border-radius: 1rem; box-shadow: 0 2rem 4rem -1rem rgba(0, 0, 0, .9); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; }
.seg { display: inline-flex; padding: .2rem; border: 1px solid var(--line); border-radius: .8rem; background: #07040d; min-width: 0; }
.seg button { min-height: 2.4rem; padding: 0 .85rem; border: 0; border-radius: .6rem; background: transparent; color: var(--muted); cursor: pointer; font-size: .88rem; }
.seg button[aria-selected="true"] { background: linear-gradient(180deg, #8a1634, #5c0f25); color: #fff; }
.field { display: flex; align-items: center; gap: .6rem; padding: 0 .85rem; border: 1px solid var(--line-2); border-radius: .8rem; background: #07040d; }
.field:focus-within { border-color: var(--cyan); }
.field input { flex: 1; min-width: 0; height: 3rem; border: 0; background: transparent; outline: 0; font-size: 1rem; }
.field input::placeholder { color: #7e7596; }
.hint { margin: .5rem .1rem .8rem; font-size: .8rem; color: var(--muted); }
.gh { margin: 1rem 0 .4rem; font-size: .85rem; font-weight: 600; color: var(--violet); }
.results { display: grid; gap: .45rem; }
.res { display: flex; gap: .75rem; align-items: center; padding: .55rem; border: 1px solid var(--line); border-radius: .75rem; background: #0a0612; }
.res:hover { border-color: var(--cyan); }
.res img { width: 3.25rem; height: 3.25rem; flex: none; object-fit: cover; border-radius: .55rem; background: #1a0f2e; }
.res-main { display: flex; flex-direction: column; min-width: 0; gap: .05rem; }
.res-main strong { font-weight: 600; font-size: .95rem; overflow-wrap: anywhere; }
.res-main .mono { font-size: .68rem; color: #86e3ef; }
.res-sub { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.msg { margin: .8rem .1rem; color: var(--muted); font-size: .88rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.link { background: none; border: 0; padding: .4rem 0; color: var(--violet); text-decoration: underline; cursor: pointer; font-size: .82rem; }
.pref { margin-top: 1rem; font-size: .82rem; color: var(--muted); }
.pref input { accent-color: var(--purple); margin-right: .4rem; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + .8rem); transform: translateX(-50%); z-index: 70; padding: .6rem 1rem; border: 1px solid var(--line-2); border-radius: 2rem; background: #12091f; font-size: .85rem; }

/* ---- larger screens: tabs move into the header ---- */
@media (min-width: 40em) {
  body { padding-bottom: 0; }
  .top-in { display: grid; grid-template-columns: 1fr auto 1fr; }
  .top-in .icon-btn { justify-self: end; }
  .tabs { position: static; display: inline-flex; gap: .3rem; background: transparent; border: 0; padding: 0; }
  .tabs a { flex-direction: row; gap: .45rem; min-height: 2.5rem; padding: 0 .9rem; border-radius: .7rem; font-size: .9rem; }
  .tabs a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--red); background: rgba(125, 18, 48, .18); border-radius: .7rem .7rem 0 0; }
  .tabs svg { width: 1.1rem; height: 1.1rem; }
  .toast { bottom: 1.2rem; }
  .view { padding-top: 1.5rem; }
}
@media (max-width: 22rem) {
  .logo { letter-spacing: .16em; font-size: .82rem; }
  .seg button { padding: 0 .55rem; font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
