* {
  box-sizing: border-box;
}

html {
  background: var(--app-bg);
}

body {
  margin: 0;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.screen {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 16px 36px;
}

.screen-header {
  margin-bottom: 26px;
}

.page-title {
  margin: 0;
  color: var(--app-text);
  font-size: clamp(2.2rem, 8vw, 3.45rem);
  font-weight: 750;
  letter-spacing: -0.055em;
  line-height: 1.02;
}

.page-subtitle {
  max-width: 650px;
  margin: 12px 0 0;
  color: var(--app-muted);
  font-size: clamp(1.05rem, 3.2vw, 1.45rem);
  line-height: 1.35;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--app-accent);
  font-size: var(--text-sm);
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-block {
  margin-top: 30px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2,
.section-heading h3 {
  min-width: 0;
  margin: 0;
  color: var(--app-text);
  font-size: clamp(1.35rem, 4.6vw, 2rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.section-heading h3 {
  font-size: 1.18rem;
}

.text-link,
.add-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  min-height: 44px;
  gap: 7px;
  border: 0;
  padding: 6px 0;
  color: var(--app-accent-dark);
  background: transparent;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
}

.text-link:hover,
.add-link:hover {
  text-decoration: underline;
}

.icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  vertical-align: middle;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-width: 2;
}

.icon-lg {
  width: 28px;
  height: 28px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  color: var(--color-white);
  background: var(--app-accent);
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease;
}

.button:hover {
  background: var(--color-accent-dark);
}

.button:active {
  transform: translateY(1px);
}

.button-secondary {
  border-color: var(--app-border);
  color: var(--app-accent-dark);
  background: var(--app-surface);
}

.button-secondary:hover {
  background: var(--color-mint-pale);
}

.button-wide {
  width: 100%;
}

.button-reset {
  width: 100%;
  border: 0;
  text-align: left;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 8px;
  background: var(--color-mint-soft);
}

.stat {
  min-width: 0;
  padding: 14px 12px;
}

.stat + .stat {
  border-left: 1px solid rgba(47, 93, 80, 0.22);
}

.stat:nth-child(3) {
  border-left: 0;
}

.stat-label {
  display: block;
  overflow: hidden;
  color: var(--app-accent-dark);
  font-size: var(--text-xs);
  font-weight: 750;
  letter-spacing: 0.11em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stat-value {
  display: block;
  margin-top: 2px;
  color: var(--app-text);
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.stat-note {
  color: var(--app-muted);
  font-size: var(--text-sm);
}

.stat-primary {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 12px;
}

.stat-primary .stat-label {
  align-self: flex-start;
  margin-right: 4px;
}

.stat-primary .stat-value {
  font-size: 2.7rem;
}

.book-list,
.entry-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.book-card,
.entry-card,
.panel,
.detail-card,
.highlight-card {
  min-width: 0;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface);
  box-shadow: var(--shadow-soft);
}

.book-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.book-cover {
  position: relative;
  display: flex;
  width: 72px;
  height: 104px;
  flex: 0 0 72px;
  align-items: flex-end;
  overflow: hidden;
  border-radius: 12px;
  padding: 9px 8px;
  color: var(--color-white);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  isolation: isolate;
}

.book-cover::before,
.book-cover::after {
  position: absolute;
  z-index: -1;
  content: "";
}

.book-cover::before {
  top: -18px;
  right: -12px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
}

.book-cover::after {
  bottom: -20px;
  left: -12px;
  width: 120px;
  height: 52px;
  border-radius: 50% 50% 0 0;
  background: rgba(5, 39, 36, 0.34);
}

.book-cover span {
  display: block;
  max-width: 100%;
  color: var(--color-white);
  font-family: Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.03;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
}

.cover-forest {
  background: linear-gradient(155deg, var(--color-forest-cover-light), var(--color-forest-cover));
}

.cover-paper {
  color: var(--color-ink);
  background: linear-gradient(145deg, var(--color-paper-cover), var(--color-paper-cover-dark));
}

.cover-paper span {
  color: var(--color-ink);
  text-shadow: none;
}

.cover-lighthouse {
  background: linear-gradient(155deg, var(--color-lighthouse-light), var(--color-lighthouse-cover));
}

.cover-quiet {
  background: linear-gradient(155deg, var(--color-quiet-cover), var(--color-quiet-cover-dark));
}

.cover-quiet span {
  color: var(--color-ink);
  text-shadow: none;
}

.book-content {
  min-width: 0;
  flex: 1 1 auto;
}

.book-title,
.book-author,
.entry-title,
.entry-date {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-title {
  color: var(--app-text);
  min-height: 44px;
  padding: 7px 0;
  font-size: 1.08rem;
  font-weight: 750;
  line-height: 1.25;
}

.book-author {
  margin-top: 2px;
  color: var(--app-muted);
}

.progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  color: var(--app-muted);
  font-size: var(--text-sm);
}

.progress-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-line-soft);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--app-accent);
}

