:root {
  color-scheme: light;
  --ink: #15201d;
  --muted: #65736e;
  --line: #d9e0dc;
  --surface: #ffffff;
  --surface-soft: #f5f7f6;
  --teal: #0f766e;
  --teal-dark: #0b4c47;
  --tomato: #b9472a;
  --gold: #b7842c;
  --blue: #2f5e9e;
  --shadow: 0 18px 40px rgba(21, 32, 29, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--surface-soft);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px clamp(16px, 3vw, 36px) 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.language-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.lang-button {
  min-width: 44px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.lang-button.is-active {
  background: var(--ink);
  color: #fff;
}

.search-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: clamp(24px, 5vw, 72px);
  align-items: end;
  padding: clamp(34px, 7vw, 72px) 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 850px;
  margin-bottom: 0;
  font-size: 4.65rem;
  line-height: 0.98;
  letter-spacing: 0;
}

.search-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid #cbd5d1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.lang-button:focus-visible,
.country-tab:focus-visible,
.buy-link:focus-visible,
.book-card:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.26);
  outline-offset: 2px;
}

.country-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 16px;
}

.country-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.country-tab.is-active {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
  color: #fff;
}

.country-tab strong,
.country-tab span {
  display: block;
}

.country-tab strong {
  font-size: 0.95rem;
}

.country-tab span {
  color: currentColor;
  opacity: 0.72;
  font-size: 0.75rem;
}

.insight-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.metric {
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric span,
.freshness,
.meta-line {
  color: var(--muted);
  font-size: 0.8rem;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.62rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.ranking-column,
.detail-panel {
  min-width: 0;
}

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

.section-heading h2 {
  margin-bottom: 0;
  font-size: 2.24rem;
  letter-spacing: 0;
}

.freshness {
  margin-bottom: 4px;
  text-align: right;
}

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

.book-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  min-height: 162px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 20px rgba(21, 32, 29, 0.05);
}

.book-card.is-active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.cover-frame {
  position: relative;
  width: 86px;
  height: 132px;
  overflow: hidden;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(185, 71, 42, 0.14)),
    #e9eeeb;
  box-shadow: inset -9px 0 0 rgba(21, 32, 29, 0.08);
}

.cover-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rank-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(21, 32, 29, 0.9);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

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

.book-copy h3 {
  margin-bottom: 5px;
  font-size: 1rem;
  line-height: 1.18;
}

.book-copy p {
  margin-bottom: 8px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf2f0;
  color: #3c4844;
  font-size: 0.72rem;
  font-weight: 800;
}

.tag.trend-up {
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal-dark);
}

.tag.trend-new {
  background: rgba(185, 71, 42, 0.12);
  color: var(--tomato);
}

.tag.trend-steady {
  background: rgba(47, 94, 158, 0.12);
  color: var(--blue);
}

.tag.trend-down {
  background: rgba(183, 132, 44, 0.16);
  color: #755113;
}

.detail-panel {
  position: sticky;
  top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-hero {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-hero .cover-frame {
  width: 112px;
  height: 172px;
}

.detail-hero h2 {
  margin-bottom: 8px;
  font-size: 1.86rem;
  line-height: 1.08;
}

.detail-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.pulse-block,
.edition-block,
.source-block {
  display: grid;
  gap: 8px;
}

.pulse-block h3,
.edition-block h3,
.source-block h3 {
  margin-bottom: 0;
  font-size: 0.88rem;
  text-transform: uppercase;
}

.pulse-block p,
.edition-block p,
.source-block p {
  margin-bottom: 0;
  color: #35423e;
  line-height: 1.55;
}

.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #d4ded9;
  border-radius: 7px;
  background: #f8faf9;
  color: #3c4844;
  font-size: 0.75rem;
  font-weight: 800;
}

.buy-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.buy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.buy-link.secondary {
  background: #e8efec;
  color: var(--ink);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed #b8c4bf;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1120px) {
  .search-band,
  .workspace {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 840px) {
  h1 {
    font-size: 3.25rem;
  }

  .section-heading h2 {
    font-size: 1.92rem;
  }

  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .language-switcher,
  .country-strip,
  .insight-row,
  .book-grid {
    width: 100%;
  }

  .country-strip,
  .insight-row,
  .book-grid {
    grid-template-columns: 1fr;
  }

  .country-strip {
    gap: 8px;
  }

  .freshness {
    text-align: left;
  }
}

@media (max-width: 540px) {
  .app-shell {
    padding-inline: 12px;
  }

  h1 {
    font-size: 2.38rem;
    line-height: 1.02;
  }

  .metric strong {
    font-size: 1.42rem;
  }

  .detail-hero h2 {
    font-size: 1.34rem;
  }

  .language-switcher {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .lang-button {
    min-width: 0;
    padding-inline: 6px;
  }

  .book-card,
  .detail-hero {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .cover-frame,
  .detail-hero .cover-frame {
    width: 74px;
    height: 114px;
  }

  .buy-row {
    grid-template-columns: 1fr;
  }
}
