:root {
  color-scheme: light;
  --ink: #153047;
  --muted: #667682;
  --paper: #f4f7f8;
  --surface: #ffffff;
  --navy: #173f59;
  --navy-soft: #e5eef2;
  --yellow: #f7c65f;
  --line: #dce5e8;
  --shadow: 0 10px 28px rgba(20, 48, 69, 0.09);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

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

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
}

.page-header {
  padding: calc(28px + env(safe-area-inset-top)) 20px 22px;
  background: var(--navy);
  color: white;
}

.eyebrow,
.section-kicker {
  margin: 0 0 7px;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.eyebrow { color: var(--yellow); }

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 9vw, 2.65rem);
  line-height: 1.14;
  letter-spacing: -0.04em;
}

.intro {
  max-width: 32rem;
  margin: 12px 0 0;
  color: #d9e4e9;
  font-size: 1rem;
  line-height: 1.65;
}

.level-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 0;
  border-bottom: 1px solid rgba(220, 229, 232, 0.95);
  background: rgba(244, 247, 248, 0.94);
  backdrop-filter: blur(14px);
}

.level-scroll {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 0 20px;
  scrollbar-width: none;
}

.level-scroll::-webkit-scrollbar { display: none; }

.level-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.level-chip.is-active {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
  box-shadow: 0 5px 14px rgba(23, 63, 89, 0.22);
}

main { padding: 0 16px 36px; }

.list-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 23px 4px 15px;
}

.section-kicker { color: #758893; }

h2 {
  margin: 0;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.55rem;
  letter-spacing: -0.025em;
}

.book-count {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.book-list { display: grid; gap: 14px; }

.empty-state {
  margin: 4px 0 20px;
  padding: 32px 24px;
  border: 1px dashed #b9c8ce;
  border-radius: 18px;
  color: var(--ink);
  text-align: center;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.book-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 15px;
  padding: 14px;
  border: 1px solid rgba(220, 229, 232, 0.9);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cover {
  position: relative;
  display: flex;
  min-height: 150px;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 12px 10px;
  border-radius: 11px 15px 15px 11px;
  color: white;
  box-shadow: inset -5px 0 0 rgba(0, 0, 0, 0.11), 0 5px 12px rgba(19, 48, 70, 0.16);
}

.cover::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255,255,255,.22), transparent 35%, rgba(0,0,0,.2));
  content: "";
}

.cover > * { position: relative; }

.cover-series {
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.cover strong {
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.05rem;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.cover small {
  margin-top: 12px;
  color: rgba(255,255,255,.72);
  font-size: 0.58rem;
}

.cover--school { background: #d6473d; }
.cover--dragon { background: #315b47; }
.cover--treehouse { background: #286c8d; }
.cover--george { background: #e29a29; }
.cover--mystery { background: #634783; }

.book-body { min-width: 0; }

.atos-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--navy-soft);
  color: var(--navy);
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
}

h3 {
  margin: 8px 0 0;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.12rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.chinese-title {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.summary {
  display: -webkit-box;
  overflow: hidden;
  margin: 9px 0 12px;
  color: #455b69;
  font-size: 0.88rem;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.actions {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 8px;
}

.actions--three { grid-template-columns: repeat(3, 1fr); }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 11px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.button--audio { background: var(--navy); color: white; }
.button--shop { background: var(--yellow); color: #3d2c05; }
.button--video { background: #e8f2f3; color: #276270; }

.button:focus-visible,
.level-chip:focus-visible {
  outline: 3px solid #2b9bc8;
  outline-offset: 2px;
}

footer {
  padding: 0 25px calc(34px + env(safe-area-inset-bottom));
  color: #71828c;
  font-size: 0.82rem;
  line-height: 1.7;
  text-align: center;
}

@media (min-width: 560px) {
  .page-header { padding-inline: 34px; }
  .level-scroll { padding-inline: 34px; }
  main { padding-inline: 28px; }
  .book-card { grid-template-columns: 122px minmax(0, 1fr); padding: 17px; }
  .cover { min-height: 170px; }
}

@media (max-width: 370px) {
  .book-card { grid-template-columns: 88px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .cover { min-height: 135px; padding: 10px 8px; }
  .cover strong { font-size: 0.9rem; }
  .summary { font-size: 0.84rem; }
  .button { min-height: 46px; padding-inline: 7px; font-size: 0.76rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
