:root {
  color-scheme: dark;
  --background: #0c0e12;
  --surface: #14171d;
  --surface-raised: #1a1e26;
  --text: #f0eee8;
  --muted: #a7acb7;
  --border: #2b303a;
  --accent: #d5a84c;
  --accent-strong: #f1c86d;
  --poe1: #b7733f;
  --poe2: #6b8fbd;
  --both: #8c71b8;
  --shadow: 0 12px 32px rgb(0 0 0 / 24%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #f4f1e9;
  --surface: #fffdf8;
  --surface-raised: #ffffff;
  --text: #202126;
  --muted: #626873;
  --border: #d9d3c6;
  --accent: #8d5f13;
  --accent-strong: #70490b;
  --poe1: #98532c;
  --poe2: #466b9a;
  --both: #725397;
  --shadow: 0 12px 30px rgb(61 46 20 / 10%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 300px;
  background: var(--background);
  color: var(--text);
  line-height: 1.55;
}

a { color: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.25rem;
  min-height: 68px;
  padding: 0 4vw;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  width: fit-content;
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--accent) 65%, var(--border));
  border-radius: 8px;
  color: var(--accent-strong);
  font-family: Georgia, serif;
}

nav { display: flex; gap: .35rem; }

nav a {
  padding: .5rem .72rem;
  border-radius: 7px;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 650;
  text-decoration: none;
}

nav a:hover,
nav a[aria-current="page"] { background: var(--surface-raised); color: var(--text); }

.theme-toggle {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .48rem .7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

main, footer { width: min(1180px, 92vw); margin-inline: auto; }
main { padding-top: clamp(1.4rem, 3.5vw, 2.6rem); }

.hero { max-width: 760px; padding: clamp(3.5rem, 8vw, 7rem) 0 2rem; }

.eyebrow {
  margin: 0 0 .8rem;
  color: var(--accent-strong) !important;
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .85rem; font: 700 clamp(2.3rem, 6vw, 4.8rem)/1.02 Georgia, serif; letter-spacing: -.035em; }
.hero > p:last-child { max-width: 650px; color: var(--muted); font-size: 1.08rem; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.section-heading h1 { margin: 0; font: 700 clamp(1.75rem, 4vw, 2.5rem)/1.1 Georgia, serif; letter-spacing: -.025em; }
.section-heading p { margin: 0; color: var(--muted); font-size: .82rem; }

.episode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.15rem; }
.series-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.15rem; }

.episode-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.series-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.series-card-body { padding: 1rem 1.05rem 1.15rem; }
.series-card h2 { margin-bottom: .35rem; font-size: 1.12rem; line-height: 1.3; }
.series-card h2 a { text-decoration: none; }
.series-card h2 a:hover { color: var(--accent-strong); }
.series-latest { margin: 0; color: var(--muted); font-size: .83rem; }
.back-link { display: inline-block; margin-bottom: 1.2rem; color: var(--muted); font-size: .86rem; text-decoration: none; }
.back-link:hover { color: var(--text); }
.series-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.5rem; }
.series-title-row h1 { margin-bottom: .35rem; font-size: clamp(2rem, 5vw, 3.5rem); }
.playlist-link { flex: 0 0 auto; text-decoration: none; }
.series-episode-list { display: grid; gap: .75rem; }
.series-episode { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 1rem; padding: .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.series-episode-thumb { position: relative; display: block; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 7px; background: var(--surface-raised); }
.series-episode-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.series-episode h2 { margin-bottom: .45rem; font-size: 1rem; line-height: 1.35; }
.series-episode h2 a { text-decoration: none; }
.series-episode h2 a:hover { color: var(--accent-strong); }

.thumbnail {
  position: relative;
  flex: 0 0 auto;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-raised);
}

.thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 180ms ease; }
.episode-card:hover .thumbnail img { transform: scale(1.025); }
.thumbnail-fallback { display: grid; height: 100%; place-items: center; color: var(--muted); }

