/* Book Club v0.2 — restrained reading-room refinement.
   Existing styles.css holds the original component dimensions.
   This layer sets the design tokens, dark palette, typography and layout.
*/
:root {
  --serif: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --sans: 'Avenir Next', Avenir, 'Segoe UI', system-ui, sans-serif;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #19251f;
  --cream: #26372d;
  --ink: #f1ebdd;
  --muted: #b4beae;
  --line: #415247;
  --green: #a8c8ae;
  --green-deep: #d2ddc4;
  --terracotta: #d99a7b;
  --orange: #ddbd8e;
  --sage: #314638;
  --shadow: 0 19px 48px rgba(5, 14, 10, .18);
}
html[data-theme="light"] { color-scheme: light; }
body { font-size: 16px; line-height: 1.5; }
body::before { opacity: .12; }
button, input, select { font-family: var(--sans); }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible {
  outline: 2px solid var(--terracotta); outline-offset: 3px;
}
.eyebrow { font-size: 12px; letter-spacing: 2px; }
.section-sub, .page-head p { font-size: 15px; line-height: 1.6; }
.brand-text { letter-spacing: -1px; }
.brand-text small { font-size: 10px; }
.navlink,.profile { font-size: 14px; }
.theme-toggle { flex: 0 0 auto; border: 1px solid var(--line); color: var(--ink);
  background: transparent; border-radius: 50%; width: 38px; height: 38px;
  display: inline-grid; place-items: center; transition: background .2s, transform .2s; }
.theme-toggle:hover { background: var(--sage); transform: translateY(-1px); }
.welcome { grid-template-columns: 1fr; padding: 55px 0 31px; }
.welcome .lead { font-family: var(--sans); font-style: normal; font-size: 17px; line-height: 1.6; }
.welcome h1 { margin-top: 7px; margin-bottom: 10px; }
.decor-side { display: none; }
.feature-text { padding: 40px 44px; }
.feature-text p { font-size: 16px; }
.feature h2 { font-size: clamp(31px, 3.8vw, 43px); }
.pill { font-size: 11px; letter-spacing: 1.3px; }
.section-top { padding-top: 40px; }
.book-card { min-height: 194px; }
.book-card .eyebrow { font-size: 10px; }
.book-card h3 { font-size: 23px; }
.book-card .byline, .book-card .meta { font-size: 13px; }
.page-head { padding-bottom: 20px; }
.page-head p { max-width: 780px; }
.book-hero h1 { line-height: 1.12; }
.book-hero p { font-size: 15px; }
.book-meta div { font-size: 13px; }
.book-meta strong { font-size: 25px; }
.chapter-section { max-width: 890px; margin: 0 auto; }
.chapter-section .section-top { align-items: center; }
.chapter-list { max-width: 890px; padding: 4px 26px; }
.chapter-row { min-height: 83px; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 16px; }
.chapter-index { font-size: 21px; }
.chapter-title { font-size: 17px; }
.chapter-desc { font-size: 14px; margin-top: 3px; }
.chapter-length { display: none; }
.chapter-actions { gap: 9px; }
.circle-play { width: 43px; height: 43px; }
/* The player remains intentionally calm and focused. */
.player-view { padding: 29px 42px 28px; }
.player-label { margin-top: 21px; }
.player-view h1 { margin-top: 7px; }
.player-view .bookby { font-size: 15px; }
.player-view .narrator { font-size: 15px; margin-top: 5px; }
.waveform { margin: 18px auto 13px; }
.timeline { font-size: 13px; }
.controls { gap: 12px; margin: 15px auto 8px; }
.control { width: 43px; height: 43px; }
.control.main { width: 66px; height: 66px; }
.tool-select { padding: 10px 7px; font-size: 13px; min-width: 55px; font-weight: 750; }
.player-next b { font-size: 14px; }
.player-next span { font-size: 13px; }
.note-item strong { font-size: 15px; }
.note-item span, .notes-panel p { font-size: 14px; }
/* Full-width upload card, without an ornamental sidebar. */
.upload-grid { display: block; max-width: 1060px; margin: 0 auto; }
.form-card { padding: 35px 42px 39px; }
.form-card h2 { margin-bottom: 27px; }
.form-card form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; row-gap: 21px; }
.form-field { min-width: 0; margin: 0; }
.form-field label { font-size: 15px; line-height: 1.4; margin-bottom: 9px; }
.form-field input, .form-field select { font-size: 16px; padding: 15px 16px; min-height: 53px; }
.form-field small { font-size: 13px; line-height: 1.5; margin-top: 7px; }
#title-field-wrap { grid-column: 1 / -1; }
.file-field, .form-hint { grid-column: 1 / -1; }
.dropzone { padding: 35px; }
.dropzone strong { font-size: 24px; }
.dropzone p { font-size: 13px; }
.form-hint { font-size: 13px; line-height: 1.6; margin: 0; padding: 13px 16px; }
#submit-upload { grid-column: 2; justify-self: end; font-size: 15px; min-height: 48px; }
.demo-warning { font-size: 12px; }
.note-strip { font-size: 13px; }
.note-strip span:first-child { font-size: 16px; }
.primary,.secondary,button.primary,button.secondary { font-size: 14px; }
.logout-button {
  width: 38px; height: 38px; flex: 0 0 auto; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: transparent;
}
.logout-button:hover { background: var(--sage); }
.auth-shell {
  min-height: 100svh; display: grid; place-items: center; padding: 26px;
}
.auth-card {
  width: min(100%, 510px); padding: 38px 42px 30px; border: 1px solid var(--line);
  border-radius: 22px; background: var(--cream); box-shadow: var(--shadow);
}
.auth-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 38px; }
.brand-static { display: flex; align-items: center; gap: 12px; color: var(--green); }
.brand-static .brand-icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
  color: #20372b; background: #b0bb93;
}
.brand-static .brand-text { font-family: var(--serif); font-size: 27px; line-height: 1; }
.brand-static .brand-text small { display: block; margin-top: 6px; color: var(--terracotta);
  font: 800 9px var(--sans); letter-spacing: 1.7px; }
