/* Minimal, shadcn/ui-inspired theme (zinc). */
:root {
  --background: #ffffff; --foreground: #09090b;
  --card: #ffffff; --muted: #f4f4f5; --muted-foreground: #71717a;
  --accent: #f4f4f5; --border: #e4e4e7; --input: #e4e4e7; --ring: #a1a1aa;
  --primary: #18181b; --primary-foreground: #fafafa; --seg-on: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05); --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #09090b; --foreground: #fafafa;
    --card: #09090b; --muted: #18181b; --muted-foreground: #a1a1aa;
    --accent: #27272a; --border: #27272a; --input: #27272a; --ring: #52525b;
    --primary: #fafafa; --primary-foreground: #18181b; --seg-on: #27272a;
    --shadow-sm: none; --shadow: 0 1px 3px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --background: #09090b; --foreground: #fafafa;
  --card: #09090b; --muted: #18181b; --muted-foreground: #a1a1aa;
  --accent: #27272a; --border: #27272a; --input: #27272a; --ring: #52525b;
  --primary: #fafafa; --primary-foreground: #18181b; --seg-on: #27272a;
  --shadow-sm: none; --shadow: 0 1px 3px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--background); color: var(--foreground); }
body { font: 14px/1.5 Geist, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
       -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
svg.line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
code, kbd { font-family: "Geist Mono", ui-monospace, monospace; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--border);
       background: color-mix(in srgb, var(--background) 85%, transparent); backdrop-filter: blur(10px); }
.bar { max-width: 1400px; margin: 0 auto; height: 60px; padding: 0 24px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -.2px; font-size: 15px; flex: none; }
.mark { width: 26px; height: 26px; border-radius: 7px; background: var(--primary); color: var(--primary-foreground); display: grid; place-items: center; }
.mark svg { width: 14px; height: 14px; }

/* Tabs-style segmented switch */
.switch { display: inline-flex; padding: 3px; gap: 2px; background: var(--muted); border-radius: var(--radius); flex: none; }
.switch button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 7px;
                 font-weight: 500; font-size: 13px; color: var(--muted-foreground); transition: color .15s, background .15s, box-shadow .15s; }
.switch button:hover { color: var(--foreground); }
.switch button[aria-selected="true"] { background: var(--seg-on); color: var(--foreground); box-shadow: var(--shadow); }

.nav { display: flex; gap: 2px; min-width: 0; }
.nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted-foreground); font-weight: 500; font-size: 13px; white-space: nowrap; }
.nav a:hover { color: var(--foreground); background: var(--accent); }
.nav a.on { color: var(--foreground); }

.search { margin-left: auto; position: relative; display: flex; align-items: center; width: 260px; flex: 0 1 260px; }
.search svg { position: absolute; left: 10px; color: var(--muted-foreground); pointer-events: none; }
.search input { width: 100%; height: 36px; padding: 0 34px 0 32px; border: 1px solid var(--input); border-radius: 8px;
                background: transparent; outline: none; box-shadow: var(--shadow-sm); font-size: 13px; }
.search input::placeholder { color: var(--muted-foreground); }
.search input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { position: absolute; right: 8px; font-size: 11px; color: var(--muted-foreground); border: 1px solid var(--border);
              border-radius: 4px; padding: 0 5px; background: var(--muted); pointer-events: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
       border-radius: 8px; border: 1px solid var(--input); background: var(--background); font-weight: 500; font-size: 13px;
       box-shadow: var(--shadow-sm); white-space: nowrap; transition: background .15s; }
.btn:hover { background: var(--accent); }
.btn.icon { width: 36px; padding: 0; flex: none; }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.btn.primary:hover { opacity: .9; }
.btn.on { background: var(--accent); }
#theme .moon { display: none; }
:root[data-theme="dark"] #theme .sun { display: none; }
:root[data-theme="dark"] #theme .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme .sun { display: none; }
  :root:not([data-theme="light"]) #theme .moon { display: block; }
}

/* ---------- page ---------- */
main { max-width: 1400px; margin: 0 auto; padding: 28px 24px 40px; }
.head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
h1.page { font-size: 24px; font-weight: 600; letter-spacing: -.5px; margin: 0; }
.lede { color: var(--muted-foreground); margin: 4px 0 0; max-width: 720px; }
h3 { font-size: 14px; font-weight: 600; margin: 24px 0 10px; }

/* toggle group of categories */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 24px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
        display: inline-flex; align-items: center; font-size: 13px; font-weight: 500; color: var(--muted-foreground); }
.chip:hover { color: var(--foreground); background: var(--accent); }
.chip.on { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }

/* day timeline: date on the left, that day's cards on the right */
.day { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 24px; padding: 28px 0; border-top: 1px solid var(--border); }
.day:first-child { border-top: 0; padding-top: 4px; }
.day-label { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
.day-label b { font-size: 18px; font-weight: 600; letter-spacing: -.3px; line-height: 24px; }
.day-label span { color: var(--muted-foreground); font-size: 13px; }
.day-label .count { margin-top: 6px; font-size: 12px; }
.day .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* card grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: 12px;
        background: var(--card); overflow: hidden; box-shadow: var(--shadow-sm); transition: border-color .15s; }
