/* Chapterly · Linear Graphite
   Flat graphite surfaces, restrained periwinkle accent, no gradients.
   Kept as the final CSS layer to avoid disturbing responsive layout and player logic. */
:root {
  color-scheme: dark;
  --bg: #111214;
  --sidebar: #17181b;
  --panel: #1c1d20;
  --panel2: #27282d;
  --stroke: #37383d;
  --text: #eeeff1;
  --muted: #9ea0a9;
  --accent: #9a9ff0;
  --accent-dim: #898edd;
  --warm: #b4b6e7;
  --graphite-bg: #111214;
  --graphite-nav: #17181b;
  --graphite-panel: #1c1d20;
  --graphite-lift: #27282d;
  --graphite-border: #37383d;
  --graphite-soft: #2c2d41;
  --graphite-text: #eeeff1;
  --graphite-muted: #9ea0a9;
  --graphite-accent: #9a9ff0;
}
html, body {background: var(--bg); color: var(--text)}
body {color-scheme:dark}
::selection {background:#41446f;color:#fff}
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline:2px solid var(--accent);outline-offset:3px;
}
/* Remove all legacy gradient backgrounds; illustrations/icons remain ordinary SVG. */
.hero, .hero-art-grid, .hero-record, .card-art,
.episode-card:nth-child(4n + 2) .card-art,
.episode-card:nth-child(4n + 3) .card-art,
.episode-card:nth-child(4n + 4) .card-art,
.logo-mark, .sidebar-note, .player-main>.cover,
.now-playing-sheet, .sheet-album, .player, .cover,
.resume-panel, .resume-art, .login-wrap {background-image:none!important}
.card-art::before,.card-art::after,.sheet-album::before,.sheet-album::after,
.art-stripe,.orbit,.orbit-2,.hero-art-grid,.record-ring,.ring-2 {display:none!important}
/* App chrome */
.app,.main-area,.content {background:var(--bg)}
.sidebar {background:var(--sidebar);border-right:1px solid var(--stroke)}
.topbar {background:var(--bg);border-bottom:1px solid var(--stroke)}
.crumb,.nav-label,.section-eyebrow,.eyebrow,.hero-label {color:var(--muted)}
.crumb b {color:var(--text)}
.brand strong,.welcome-heading h1,.section-heading h2 {color:var(--text)}
.brand small,.nav-count,.welcome-heading p {color:var(--muted)}
.brand-dot,.welcome-heading h1 em,.hero h1 em {color:var(--accent)}
.logo-mark {background:var(--graphite-soft);color:var(--accent);border:1px solid #464764}
.logo-mark span {color:var(--accent)}
.nav-item,.series-entry {color:var(--muted);border:1px solid transparent}
.nav-item>.icon,.series-entry>.icon {color:var(--muted)}
.nav-item:hover,.series-entry:hover {background:var(--graphite-lift);color:var(--text)}
.nav-item.active,.series-entry.active {
  background:var(--graphite-lift);border-color:var(--stroke);color:var(--text);
}
.nav-item.active>.icon,.series-entry.active>.icon {color:var(--accent)}
.sidebar-note,.sidebar-bottom {background:var(--sidebar);border-color:var(--stroke);color:var(--muted)}
.sidebar-note strong {color:var(--text)}
.sidebar-note p {color:var(--muted)}
.sidebar-note-icon {color:var(--accent)}
.online-dot {background:#9a9ff0;box-shadow:none}
.sidebar-scrim {background:#09090bcd;backdrop-filter:none}
.sidebar-toggle {color:var(--muted);border-color:var(--stroke)}
.sidebar-toggle:hover,.icon-btn:hover {background:var(--graphite-lift);color:var(--accent)}
.search, .search:focus-within {
  background:var(--graphite-panel);border-color:var(--stroke);color:var(--muted);
}
.search:focus-within {border-color:var(--accent)}
.search input,.search input::placeholder {color:var(--muted)}
.search input:focus {color:var(--text)}
.profile {background:var(--graphite-soft);color:var(--text);border:1px solid var(--stroke)}
/* Home + resume */
.welcome-heading .eyebrow,.resume-info .eyebrow,.section-eyebrow,.card-tag,
.study-panel-heading .eyebrow,.sheet-track .eyebrow {color:var(--accent)}
.resume-panel {background:var(--graphite-panel);border:1px solid var(--stroke);box-shadow:none}
.resume-art,.card-art,.player-main>.cover,.cover,.sheet-album,.card-art .art-symbol {
  background:var(--graphite-lift);color:var(--accent);border-color:var(--stroke);
}
.resume-art {border:1px solid var(--stroke)}
.resume-info strong {color:var(--text)}
.resume-info>span:not(.eyebrow) {color:var(--muted)}
.resume-progress,.card-progress,.timeline input,.sheet-progress {background:var(--graphite-lift)}
.resume-progress>div,.card-progress span {background:var(--accent)}
.text-link {color:var(--muted)}
.text-link:hover {color:var(--accent)}
.primary,.play-circle,.big-play,.card-art .play-overlay {
  background:var(--accent);color:#171823;border-color:transparent;box-shadow:none;
}
.primary:hover,.play-circle:hover,.big-play:hover,.card-art .play-overlay:hover {
  background:#b5b9fa;color:#171823;box-shadow:none;
}
.outline,.small-btn,.pill,.google-signin {
  background:var(--graphite-panel);color:var(--text);border:1px solid var(--stroke);
}
.outline:hover,.small-btn:hover,.pill:hover,.google-signin:hover {
  background:var(--graphite-lift);border-color:#535565;color:var(--text);
}
.pill.selected {background:var(--graphite-soft);color:var(--accent);border-color:#555778}
.hero {background:var(--graphite-panel);border-color:var(--stroke)}
.hero p {color:var(--muted)}
.hero-art,.hero-record {background:var(--graphite-lift)}
.hero-dot {background:var(--accent);box-shadow:none}
/* Episode library */
.episode-list{display:grid;gap:2px;max-width:930px}
.episode-card.episode-row + .episode-row{border-top:1px solid var(--stroke)}
.episode-card.episode-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) repeat(2,44px);
  align-items:center;
  min-width:0;
  padding:0;
  border:0;
  border-radius:9px;
  background:transparent;
  box-shadow:none;
  transform:none;
}
.episode-link{
  display:grid;
  grid-template-columns:36px minmax(0,1fr) max-content;
  align-items:center;
  gap:12px;
  width:100%;
  min-height:54px;
  padding:6px 12px;
  border:0;
  border-radius:inherit;
  background:transparent;
  color:var(--text);
  font:inherit;
  text-align:left;
}
.episode-link:hover,.episode-link:focus-visible{background:var(--graphite-panel)}
.episode-link:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.episode-link[aria-current=true]{background:var(--graphite-panel)}
.episode-link[aria-current=true] strong{color:var(--accent)}
.episode-icon{
  display:grid;
  place-items:center;
  width:36px;
  height:36px;
  border-radius:7px;
  background:var(--graphite-lift);
  color:var(--accent);
}
.episode-icon .icon{width:16px;height:16px}
.episode-copy{display:grid;min-width:0;gap:3px}
.episode-copy strong{
  font-size:13px;
  line-height:1.35;
  overflow-wrap:anywhere;
}
.episode-copy small,.episode-length{font-size:11px;color:var(--muted)}
.episode-length{display:grid;gap:5px;text-align:right;font-variant-numeric:tabular-nums}
.episode-progress{width:100%;min-width:26px;height:2px;border-radius:2px;background:var(--graphite-lift)}
.episode-progress>span{display:block;height:100%;border-radius:inherit;background:var(--accent)}
.welcome{margin-bottom:22px}
.resume-panel{min-height:72px;padding:10px 13px;gap:12px}
.resume-art{height:43px;width:43px}
.resume-art .icon{width:23px;height:23px}
@media(max-width:600px){
  .episode-link{grid-template-columns:32px minmax(0,1fr) max-content;gap:9px;padding-inline:6px}
  .episode-icon{width:32px;height:32px}
  .episode-copy strong{font-size:12px}
}
.empty {color:var(--muted);border-color:var(--stroke);background:var(--graphite-panel)}
/* Chapters + playlists + detail panels */
.details {border-color:var(--stroke)}
.info-panel,.chapter-panel,.dialog {
  background:var(--graphite-panel);border:1px solid var(--stroke);box-shadow:none;
}
.sub-heading,.chapter-name,.episode-stats b {color:var(--text)}
.chapter-row {border-color:var(--stroke);color:var(--text)}
.chapter-row:hover {color:var(--accent);background:var(--graphite-lift)}
.chapter-row.current,.study-chapter-list .chapter-row.current {
  background:var(--graphite-soft);color:var(--accent);
}
.chapter-index,.chapter-row.current .chapter-index {
  background:var(--graphite-lift);color:var(--muted);
}
.chapter-row.current .chapter-index {color:var(--accent)}
.chapter-time,.chapter-arrow,.episode-stats span,.muted {color:var(--muted)}
/* Mini-player */
.player {
  background:var(--graphite-nav);border-color:var(--stroke);
  box-shadow:none;color:var(--text);
}
.player-main .track-info{background:none;border:0;color:inherit;padding:0;text-align:left}
.player-main .track-info:hover strong {color:var(--accent)}
.player-controls>.icon-btn,.icon-btn {color:var(--muted)}
.player-controls>.icon-btn:hover {color:var(--text)}
.player .tiny-cover {background:var(--graphite-lift);color:var(--accent);border:1px solid var(--stroke)}
.track-info small,.speed-label,.timeline,.sync-indicator {color:var(--muted)}
.timeline input,#sheet-seek {accent-color:var(--accent)}
.skip-number {background:var(--graphite-nav);color:var(--muted)}
.player-side select,.sheet-bottom select,select,select option {
  background:var(--graphite-lift);color:var(--text);border-color:var(--stroke);
}
.sync-indicator .icon {color:var(--accent)}
/* Full-screen Now Playing + study reader */
.now-playing-sheet {background:var(--bg)}
.now-playing-inner {background:var(--bg)}
.sheet-header {
  color:var(--text);background:var(--bg);border-bottom-color:var(--stroke);backdrop-filter:none;
}
.sheet-header-muted,.sheet-timeline,.sheet-bottom,.sheet-bottom>span {color:var(--muted)}
.sheet-album {
  background:var(--graphite-lift);border:1px solid var(--stroke);
  box-shadow:none;color:var(--accent);
}
.sheet-album>.icon {color:var(--accent)}
.sheet-track h2,.study-panel-heading h3,.study-list-title {color:var(--text)}
.sheet-bottom {border-color:var(--stroke)}
.sheet-controls .icon-btn {color:var(--muted)}
.sheet-controls .icon-btn:hover {color:var(--text)}
.study-panel {background:var(--graphite-panel);border:1px solid var(--stroke);box-shadow:none}
.study-tabs {background:var(--graphite-bg);border:1px solid var(--stroke)}
.study-tab {color:var(--muted);background:transparent}
.study-tab:hover {background:var(--graphite-lift);color:var(--text)}
.study-tab.active {background:var(--graphite-soft);color:var(--accent);box-shadow:none}
.study-panel-heading .sheet-overview {color:var(--muted)}
.study-panel-heading .sheet-overview:hover {background:var(--graphite-lift);color:var(--accent)}
.script-mode-label,.auto-follow-label,.study-list-title>span {color:var(--muted)}
.script-mode-label select {background:var(--graphite-lift);border-color:var(--stroke);color:var(--text)}
.script-reader,.word-panel,.study-chapter-list {
  scrollbar-color:#505158 transparent;
}
.script-paragraph {color:#c1c2ca}
.script-paragraph:hover {background:var(--graphite-lift);color:var(--text)}
.script-paragraph.active {background:var(--graphite-soft);border-color:#50527a;color:var(--text)}
.script-section-title {color:var(--accent)}
.script-placeholder,.study-empty {background:var(--graphite-lift);color:var(--muted)}
.word-search-field,#word-search {background:var(--graphite-bg);border-color:var(--stroke);color:var(--text)}
.word-transcript button {color:#c1c2ca}
.word-transcript button.active {background:var(--accent);color:#171823}
.word-transcript button:hover {background:var(--graphite-lift);color:var(--text)}
#word-results button {background:var(--graphite-lift);border-color:var(--stroke);color:var(--text)}
.queue-row {background:var(--graphite-lift);color:var(--text);border-color:var(--stroke)}
.queue-row:hover {background:var(--graphite-soft);border-color:#50527a}
.queue-icon {background:var(--graphite-soft);color:var(--accent)}
.queue-copy small {color:var(--muted)}
/* Login + modal surfaces */
.login-wrap {background:var(--bg)}
.login-card {background:var(--graphite-panel);border-color:var(--stroke);box-shadow:none}
.login-card h1,.login-card p {color:var(--text)}
.login-card em {color:var(--accent)}
.login-card .eyebrow,.signin-foot {color:var(--muted)}
.google-g {background:#fff;color:#4285f4}
.dialog-backdrop {background:#09090be0;backdrop-filter:none}
.dialog input,.dialog select,#word-search {
  background:var(--graphite-bg);color:var(--text);border-color:var(--stroke);
}
.dialog input:focus,.dialog select:focus {border-color:var(--accent)}
/* Narrow viewports retain existing responsive geometry from v03.css. */
@media (max-width:900px){
  .sidebar{background:var(--graphite-nav)}
  .player{background:var(--graphite-nav);border-color:var(--stroke)}
}

.toast{background:var(--accent);color:#111214}

.queue-item{display:grid;grid-template-columns:minmax(0,1fr) 44px;align-items:center;gap:4px}
.queue-add,.queue-remove{width:44px;height:44px;padding:0}
.queue-add:disabled{opacity:.25;cursor:default}

.episode-more{width:44px;height:44px;padding:0}
#episode-actions{position:fixed;inset:auto;margin:0;width:180px;padding:4px;border:1px solid var(--stroke);border-radius:8px;background:var(--graphite-lift);color:var(--text)}
#episode-actions button{width:100%;min-height:42px;border:0;border-radius:5px;background:none;color:inherit;text-align:left;padding:0 8px}
#episode-actions button:hover,#episode-actions button:focus-visible{background:var(--graphite-panel)}
.queue-item{grid-template-columns:minmax(0,1fr) auto}
.queue-item-actions{display:flex;align-items:center}
.queue-move,.queue-item-actions .queue-remove{width:32px;height:44px;padding:0}
.queue-move:disabled{opacity:.24}
.queue-item:only-child .queue-move{display:none}

.episode-copy strong{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.episode-copy small{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