.auth-card h1 { margin: 9px 0 11px; font-size: clamp(38px, 7vw, 52px); }
.auth-intro { margin-bottom: 27px; color: var(--muted); line-height: 1.65; }
.auth-form { display: grid; grid-template-columns: 1fr; row-gap: 15px; }
.auth-form .form-field { margin: 0; }
.auth-form .primary { min-height: 49px; width: 100%; margin-top: 3px; }
.form-error { min-height: 20px; margin: 0; color: #a54937; font-size: 13px; }
.auth-foot { margin: 25px 0 0; border-top: 1px solid var(--line); padding-top: 17px;
  color: var(--muted); font-size: 12px; text-align: center; }
.account-card { max-width: 780px; margin: 0 auto; }
.account-card .auth-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.account-card .form-hint { grid-column: 1 / -1; margin: 0; }
.account-card .primary { grid-column: 2; justify-self: end; width: auto; }
html[data-theme="dark"] .auth-card, html[data-theme="dark"] .account-card {
  background: #26372d; border-color: #455a49;
}
html[data-theme="dark"] .auth-intro, html[data-theme="dark"] .auth-foot { color: #b8c6b5; }
html[data-theme="dark"] .auth-foot { border-top-color: #455a49; }
html[data-theme="dark"] .form-error { color: #f0a891; }
html[data-theme="dark"] .logout-button { color: #f1ebdd; border-color: #506454; }
html[data-theme="dark"] .logout-button:hover { background: #344b3b; }
/* ----- Forest Library, with restrained amber/terracotta highlights ----- */
html[data-theme="dark"] body {
  background: radial-gradient(ellipse at 50% -20%, #2e4132 0, #19251f 62%);
  color: var(--ink);
}
html[data-theme="dark"] .topbar { border-bottom-color: #405146; }
html[data-theme="dark"] .brand { color: #ecdfc2; }
html[data-theme="dark"] .brand-icon { background: #b0bb93; color: #20372b; }
html[data-theme="dark"] .brand-text small { color: var(--terracotta); }
html[data-theme="dark"] .navlinks { background: #25372c; border: 1px solid #394d40; }
html[data-theme="dark"] .navlink { color: #b9c6b8; }
html[data-theme="dark"] .navlink:hover { background: #344b3b; color: #f1ebdd; }
html[data-theme="dark"] .navlink.active { background: #495b48; color: #fff3dc; box-shadow: none; }
html[data-theme="dark"] .profile { background: #2b4034; color: #f1ebdd; border-color: #506454; }
html[data-theme="dark"] .avatar { background: #af866d; color: #1d2720; }
html[data-theme="dark"] .profile .avatar.karin { background: #c1c9a5; color: #26392b; }
html[data-theme="dark"] .down, html[data-theme="dark"] .demo-dot { color: #c3b18d; }
html[data-theme="dark"] .welcome .lead { color: #bccbb8; }
html[data-theme="dark"] .feature {
  background: linear-gradient(125deg, #314c3c 5%, #253b30 56%, #304136 100%);
  border: 1px solid #47604c;
}
html[data-theme="dark"] .feature::before { background: radial-gradient(ellipse at 83% 18%, #a7895640, transparent 63%); }
html[data-theme="dark"] .feature p { color: #d2d8c7; }
html[data-theme="dark"] .pill { border-color: #607661; color: #e6d6b8; background: #233c305e; }
html[data-theme="dark"] .pill .dot { background: #dca885; }
html[data-theme="dark"] .feature-art::before { background: #405544; border-color: #56694d; }
html[data-theme="dark"] .feature-art::after { color: #b99d71; }
html[data-theme="dark"] .feature-art .ring { border-color: #6b7d626e; }
html[data-theme="dark"] .primary, html[data-theme="dark"] button.primary {
  background: #d9ba83; border-color: #d9ba83; color: #26382d;
}
html[data-theme="dark"] .primary:hover, html[data-theme="dark"] button.primary:hover { background: #f1d39a; }
html[data-theme="dark"] .secondary, html[data-theme="dark"] button.secondary {
  color: #e3eddb; border-color: #657965; background: #344a3b;
}
html[data-theme="dark"] .secondary:hover, html[data-theme="dark"] button.secondary:hover { background: #435e4b; }
html[data-theme="dark"] .text-button { color: #d5e8d4; }
html[data-theme="dark"] .book-card, html[data-theme="dark"] .chapter-list,
html[data-theme="dark"] .player-view, html[data-theme="dark"] .form-card {
  background: #26372d; border-color: #455a49;
}
html[data-theme="dark"] .book-card:hover { box-shadow: 0 16px 40px #07130b55; border-color: #6a846b; }
html[data-theme="dark"] .book-card .byline, html[data-theme="dark"] .book-card .meta { color: #bcc7b7; }
html[data-theme="dark"] .book-card .progress-mini { background: #4b5b4c; }
html[data-theme="dark"] .book-card .progress-mini span { background: #d7b888; }
html[data-theme="dark"] .book-hero { background: #26382e; border-color: #465b4b; }
html[data-theme="dark"] .book-hero p { color: #c4cdbc; }
html[data-theme="dark"] .book-meta { border-top-color: #47604e; }
html[data-theme="dark"] .book-meta div { color: #b7c3b1; }
html[data-theme="dark"] .book-meta strong { color: #e9dcc0; }
html[data-theme="dark"] .crumb { color: #c4d4c2; }
html[data-theme="dark"] .chapter-row { border-bottom-color: #415747; }
html[data-theme="dark"] .chapter-index { color: #c3b393; }
html[data-theme="dark"] .chapter-desc { color: #aebfb0; }
html[data-theme="dark"] .circle-play { background: #344c3c; border-color: #657d66; color: #f2e7cf; }
html[data-theme="dark"] .circle-play:hover { background: #d9ba83; color: #26382d; }
html[data-theme="dark"] .finish-mark { color: #b8d9b5; }
html[data-theme="dark"] .player-cover-wrap::before { background: #405545; }
html[data-theme="dark"] .player-view .bookby { color: #b4c2b1; }
html[data-theme="dark"] .player-view .narrator { color: #e4af90; }
html[data-theme="dark"] .waveform i { background: #6c826d; }
html[data-theme="dark"] .waveform i.played { background: #d59b7e; }
html[data-theme="dark"] .range { accent-color: #d7b888; }
html[data-theme="dark"] .timeline { color: #b8c6b5; }
html[data-theme="dark"] .control { color: #e3e9d5; }
html[data-theme="dark"] .control:hover { background: #39533f; }
html[data-theme="dark"] .control.main { background: #d8b983; color: #26382d; }
html[data-theme="dark"] .control.main:hover { background: #f1d39a; }
html[data-theme="dark"] .tool-select { background: #344a3b; color: #f5efdf; border-color: #627962; }
html[data-theme="dark"] .player-next { border-top-color: #47604b; }
html[data-theme="dark"] .player-next span { color: #b0bead; }
html[data-theme="dark"] .notes-panel { background: #283b2e; border-color: #4a5c47; }
html[data-theme="dark"] .note-item { border-color: #4a5c47; }
html[data-theme="dark"] .form-field label { color: #e9ead6; }
html[data-theme="dark"] .form-field input, html[data-theme="dark"] .form-field select {
  background: #1a2921; color: #fff0d8; border: 1.5px solid #607763;
  box-shadow: 0 1px 0 #0002 inset;
}
html[data-theme="dark"] .form-field input::placeholder { color: #a9b9a7; }
html[data-theme="dark"] .form-field input:hover, html[data-theme="dark"] .form-field select:hover { border-color: #a3b99f; }
html[data-theme="dark"] .form-field input:focus-visible, html[data-theme="dark"] .form-field select:focus-visible {
  border-color: #dabb8b; outline-color: #dabb8b;
}
html[data-theme="dark"] .form-field select option { background: #25382d; color: #f1ebdd; }
html[data-theme="dark"] .form-field small { color: #b4c1ac; }
html[data-theme="dark"] .dropzone { background: #304437; border-color: #819a7e; }
html[data-theme="dark"] .dropzone:hover, html[data-theme="dark"] .dropzone:focus-within { background: #405b47; }
html[data-theme="dark"] .dropzone p { color: #becbb7; }
html[data-theme="dark"] .form-hint { background: #344736; color: #c9d6c2; }
html[data-theme="dark"] .form-hint strong { color: #efdfbc; }
html[data-theme="dark"] .demo-warning { background: #2c392e; border-color: #586348; color: #c4c1a9; }
html[data-theme="dark"] #toast { background: #d8b983; color: #23362b; }
html[data-theme="dark"] .note-strip span:first-child { color: #c4bda4; }
html[data-theme="dark"] .mobile-nav { background: #1d2d24f2; }
html[data-theme="dark"] .mobile-nav button { color: #adbfaa; }
html[data-theme="dark"] .mobile-nav button.selected { color: #e5c88d; }
/* The light theme stays available and receives the same spacing / form legibility improvements. */
html[data-theme="light"] .form-field input,html[data-theme="light"] .form-field select {
  border-color: #b3c3b1; background: #fffdf8; color: #273d2f;
}
html[data-theme="light"] .form-field select option { background: #fffdf8; color: #273d2f; }
html[data-theme="light"] .form-field label { color: #395845; }
html[data-theme="light"] .form-field small { color: #647866; }
html[data-theme="light"] .feature-text p { color: #405b47; }
html[data-theme="light"] .chapter-desc { color: #657865; }
/* Responsive polishing */
@media (max-width: 950px) {
  .feature-text { padding: 30px; }
  .form-card { padding: 27px; }
  .chapter-section { max-width: 100%; }
}
@media (max-width: 670px) {
  .welcome { padding: 32px 0 25px; }
  .welcome .lead { font-size: 16px; }
  .theme-toggle { width: 36px; height: 36px; }
  .nav-right { gap: 7px; }
  .logout-button { width: 34px; height: 34px; }
  .feature-text { padding: 23px 25px 27px; }
  .feature-text p { font-size: 15px; }
  .feature h2 { font-size: 32px; }
  .book-card h3 { font-size: 21px; }
  .book-card .byline, .book-card .meta { font-size: 12px; }
  .book-hero h1 { font-size: 27px; }
  .book-hero p { font-size: 13px; }
  .book-meta div { font-size: 11px; }
  .section-top { padding-top: 33px; }
  .chapter-section .section-top { flex-direction: column; align-items: flex-start; gap: 14px; }
  .chapter-list { padding: 4px 14px; }
  .chapter-row { grid-template-columns: 30px minmax(0,1fr) auto; gap: 10px; min-height: 81px; }
  .chapter-title { font-size: 15px; }
  .chapter-desc { font-size: 12px; }
  .player-view { padding: 20px 17px 23px; }
  .player-label { margin-top: 18px; }
  .player-view .bookby { font-size: 13px; }
  .controls { gap: 3px; }
  .control { width: 37px; height: 39px; }
  .control.main { width: 58px; height: 58px; }
  .control svg { width: 21px; height: 21px; }
  .control.jump svg { width: 25px; height: 25px; }
  .control.jump b { top: 13px; }
  .tool-select { font-size: 12px; padding: 9px 4px; min-width: 50px; }
  .form-card { padding: 24px 18px; }
  .form-card form { grid-template-columns: 1fr; row-gap: 18px; }
  .file-field, .form-hint, #title-field-wrap { grid-column: 1; }
  #submit-upload { grid-column: 1; justify-self: stretch; }
  .account-card .auth-form { grid-template-columns: 1fr; }
  .account-card .form-hint, .account-card .primary { grid-column: 1; }
  .account-card .primary { justify-self: stretch; }
  .auth-card { padding: 28px 23px 23px; }
  .auth-top { margin-bottom: 30px; }
  .dropzone { padding: 28px 12px; }
  .page-head p { font-size: 14px; }
  .note-strip span:last-child { font-size: 11px; }
}
@media (max-width: 360px) {
  .brand-text { font-size: 21px; }
  .theme-toggle { width: 32px; height: 32px; }
  .profile { gap: 3px; }
  .controls { gap: 1px; }
  .tool-select { min-width: 48px; padding: 8px 1px; }
}

@media (max-width: 360px) {
  .topbar { gap: 5px; }
  .brand { gap: 6px; }
  .brand-icon { width: 31px; height: 31px; border-radius: 9px; }
  .brand-icon svg { width: 20px; height: 20px; }
  .brand-text { font-size: 19px; }
  .brand-text small { font-size: 8px; letter-spacing: 1px; }
  .nav-right { gap: 4px; }
  .profile { padding: 3px; font-size: 11px; }
  .profile .avatar { width: 25px; height: 25px; font-size: 10px; }
  .logout-button { width: 29px; height: 29px; }
  .book-hero { grid-template-columns: 94px minmax(0,1fr); gap: 12px; padding: 14px; }
  .book-hero > img { width: 94px; height: 136px; }
  .book-hero h1 { font-size: 23px; overflow-wrap: break-word; }
  .control { width: 32px; height: 35px; }
  .control.main { width: 52px; height: 52px; }
  .tool-select { min-width: 45px; }
}
