:root {
  color-scheme: light;
  --bg: #fcf9f4;
  --surface: #fffcf8;
  --surface-soft: #fbf4ec;
  --surface-muted: #f0eee6;
  --text: #272d30;
  --text-muted: #656d69;
  --jade: #6f907f;
  --jade-deep: #4f7061;
  --jade-mid: #879f8f;
  --jade-light: #95ab9b;
  --jade-soft: #eaf0eb;
  --border: #d9dbd4;
  --peach: #e79b81;
  --peach-strong: #bc674f;
  --peach-soft: #fdf3eb;
  --danger: #a65e53;
  --shadow: rgba(50, 45, 40, 0.08);
  --radius-lg: 32px;
  --radius-md: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 5%, rgba(231, 155, 129, 0.08), transparent 26rem),
    radial-gradient(circle at 96% 22%, rgba(149, 171, 155, 0.14), transparent 24rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  width: min(100% - 48px, 1240px);
  margin: 0 auto;
}

.site-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--jade);
  box-shadow: inset -7px 0 rgba(255, 252, 248, 0.18);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  top: 9px;
  width: 7px;
  height: 16px;
  border: 1.5px solid var(--surface);
}

.brand-mark::before {
  left: 8px;
  border-radius: 5px 0 0 3px;
  border-right: 0;
}

.brand-mark::after {
  right: 8px;
  border-radius: 0 5px 3px 0;
  border-left: 0;
}

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  background: rgba(255, 252, 248, 0.78);
  font-size: 0.77rem;
  font-weight: 700;
}

.sync-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--peach);
  box-shadow: 0 0 0 4px rgba(231, 155, 129, 0.14);
}

.sync-state[data-state="ready"] .sync-dot {
  background: var(--jade);
  box-shadow: 0 0 0 4px rgba(111, 144, 127, 0.14);
}

.sync-state[data-state="error"] .sync-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(166, 94, 83, 0.13);
}

.dashboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 48px;
  padding: 56px 4px 34px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--jade-deep);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.3;
  text-transform: uppercase;
}

.eyebrow.light {
  color: var(--jade-deep);
}

.dashboard-heading h1 {
  max-width: 640px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 5vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.heading-note {
  max-width: 330px;
  margin: 0 0 3px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 20px;
  align-items: stretch;
}

.panel,
.book-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 42px var(--shadow);
}

.book-panel {
  min-height: 470px;
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.45fr);
  gap: 40px;
  padding: 32px;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 97% -15%, rgba(149, 171, 155, 0.2), transparent 44%),
    linear-gradient(145deg, var(--surface), var(--surface-soft));
}

.book-cover {
  position: relative;
  min-width: 0;
  min-height: 398px;
  display: flex;
  flex-direction: column;
  padding: 34px 28px 28px;
  overflow: hidden;
  border-radius: 18px 25px 25px 18px;
  color: var(--text);
  background:
    linear-gradient(100deg, rgba(39, 45, 48, 0.12), transparent 11%),
    linear-gradient(145deg, var(--jade-light), var(--jade));
  box-shadow: 8px 16px 30px rgba(50, 45, 40, 0.14), inset 3px 0 rgba(255, 252, 248, 0.28);
  isolation: isolate;
}

.book-cover::before,
.book-cover::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  border: 1px solid rgba(39, 45, 48, 0.2);
}

.book-cover::before {
  width: 230px;
  height: 230px;
  right: -138px;
  top: 68px;
  box-shadow: 0 0 0 35px rgba(255, 252, 248, 0.1), 0 0 0 70px rgba(39, 45, 48, 0.05);
}

.book-cover::after {
  width: 140px;
  height: 140px;
  left: -82px;
  bottom: -28px;
  box-shadow: 0 0 0 26px rgba(255, 252, 248, 0.11);
}

.cover-kicker {
  font-size: 0.61rem;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.cover-title {
  max-width: 10ch;
  margin-top: auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 3vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 0.91;
  overflow-wrap: break-word;
}

.cover-rule {
  width: 34px;
  height: 2px;
  margin: 22px 0 14px;
  background: var(--text);
}

.cover-author {
  max-width: 18ch;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.cover-page {
  position: absolute;
  right: 18px;
  top: 20px;
  color: rgba(39, 45, 48, 0.62);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.62rem;
  font-weight: 700;
}

.book-details {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.book-details h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 4.6vw, 4.4rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.book-author {
  margin: 14px 0 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 650;
}

.series {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.book-progress {
  margin-top: 30px;
}

.progress-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.progress-summary strong {
  color: var(--jade-deep);
  font-size: 0.94rem;
}

.progress-track,
.chapter-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--jade-soft);
}

.progress-fill,
.chapter-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--jade);
  transition: width 450ms ease;
}