.card:hover { border-color: var(--ring); }
.thumb { position: relative; aspect-ratio: 16/9; overflow: hidden; background: var(--muted); }
.thumb > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.art .blur { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(30px); opacity: .55; }
.thumb.art img.sq { position: absolute; top: 14%; left: 50%; transform: translateX(-50%); width: 40.5%; height: 72%;
                    border-radius: 8px; object-fit: cover; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.badge { position: absolute; right: 8px; bottom: 8px; background: rgba(9,9,11,.75); color: #fafafa; font: 500 11px/1 "Geist Mono", monospace;
         padding: 4px 6px; border-radius: 5px; backdrop-filter: blur(4px); }
.badge.new { left: 8px; right: auto; background: #fafafa; color: #09090b; font-family: inherit; font-weight: 600; letter-spacing: .3px; }
.progress { position: absolute; left: 0; bottom: 0; height: 3px; background: #fafafa; }
.later-btn { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 7px;
             background: rgba(9,9,11,.75); color: #fafafa; display: none; place-items: center; backdrop-filter: blur(4px); }
.card:hover .later-btn, .later-btn:focus-visible, .later-btn.on { display: grid; }
.info { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; flex: 1; }
.src-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted-foreground); font-weight: 500; min-width: 0; }
.src-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 20px; height: 20px; border-radius: 6px; flex: none; display: grid; place-items: center; overflow: hidden;
          font-size: 11px; font-weight: 600; background: var(--muted); color: var(--foreground); border: 1px solid var(--border); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.vt { margin: 0; font-size: 14px; font-weight: 500; line-height: 20px; letter-spacing: -.1px;
      display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; font-size: 12px; color: var(--muted-foreground); flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border: 1px solid var(--border); border-radius: 999px;
       font-size: 11px; font-weight: 500; color: var(--foreground); }
.sub { color: var(--muted-foreground); font-size: 13px; }
.more { text-align: center; padding: 32px; color: var(--muted-foreground); }
.empty { padding: 80px 20px; text-align: center; color: var(--muted-foreground); border: 1px dashed var(--border); border-radius: 12px; }
.empty a { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- watch / episode ---------- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; }
.frame { aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--border); }
.frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.w-title { font-size: 20px; font-weight: 600; letter-spacing: -.3px; margin: 16px 0 12px; line-height: 28px; }
.w-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
         padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.w-src { display: flex; align-items: center; gap: 10px; }
.w-src .avatar { width: 36px; height: 36px; border-radius: 9px; font-size: 14px; }
.w-src b { font-weight: 600; display: block; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.desc { margin-top: 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 22px; font-size: 14px; }
.desc.clamp { max-height: 132px; overflow: hidden; cursor: pointer;
              -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.desc a { text-decoration: underline; text-underline-offset: 3px; color: var(--muted-foreground); }
.desc .dmeta { font-weight: 500; margin-bottom: 8px; display: block; color: var(--muted-foreground); }
.ep-hero { display: grid; grid-template-columns: 200px minmax(0,1fr); gap: 24px; align-items: end; padding-bottom: 20px; }
.ep-hero img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.ep-hero .w-title { margin: 6px 0; font-size: 24px; line-height: 30px; }
.up { display: flex; flex-direction: column; gap: 4px; }
.up h3 { margin: 0 0 8px; }
.mini { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 12px; padding: 6px; margin: 0 -6px; border-radius: 10px; }
.mini:hover { background: var(--accent); }
.mini .thumb { border-radius: 8px; }
.mini .vt { font-size: 13px; line-height: 18px; margin-bottom: 4px; }
.mini .sub { font-size: 12px; line-height: 17px; }

/* sources / about */
.src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.src { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 10px; border: 1px solid var(--border); }
.src:hover { background: var(--accent); }
.src .avatar { width: 40px; height: 40px; border-radius: 9px; font-size: 15px; }
.src b { display: block; font-weight: 500; }
.rules { max-width: 720px; line-height: 1.7; font-size: 14px; }
.rules ul { padding-left: 18px; }
.rules li { margin: 6px 0; }
.rules code { background: var(--muted); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.foot { max-width: 1400px; margin: 0 auto; padding: 0 24px 110px; color: var(--muted-foreground); font-size: 12px; }

/* ---------- audio player ---------- */
.player { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30; width: min(920px, calc(100% - 32px));
          background: var(--background); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18);
          display: flex; align-items: center; gap: 12px; padding: 8px 10px; }
.player[hidden] { display: none; }
.player img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; border: 1px solid var(--border); }
.pl-meta { min-width: 0; flex: 0 1 260px; }
.pl-meta a { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.pl-meta div { color: var(--muted-foreground); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player audio { flex: 1; min-width: 0; height: 36px; }
.player select { border: 1px solid var(--input); background: var(--background); border-radius: 8px; height: 32px; padding: 0 6px; font-size: 12px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 40; background: var(--background); color: var(--foreground);
         border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 12px 16px; border-radius: 10px;
         font-weight: 500; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
body.has-player .toast { bottom: 96px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .watch { grid-template-columns: minmax(0, 1fr); }
  .nav a[data-nav="about"] { display: none; }
}
@media (max-width: 980px) {
  .bar { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 10px 12px; }
  .search { order: 3; flex: 1 1 100%; width: auto; margin-left: 0; }
  .search kbd { display: none; }
  .nav { order: 4; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a[data-nav="about"] { display: inline; }
  #theme { margin-left: auto; }
  main { padding: 20px 16px 40px; }
  .foot { padding: 0 16px 110px; }
}
@media (max-width: 760px) {
  .day { grid-template-columns: 1fr; gap: 14px; padding: 20px 0; }
  .day-label { position: static; flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .day-label .count { margin: 0 0 0 auto; }
}
@media (max-width: 560px) {
  .brand > span:last-child { display: none; }
  .switch button { padding: 0 10px; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .ep-hero { grid-template-columns: 1fr; }
  .ep-hero img { max-width: 180px; }
  .mini { grid-template-columns: 128px minmax(0,1fr); }
  .pl-meta, .player select { display: none; }
}