.book-action {
  display: grid;
  width: 110px;
  flex: 0 0 110px;
  gap: 8px;
}

.page-input,
.field-input,
.field-select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--app-text);
  background: var(--app-surface);
}

.page-input {
  text-align: center;
}

.page-input:focus,
.field-input:focus,
.field-select:focus {
  outline: 3px solid rgba(47, 93, 80, 0.18);
  border-color: var(--app-accent);
}

.save-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  color: var(--color-white);
  background: var(--app-accent);
  font-weight: 750;
}

.save-button:hover {
  background: var(--color-accent-dark);
}

.more-button {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  color: var(--app-muted);
  background: transparent;
}

.book-menu {
  align-self: flex-start;
  margin: -5px -8px 0 0;
}

.entry-list {
  gap: 0;
  overflow: hidden;
}

.entry-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  border-width: 0 0 1px;
  border-radius: 0;
  padding: 10px 14px;
  box-shadow: none;
}

.entry-card:last-child {
  border-bottom: 0;
}

.entry-thumb {
  width: 42px;
  height: 52px;
  flex: 0 0 42px;
  border-radius: 8px;
  padding: 5px;
}

.entry-thumb span {
  font-size: 0.58rem;
}

.entry-copy {
  min-width: 0;
  flex: 1;
}

.entry-title {
  font-weight: 700;
}

.entry-date {
  color: var(--app-muted);
}

.entry-pages {
  flex-shrink: 0;
  color: var(--app-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.empty-state,
.loading-block {
  border: 1px dashed var(--app-border);
  border-radius: var(--radius-md);
  padding: 24px 18px;
  color: var(--app-muted);
  background: rgba(255, 255, 255, 0.38);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 4px;
  color: var(--app-text);
}

.feedback {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--app-accent-dark);
  font-size: var(--text-sm);
}

.feedback[data-tone="error"] {
  color: #8a3d36;
}

.form-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--color-mint-pale);
}

.form-panel[hidden] {
  display: none;
}

.field-group {
  min-width: 0;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--app-text);
  font-size: var(--text-sm);
  font-weight: 700;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.book-card-wide {
  align-items: flex-start;
}

.book-card-wide .book-content {
  padding-top: 2px;
}

.book-card-wide .book-action {
  margin-top: 28px;
}

.last-read {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--app-muted);
  font-size: var(--text-sm);
}

.last-read .icon {
  width: 18px;
  height: 18px;
}

.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-lg);
  padding: 14px;
  color: var(--app-accent-dark);
  background: var(--color-mint-soft);
}

.week-nav-copy {
  min-width: 0;
  flex: 1;
}

.week-nav-title,
.week-nav-dates {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-nav-title {
  font-size: 1.12rem;
  font-weight: 750;
}

.week-nav-dates {
  color: var(--app-muted);
}

.round-button {
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  color: var(--app-accent-dark);
  background: transparent;
}

.chart-panel {
  margin-top: 18px;
  padding: 18px 14px 14px;
}

.chart-panel h2,
.detail-card h2 {
  margin: 0;
  color: var(--app-text);
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}

.chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  height: 238px;
  margin-top: 24px;
  border-bottom: 1px solid var(--app-border);
  padding: 0 2px 0;
}

.chart-day {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-width: 0;
  height: 100%;
  align-items: end;
  justify-items: center;
  gap: 6px;
}

.chart-value {
  color: var(--app-text);
  font-size: var(--text-sm);
  font-weight: 650;
}

.chart-bar-slot {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: end;
  justify-content: center;
}

.chart-bar {
  width: min(34px, 72%);
  min-height: 4px;
  border-radius: 8px 8px 0 0;
  background: var(--app-accent);
}

.chart-label,
.chart-date {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--app-muted);
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-date {
  font-size: var(--text-xs);
}

.chart-total {
  margin: 14px 0 0;
  color: var(--app-text);
  font-size: var(--text-md);
  font-weight: 650;
  text-align: center;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 22px;
  border-radius: var(--radius-md);
  padding: 14px 8px;
  background: var(--color-mint-soft);
}

.summary-item {
  min-width: 0;
  padding: 4px 8px;
}

.summary-item + .summary-item {
  border-left: 1px solid rgba(47, 93, 80, 0.22);
}

.summary-label {
  display: block;
  overflow: hidden;
  color: var(--app-accent-dark);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.summary-value {
  display: block;
  margin-top: 4px;
  color: var(--app-text);
  font-size: 1.75rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.summary-note {
  color: var(--app-muted);
  font-size: var(--text-sm);
}

.streak-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
}

.streak-icon {
  display: flex;
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--app-accent);
  background: var(--color-mint-soft);
}

.streak-copy {
  min-width: 0;
  flex: 1;
}