.runtime {
  position: absolute;
  right: .6rem;
  bottom: .55rem;
  padding: .18rem .4rem;
  border-radius: 5px;
  background: rgb(8 9 12 / 88%);
  color: #fff;
  font-size: .73rem;
  font-weight: 700;
}

.episode-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 1rem 1.05rem 1.15rem;
}
.meta { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; color: var(--muted); font-size: .75rem; }

.game-badge { padding: .14rem .4rem; border: 1px solid currentColor; border-radius: 4px; font-weight: 750; }
.game-poe1 { color: var(--poe1); }
.game-poe2 { color: var(--poe2); }
.game-both { color: var(--both); }

.episode-card h3 { margin-bottom: .45rem; font-size: 1.03rem; line-height: 1.35; }
.episode-card h3 a { text-decoration: none; }
.episode-card h3 a:hover { color: var(--accent-strong); }
.channel { margin-bottom: .65rem; color: var(--accent-strong); font-size: .8rem; font-weight: 650; }
.description { margin-bottom: 0; color: var(--muted); font-size: .86rem; }

.episode-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .65rem;
}

.episode-detail-header .channel {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-tabs {
  flex: 0 0 auto;
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
}

.episode-tabs button {
  padding: .17rem .42rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
}

.episode-tabs button:hover { color: var(--text); }
.episode-tabs button[aria-pressed="true"] { background: var(--surface-raised); color: var(--text); }
.episode-panel[hidden] { display: none; }
.topics-panel {
  display: flex;
  flex: 1 1 8rem;
  min-height: 8rem;
}

.topic-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0 .25rem 0 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: var(--border) transparent;
  scrollbar-width: thin;
}

.topic-list li + li { margin-top: .22rem; }
.topic-list a {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr);
  gap: .5rem;
  padding: .16rem .25rem;
  border-radius: 4px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.3;
  text-decoration: none;
}
.topic-list a:hover { background: var(--surface-raised); color: var(--text); }
.topic-list time { color: var(--accent-strong); font-variant-numeric: tabular-nums; font-weight: 700; }

.empty-state {
  padding: 3rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}
.empty-state h3 { margin-bottom: .5rem; }
.empty-state p { max-width: 560px; margin: 0 auto; color: var(--muted); }

.legal-footer {
  margin-top: 4rem;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .76rem;
  text-align: center;
}
.legal-footer p { margin-bottom: .3rem; }
.legal-footer p:last-child { margin-bottom: 0; }

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 2rem;
}

.login-panel {
  width: min(430px, 100%);
  padding: clamp(1.5rem, 5vw, 2.4rem);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel .brand-mark { margin-bottom: 1.5rem; }
.login-panel h1 { margin-bottom: .65rem; font-size: clamp(2rem, 9vw, 3rem); }
.login-panel > p:not(.eyebrow, .form-error) { color: var(--muted); }
.login-form { display: grid; gap: .65rem; margin-top: 1.5rem; }
.login-form label { font-size: .82rem; font-weight: 700; }
.login-form input {
  width: 100%;
  padding: .72rem .8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--background);
  color: var(--text);
  font: inherit;
}
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }

