:root {
  color-scheme: dark;
  font: 16px/1.5 Inter, system-ui, sans-serif;
  color: #f4f1fc;
  background: #080910;
  --surface: #141422;
  --raised: #1e1b31;
  --line: #312e47;
  --muted: #b8b5cd;
  --accent: #c9b2ff;
  --card-highlight: #8068b1;
  --ink: #140b27;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .62; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button, a, input, select { scroll-margin: 1.25rem; }
input, select { min-width: 0; max-width: 100%; color: inherit; background: #11111e; border: 1px solid #494464; border-radius: 9px; }
input { min-height: 49px; width: 100%; padding: .68rem .85rem; }
input::placeholder { color: #9793b3; }
select { padding: .45rem .65rem; }
label { display: block; color: #e7e1f8; font-size: .86rem; font-weight: 650; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }

.skip-link { position: absolute; inset: .7rem auto auto 1rem; transform: translateY(-180%); padding: .6rem 1rem; background: var(--accent); color: var(--ink); z-index: 2; }
.skip-link:focus { transform: translateY(0); }
.topbar { background: #0c0c15; border-bottom: 1px solid var(--line); }
.topbar-inner, .layout, .footer { width: min(1180px, calc(100% - 3rem)); margin-inline: auto; }
.topbar-inner { min-height: 74px; display: flex; align-items: center; }
.wordmark { display: inline-flex; gap: .65rem; align-items: center; color: #f6f1ff; text-decoration: none; font-size: 1.12rem; font-weight: 780; letter-spacing: -.035em; }
.wordmark-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--ink); background: var(--accent); font-size: .78rem; }
.wordmark-place { margin-left: .32em; color: var(--accent); }

.layout { min-height: 70vh; padding: 2rem 0 3.2rem; }
.hero, .show-banner {
  position: relative;
  display: flex;
  align-items: end;
  isolation: isolate;
  overflow: hidden;
  min-height: clamp(270px, 35vw, 440px);
  padding: clamp(1.25rem, 5vw, 4rem);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: radial-gradient(ellipse at 84% 10%, #27375e, transparent 65%),
              radial-gradient(ellipse at 58% 80%, #3a235d, #141021 72%);
}
.hero-cover { position: absolute; inset: 0; z-index: -2; }
.hero-cover::after {
  position: absolute; inset: 0; content: '';
  background: linear-gradient(90deg, #090912f8, #100d20de 31%, #14112354 75%),
              linear-gradient(0deg, #0e0d1af5, transparent 58%);
}
.hero-cover .cover-image { object-position: center 38%; }
.hero-content { max-width: min(660px, 100%); }
#hero-action:not(:empty) { margin-top: 1.25rem; }
#hero-action .accent-button { padding-inline: 1.2rem; }
.show-banner { min-height: clamp(190px, 29vw, 340px); margin-top: .8rem; }
.show-banner h2 { font-size: clamp(2rem, 5vw, 3.65rem); line-height: 1.06; letter-spacing: -.052em; }
.kicker { color: var(--accent); font-size: .72rem; font-weight: 780; letter-spacing: .16em; }
.hero h1 { margin: .28rem 0 .35rem; font-size: clamp(2.25rem, 6vw, 4.5rem); line-height: 1.02; letter-spacing: -.07em; }
.intro { color: #dfd9ee; max-width: 56ch; font-size: clamp(.94rem, 2vw, 1.12rem); }
.form-row { max-width: 620px; display: flex; align-items: end; gap: .65rem; margin-top: 1.35rem; }
.input-wrap { flex: 1; min-width: 0; }
.input-wrap label { margin-bottom: .3rem; }
.accent-button, .plain-button { min-height: 44px; padding: .56rem .84rem; border: 1px solid #494464; border-radius: 9px; color: #f0eafd; background: #222039; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; text-align: center; text-decoration: none; font-size: .87rem; font-weight: 700; }
.accent-button { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.accent-button:hover { background: #dfceff; }
.plain-button:hover { background: #2e294a; }
.form-row .plain-button { min-height: 49px; }

.categories { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.45rem 0 0; }
.category-button { min-height: 41px; padding: .46rem .72rem; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--muted); font-size: .85rem; font-weight: 650; }
.category-button:hover { color: #f7f3ff; border-color: #8674bd; }
.category-button[aria-pressed="true"] { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.section-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: .2rem .9rem; margin: 1.95rem 0 .8rem; }
.section-head h2 { font-size: 1.3rem; letter-spacing: -.025em; }
.section-head p, #variant-detail { color: var(--muted); font-size: .87rem; }
.notice { padding: .8rem .95rem; border: 1px solid #686047; border-radius: 9px; background: #302c20; color: #f1ddb1; margin-bottom: .9rem; font-size: .91rem; }
.notice ul { margin: 0; padding-left: 1.15rem; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 235px), 1fr)); gap: .9rem; }
.more-library { display: flex; margin: 1rem auto 0; }
.media-card-slot { display: grid; min-width: 0; }
.media-card { position: relative; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card-preview {
  display: none;
  position: absolute;
  inset: calc(100% - .5rem) -1px auto;
  padding: .35rem .9rem .95rem;
  border: 1px solid var(--card-highlight);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
  box-shadow: 0 16px 24px -12px #000b;
  color: var(--muted);
  font-size: .85rem;
}
.card-preview p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow: hidden;
  line-height: 1.5;
}
.media-card-slot:has(:focus-visible) { z-index: 1; }
.media-card:has(:focus-visible) { border-color: var(--card-highlight); }
.media-card:has(:focus-visible) > .card-preview { display: block; }
@media (hover: hover) and (pointer: fine) {
  .media-card { transition: transform 170ms ease-out, border-color 170ms ease-out, box-shadow 170ms ease-out; }
  .media-card-slot:hover { z-index: 2; }
  .media-card-slot:hover > .media-card {
    transform: translateY(-8px) scale(1.035);
    border-color: var(--card-highlight);
    box-shadow: 0 12px 24px #0008;
  }
  .media-card-slot:hover .card-preview { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .media-card { transition: none; }
  .media-card-slot:hover > .media-card { transform: none; }
}
.card-top, .episode-frame {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: .5rem;
  aspect-ratio: 16 / 9;
  padding: .7rem .85rem;
  overflow: hidden;
  background: linear-gradient(144deg, #39265f, #1b2749 57%, #130f23);
}
.card-top::after { content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(0deg, #0a0a14db, transparent 48%); }
.media-card .card-top { border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.media-card[data-category="series"] .card-top { background: linear-gradient(145deg, #372664, #1a284b); }
.media-card[data-category="animes"] .card-top { background: linear-gradient(155deg, #533069, #29244e); }
.cover-image { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.cover-ready { opacity: 1; }
.card-category, .file-quality { font-size: .77rem; font-weight: 760; }
.file-quality { color: #f7f4ff; background: #110f21e5; padding: .2rem .42rem; border-radius: 5px; overflow-wrap: anywhere; text-align: right; }
.card-progress { position: absolute; inset: auto 0 0; width: 100%; height: 3px; accent-color: var(--accent); }
.card-body { padding: .8rem .9rem .9rem; display: flex; flex-direction: column; gap: .42rem; }
.card-body h3 { font-size: 1.01rem; letter-spacing: -.02em; }
.card-meta { color: var(--muted); font-size: .82rem; }
.card-body > button { align-self: start; margin-top: .28rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .28rem; }
.card-actions button { max-width: 100%; overflow-wrap: anywhere; }
.episode-list { display: grid; gap: .7rem; }
.episode-card {
  display: grid; grid-template-columns: clamp(100px, 20vw, 220px) minmax(0, 1fr) auto;
  align-items: center; gap: clamp(.6rem, 2vw, 1.4rem);
  padding: .65rem; padding-right: clamp(.65rem, 2vw, 1.25rem);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.episode-frame { border-radius: 9px; padding: 0; }
.episode-description h4 { margin: 0; overflow-wrap: anywhere; }
.episode-number { color: var(--muted); font-size: .82rem; }
.episode-card .accent-button { max-width: 100%; }
.autoplay-option input { width: 1rem; min-height: auto; accent-color: var(--accent); }
.next-note { display: flex; align-items: center; justify-content: space-between; gap: .7rem; flex-wrap: wrap;
  margin-top: .8rem; padding: .65rem .8rem; background: var(--raised); border-radius: 9px; }
#show-detail { margin-top: 1rem; }


.player-shell { border: 1px solid var(--line); border-radius: 18px; padding: clamp(.8rem, 2vw, 1.3rem); background: var(--surface); margin-bottom: 1.2rem; }
.player-heading { display: flex; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; align-items: center; margin-bottom: .8rem; }
.player-heading h2 { font-size: clamp(1.2rem, 3vw, 1.75rem); line-height: 1.2; }
#video { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 66vh; border-radius: 9px; background: black; }
.playback-actions { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: .75rem; }
.seek-controls { display: flex; gap: .5rem; }
.seek-button { min-width: 4.7rem; min-height: 44px; }
.seek-button span { font-size: 1.1em; }
.player-synopsis { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.player-synopsis h3 { margin-bottom: .3rem; font-size: .88rem; }
.player-synopsis p, .show-synopsis { max-width: 63ch; line-height: 1.55; overflow-wrap: anywhere; }
.player-synopsis p { color: var(--muted); white-space: pre-line; }
.show-synopsis { margin-top: .7rem; }
.player-options { margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--line); display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; }
.player-options label { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.download-action { margin-left: auto; padding: .55rem 0; color: var(--muted); text-decoration: underline; text-underline-offset: .2rem; }
.player-shell .notice { margin: .8rem 0 0; }
.footer { display: flex; justify-content: space-between; gap: .6rem; padding: 1rem 0 1.4rem; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }

@media (max-width: 590px) {
  .topbar-inner, .layout, .footer { width: calc(100% - 1.35rem); }
  .topbar-inner { min-height: 56px; }
  .layout { padding-top: .8rem; }
  .hero { border-radius: var(--radius); }
  .form-row { flex-wrap: wrap; }
  .input-wrap { flex-basis: 100%; }
  .form-row > button { min-height: 44px !important; }
  .section-head { align-items: start; flex-direction: column; }
  .download-action { margin-left: 0; }
  .episode-card { grid-template-columns: 112px minmax(0, 1fr); }
  .episode-card .accent-button { grid-column: 2; justify-self: start; }
  .hero-cover::after { background: linear-gradient(0deg, #100d20fa, #14112368); }

}