.streak-headline {
  display: block;
  color: var(--app-text);
  font-size: 1.55rem;
  font-weight: 750;
  line-height: 1.15;
}

.streak-note {
  display: block;
  margin-top: 4px;
  color: var(--app-muted);
}

.highlight-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.highlight-icon {
  display: flex;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: var(--app-accent);
  background: var(--color-mint-soft);
}

.highlight-copy {
  min-width: 0;
  flex: 1;
}

.highlight-title {
  display: block;
  color: var(--app-text);
  font-weight: 750;
}

.highlight-note {
  display: block;
  color: var(--app-muted);
}

.detail-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
}

.detail-cover {
  width: 130px;
  height: 184px;
  flex: 0 0 130px;
  border-radius: 16px;
  padding: 16px 13px;
}

.detail-cover span {
  font-size: 1.25rem;
}

.detail-copy {
  min-width: 0;
}

.detail-copy h2 {
  margin: 0;
  color: var(--app-text);
  font-size: clamp(1.55rem, 5vw, 2.2rem);
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.detail-author {
  display: block;
  margin-top: 7px;
  color: var(--app-muted);
  font-size: 1.05rem;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 18px;
  color: var(--app-muted);
  font-size: var(--text-sm);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-item + .meta-item {
  border-left: 1px solid var(--app-border);
  padding-left: 14px;
}

.detail-progress {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(0, 0.8fr));
  gap: 0;
  margin-top: 28px;
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  background: var(--color-mint-soft);
}

.detail-progress-item {
  min-width: 0;
  padding: 0 10px;
}

.detail-progress-item + .detail-progress-item {
  border-left: 1px solid rgba(47, 93, 80, 0.22);
}

.detail-label {
  display: block;
  overflow: hidden;
  color: var(--app-accent-dark);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.detail-number {
  display: block;
  margin-top: 6px;
  color: var(--app-text);
  font-size: 1.75rem;
  font-weight: 750;
  line-height: 1.1;
}

.detail-support {
  color: var(--app-muted);
  font-size: var(--text-sm);
}

.detail-progress .progress-track {
  margin-top: 12px;
}

.status-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
}

.status-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-control .field-select {
  max-width: 210px;
}

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
  border-bottom: 1px solid var(--app-border);
}

.detail-tab {
  min-height: 48px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--app-muted);
  background: transparent;
  font-weight: 650;
}

.detail-tab.is-active {
  border-bottom-color: var(--app-accent);
  color: var(--app-accent-dark);
}

.history-list {
  margin-top: 16px;
  padding: 0 14px;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 74px;
  border-bottom: 1px solid var(--color-line-soft);
}

.history-row:last-child {
  border-bottom: 0;
}

.history-icon {
  display: flex;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  color: var(--app-accent);
  background: var(--color-mint-soft);
}

.history-copy {
  min-width: 0;
  flex: 1;
}

.history-page {
  display: block;
  color: var(--app-text);
  font-weight: 750;
}

.history-chapter,
.history-date {
  display: block;
  color: var(--app-muted);
  font-size: var(--text-sm);
}

.history-date {
  flex: 0 1 105px;
  text-align: right;
}

.history-arrow {
  color: var(--app-muted);
}

.detail-bottom-action {
  margin-top: 18px;
}

@media (min-width: 600px) {
  .screen {
    padding: 42px 28px 48px;
  }

  .stats-strip {
    grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr));
    padding: 14px;
  }

  .stat-primary {
    grid-column: auto;
    display: block;
    padding: 14px 12px;
  }

  .stat-primary .stat-value {
    font-size: 2.7rem;
  }

  .stat:nth-child(3) {
    border-left: 1px solid rgba(47, 93, 80, 0.22);
  }

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

  .form-panel .field-group:first-child {
    grid-column: span 2;
  }

  .form-panel .form-actions {
    grid-column: span 2;
  }

  .status-panel {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
}

@media (min-width: 760px) {
  .section-block {
    margin-top: 38px;
  }

  .book-card {
    gap: 16px;
    padding: 18px;
  }

  .book-cover {
    width: 86px;
    height: 124px;
    flex-basis: 86px;
  }

  .book-cover span {
    font-size: 1.05rem;
  }

  .detail-cover {
    width: 178px;
    height: 250px;
    flex-basis: 178px;
  }

  .detail-cover span {
    font-size: 1.55rem;
  }
}

@media (max-width: 460px) {
  .book-card-wide .book-action {
    width: 94px;
    flex-basis: 94px;
  }

  .book-card-wide {
    gap: 10px;
    padding: 12px;
  }

  .book-card-wide .book-cover {
    width: 66px;
    height: 96px;
    flex-basis: 66px;
  }

  .book-card-wide .book-cover span {
    font-size: 0.82rem;
  }

  .history-date {
    flex-basis: 88px;
  }
}