.button-primary, .button-secondary, .review-actions button {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .58rem .78rem;
  color: var(--text);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.button-primary { margin-top: .4rem; border-color: var(--accent); background: var(--accent); color: #17120a; }
.button-secondary { background: var(--surface); }
.form-error, .form-notice { padding: .7rem .8rem; border-radius: 7px; font-size: .85rem; }
.form-error { border: 1px solid #9f4d4d; background: rgb(159 77 77 / 14%); color: #f0aaaa; }
.form-notice { border: 1px solid #4f8a65; background: rgb(79 138 101 / 14%); color: #a8dfbb; }

.admin-header-actions { justify-self: end; display: flex; align-items: center; gap: .55rem; }
.admin-header-actions form { display: flex; }
.admin-hero { padding-bottom: 1.5rem; }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, 92vw);
  margin: 0 auto;
  padding: 2.2rem 0 1.4rem;
  border-bottom: 1px solid var(--border);
}
.admin-header .eyebrow { margin-bottom: .35rem; }
.admin-header h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.2rem); }
.admin-main { padding: 1.5rem 0 4rem; }
.review-list { display: grid; gap: 1rem; }
.review-card {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.review-thumbnail { position: relative; display: block; min-height: 180px; background: var(--surface-raised); }
.review-thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; }
.review-content { min-width: 0; padding: 1.15rem 1.25rem; }
.review-content h2 { margin-bottom: .35rem; font-size: 1.15rem; line-height: 1.35; }
.review-content h2 a { text-decoration: none; }
.review-content h2 a:hover { color: var(--accent-strong); }
.review-reason { margin-bottom: .55rem; color: var(--muted); font-size: .84rem; }
.duplicate-warning { margin-bottom: .65rem; padding: .55rem .65rem; border: 1px solid #9b6d32; border-radius: 6px; background: rgb(155 109 50 / 12%); color: #e7c68e; font-size: .84rem; }
.duplicate-warning a { font-weight: 750; }
.state-badge { padding: .14rem .4rem; border: 1px solid var(--border); border-radius: 4px; font-weight: 750; }
.state-review { color: var(--accent-strong); }
.state-accepted { color: #8bc59f; }
.state-rejected { color: #e6a4a4; }
.state-candidate { color: var(--accent-strong); }
.state-confirmed { color: #8bc59f; }
.review-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.review-actions button { background: var(--surface-raised); }
.review-actions .accept-poe1 { border-color: var(--poe1); }
.review-actions .accept-poe2 { border-color: var(--poe2); }
.review-actions .accept-both { border-color: var(--both); }
.review-actions .reject { border-color: #985454; color: #e6a4a4; }
.review-actions button:hover, .button-secondary:hover { background: var(--border); }
.review-actions button.current { background: var(--border); color: var(--text); cursor: default; opacity: .72; }
.review-actions button:disabled { cursor: default; }

.series-admin-list { display: grid; gap: 1rem; }
.series-admin-card { padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.series-admin-summary { display: grid; grid-template-columns: minmax(160px, 240px) 1fr; gap: 1rem; }
.series-admin-summary img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 7px; }
.series-admin-summary h2 { margin-bottom: .3rem; font-size: 1.15rem; }
.series-admin-form { display: grid; grid-template-columns: 2fr 1.35fr .7fr .8fr auto auto; align-items: end; gap: .7rem; margin-top: 1rem; }
.series-admin-form label { display: grid; gap: .3rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.series-admin-form input:not([type="checkbox"]), .series-admin-form select { min-width: 0; width: 100%; padding: .55rem .6rem; border: 1px solid var(--border); border-radius: 7px; background: var(--background); color: var(--text); font: inherit; }
.series-admin-form .checkbox-label { display: flex; align-items: center; align-self: center; gap: .4rem; max-width: 160px; }
.series-admin-form .button-primary { margin: 0; }

@media (max-width: 850px) {
  .site-header { grid-template-columns: 1fr auto; padding-block: .7rem; }
  nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; overflow-x: auto; }
  .theme-toggle { grid-column: 2; grid-row: 1; }
  .admin-header-actions { grid-column: 2; grid-row: 1; }
  .admin-header-actions .theme-toggle { grid-column: auto; grid-row: auto; }
  .episode-grid { grid-template-columns: repeat(2, 1fr); }
  .series-grid { grid-template-columns: repeat(2, 1fr); }
  .series-admin-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 570px) {
  .brand > span:last-child, .theme-label { display: none; }
  .site-header { gap: .5rem; }
  nav { justify-content: flex-start; }
  nav a { flex: 1 0 auto; text-align: center; }
  .episode-grid { grid-template-columns: 1fr; }
  .series-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .review-card { grid-template-columns: 1fr; }
  .review-thumbnail { aspect-ratio: 16 / 9; min-height: 0; }
  .review-actions button { flex: 1 1 calc(50% - .5rem); }
  .series-title-row { align-items: flex-start; flex-direction: column; }
  .series-episode, .series-admin-summary, .series-admin-form { grid-template-columns: 1fr; }
}

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