.chapter-card {
  margin-top: auto;
  padding: 20px 21px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--jade-soft);
}

.chapter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chapter-label {
  margin: 0 0 5px;
  color: var(--jade-deep);
  font-size: 0.59rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.chapter-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 720;
}

.chapter-percent {
  color: var(--jade-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 650;
}

.chapter-track {
  height: 4px;
  margin-top: 16px;
}

.chapter-track span {
  background: var(--jade-mid);
}

.chapter-remaining {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.reading-panel {
  padding: 30px;
  background: var(--surface);
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 23px;
}

.section-heading.compact {
  margin-bottom: 24px;
}

.section-heading h2,
.updated-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 550;
  letter-spacing: -0.035em;
}

.mini-mark {
  color: var(--jade-mid);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.72rem;
  font-style: italic;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  min-height: 151px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.stat-card-featured {
  background: var(--jade-soft);
}

.stat-card:nth-child(3) {
  background: var(--surface-muted);
}

.stat-card-dark {
  color: var(--text);
  background: color-mix(in srgb, var(--jade-soft) 72%, var(--jade-light));
  border-color: var(--jade-light);
}

.stat-label {
  margin: 0 auto auto 0;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 750;
}

.stat-card-dark .stat-label,
.stat-card-dark .stat-note {
  color: var(--text-muted);
}

.stat-value {
  margin: 22px 0 1px;
  color: var(--jade-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
}

.stat-note {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.58rem;
}

.streak-panel {
  padding: 28px 30px;
  background: var(--peach-soft);
  border-color: color-mix(in srgb, var(--peach) 45%, var(--border));
}

.streak-panel .eyebrow {
  color: var(--peach-strong);
}

.streak-flame {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: color-mix(in srgb, var(--peach) 14%, var(--surface));
}

.streak-flame::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 10px;
  width: 14px;
  height: 19px;
  border-radius: 10px 10px 9px 3px;
  background: var(--peach);
  transform: rotate(42deg);
}

.streak-content {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
}

.streak-primary {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.streak-primary strong {
  color: var(--peach-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.5rem, 7vw, 6.2rem);
  font-weight: 550;
  letter-spacing: -0.075em;
  line-height: 0.75;
}

.streak-primary span {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.streak-secondary {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 3px;
}

.streak-secondary span {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 750;
}

.streak-secondary strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
}

.qualification {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: 28px 0 0;
  padding: 7px 12px 7px 8px;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.68rem;
  font-weight: 750;
}

.qualification > span:first-child {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--surface);
  background: var(--jade);
  font-size: 0.66rem;
}

.qualification[data-qualified="false"] > span:first-child {
  background: var(--peach-strong);
}

.qualification[data-qualified="false"] > span:first-child::before {
  content: "";
}

.updated-panel {
  display: flex;
  align-items: center;
  gap: 21px;
  min-width: 0;
  padding: 28px 30px;
  background: var(--surface);
}

.updated-panel > div:last-child {
  min-width: 0;
}

.updated-icon {
  position: relative;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 19px;
  background: var(--jade-soft);
}

.updated-icon::before {
  content: "";
  width: 19px;
  height: 19px;
  border: 2px solid var(--jade-deep);
  border-radius: 50%;
}

.updated-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  margin: -1px 0 0 7px;
  background: var(--jade-deep);
  transform: rotate(35deg);
  transform-origin: left center;
}

.updated-time {
  margin: 13px 0 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 730;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.updated-relative {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.64rem;
}

.error-message {
  margin-top: 20px;
  padding: 15px 18px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  border-radius: 16px;
  color: var(--danger);
  background: var(--peach-soft);
  font-size: 0.8rem;
}

.error-message strong {
  margin-right: 5px;
}

footer {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 650;
}

@media (min-width: 961px) {
  .site-header {
    min-height: clamp(68px, 8vh, 72px);
  }

  .dashboard-heading {
    gap: 40px;
    padding: clamp(22px, 3vh, 28px) 4px clamp(20px, 2.5vh, 24px);
  }

  .dashboard-heading h1 {
    max-width: 800px;
    font-size: clamp(3rem, 3.8vw, 4rem);
    line-height: 0.95;
  }

  .heading-note {
    line-height: 1.55;
  }

  .dashboard-grid {
    gap: 16px;
  }

  .book-panel {
    min-height: clamp(366px, 43vh, 380px);
    gap: 30px;
    padding: 24px;
  }

  .book-cover {
    min-height: clamp(316px, 37vh, 330px);
    padding: 28px 22px 22px;
  }

  .book-details h2 {
    font-size: clamp(2.35rem, 3.7vw, 3.75rem);
  }

  .book-author {
    margin-top: 10px;
  }

  .series {
    margin-top: 6px;
  }

  .book-progress {
    margin-top: 20px;
  }

  .chapter-card {
    padding: 15px 18px 14px;
  }

  .chapter-track {
    margin-top: 12px;
  }

  .chapter-remaining {
    margin-top: 8px;
  }

  .reading-panel {
    padding: 24px;
  }

  .section-heading {
    margin-bottom: 16px;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    min-height: clamp(116px, 13.5vh, 122px);
    padding: 16px;
  }

  .stat-value {
    margin-top: 14px;
  }

  .streak-panel {
    padding: 20px 24px;
  }

  .section-heading.compact {
    margin-bottom: 12px;
  }

  .streak-primary strong {
    font-size: clamp(3.5rem, 5vw, 4.75rem);
  }

  .qualification {
    min-height: 30px;
    margin-top: 12px;
    padding-block: 5px;
  }

  .updated-panel {
    padding: 20px 24px;
  }

  .updated-icon {
    width: 52px;
    height: 52px;
    border-radius: 17px;
  }

  footer {
    min-height: 56px;
  }
}

@media (max-width: 960px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .book-panel {
    grid-template-columns: minmax(190px, 0.65fr) minmax(0, 1.35fr);
  }

  .reading-panel {
    grid-row: auto;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 145px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 28px, 1240px);
  }

  .site-header {
    min-height: 74px;
  }

  .brand {
    font-size: 0.82rem;
  }

  .sync-state {
    max-width: 45%;
  }

  #sync-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-heading {
    display: block;
    padding: 38px 2px 25px;
  }

  .dashboard-heading h1 {
    max-width: 520px;
    font-size: clamp(2.45rem, 12.5vw, 4rem);
  }

  .heading-note {
    margin-top: 18px;
    font-size: 0.82rem;
  }

  .book-panel {
    min-height: auto;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 22px;
    padding: 22px;
    border-radius: 27px;
  }

  .book-cover {
    grid-row: span 2;
    min-height: 218px;
    align-self: start;
    padding: 22px 17px 18px;
    border-radius: 12px 18px 18px 12px;
  }

  .cover-kicker {
    font-size: 0.5rem;
  }

  .cover-title {
    font-size: clamp(1.35rem, 5vw, 1.7rem);
  }

  .cover-rule {
    width: 25px;
    margin: 13px 0 10px;
  }

  .cover-author {
    font-size: 0.52rem;
  }

  .cover-page {
    display: none;
  }

  .book-details h2 {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .book-author {
    margin-top: 10px;
    font-size: 0.85rem;
  }

  .book-progress {
    margin-top: 23px;
  }

  .chapter-card {
    grid-column: 1 / -1;
    margin-top: 22px;
  }

  .book-details {
    display: contents;
  }

  .book-details > div:first-child,
  .book-progress {
    grid-column: 2;
  }

  .reading-panel,
  .streak-panel,
  .updated-panel {
    padding: 24px;
    border-radius: 27px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 137px;
  }
}

@media (max-width: 460px) {
  .page-shell {
    width: min(100% - 22px, 1240px);
  }

  .site-header {
    gap: 12px;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
  }

  .brand > span:last-child {
    max-width: 75px;
    line-height: 1.05;
  }

  .sync-state {
    max-width: 48%;
    padding-inline: 10px;
    font-size: 0.68rem;
  }

  .dashboard-heading {
    padding-top: 32px;
  }

  .dashboard-heading h1 {
    font-size: clamp(2.35rem, 13vw, 3.2rem);
  }

  .book-panel {
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 17px;
    padding: 18px;
  }

  .book-cover {
    min-height: 181px;
    padding: 18px 13px 15px;
  }

  .cover-title {
    font-size: 1.25rem;
  }

  .book-details h2 {
    font-size: 1.85rem;
  }

  .series {
    font-size: 0.68rem;
  }

  .book-progress {
    margin-top: 18px;
  }

  .progress-summary {
    display: block;
    margin-bottom: 8px;
    line-height: 1.55;
  }

  .progress-summary strong {
    display: block;
  }

  .chapter-card {
    margin-top: 17px;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    min-height: 128px;
    padding: 16px;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .streak-content {
    gap: 18px;
  }

  .streak-primary strong {
    font-size: 4.2rem;
  }

  .updated-panel {
    align-items: flex-start;
  }

  .updated-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
  }
}

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