:root {
  color-scheme: light;
  --navy: #17324d;
  --ink: #1f2b3d;
  --muted: #617086;
  --paper: #f3f6fa;
  --surface: #ffffff;
  --line: #dce3ec;
  --teal: #168b82;
  --blue: #2b6db5;
  --violet: #7a52bd;
  --orange: #cf7415;
  --red: #cf514d;
  --green: #3d8449;
  --shadow: 0 12px 32px rgba(30, 54, 78, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html { background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(43, 109, 181, 0.09), transparent 34rem),
    var(--paper);
}

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

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem calc(3rem + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: .9rem;
  color: white;
  background: var(--navy);
  box-shadow: var(--shadow);
  font-size: 1.35rem;
}

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

.brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1.05;
}

.brand p {
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .86rem;
}

.install-button,
.primary-button,
.secondary-button,
.back-button {
  min-height: 2.75rem;
  border-radius: .85rem;
  border: 0;
  padding: .72rem 1rem;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
}

.install-button,
.primary-button {
  color: white;
  background: var(--navy);
}

.secondary-button,
.back-button {
  color: var(--navy);
  background: #e6edf5;
}

.install-button[hidden] { display: none; }

.intro-panel {
  padding: 1.1rem;
  border-radius: 1.25rem;
  background: var(--navy);
  color: white;
  box-shadow: var(--shadow);
}

.intro-panel h2 {
  margin-bottom: .45rem;
  font-size: 1.15rem;
}

.intro-panel p {
  margin-bottom: 0;
  color: #d6e0ec;
  line-height: 1.45;
}

.search-wrap { margin: 1rem 0 .8rem; }

.search {
  width: 100%;
  min-height: 3.2rem;
  padding: .8rem 1rem .8rem 2.9rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--ink);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23617086' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") no-repeat .95rem center / 1.2rem;
  box-shadow: 0 5px 18px rgba(30, 54, 78, .06);
}

.search:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(43, 109, 181, .35);
  outline-offset: 2px;
}

.filters {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding: .15rem 0 .55rem;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filter {
  flex: 0 0 auto;
  min-height: 2.6rem;
  padding: .55rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}

.filter.is-active {
  border-color: var(--navy);
  color: white;
  background: var(--navy);
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: .75rem 0;
  color: var(--muted);
  font-size: .9rem;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .85rem;
}

.material-card {
  position: relative;
  display: grid;
  grid-template-columns: 3.15rem 1fr auto;
  align-items: center;
  gap: .9rem;
  min-height: 7.6rem;
  padding: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  color: inherit;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(30, 54, 78, .07);
  text-decoration: none;
}

.material-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: .34rem;
  background: var(--card-color, var(--blue));
}

.material-card:active { transform: scale(.992); }

.card-icon {
  display: grid;
  place-items: center;
  width: 3.15rem;
  height: 3.15rem;
  border-radius: 1rem;
  color: white;
  background: var(--card-color, var(--blue));
  font-weight: 850;
  letter-spacing: -.03em;
}

.card-copy h3 {
  margin-bottom: .28rem;
  font-size: 1.03rem;
  line-height: 1.2;
}

.card-copy p {
  margin: 0;
  color: var(--muted);
  font-size: .87rem;
  line-height: 1.35;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .55rem;
}

.tag {
  padding: .22rem .48rem;
  border-radius: 999px;
  color: var(--card-color, var(--blue));
  background: color-mix(in srgb, var(--card-color, var(--blue)) 11%, white);
  font-size: .72rem;
  font-weight: 750;
}

.arrow {
  color: var(--card-color, var(--blue));
  font-size: 1.4rem;
  font-weight: 800;
}

.empty {
  padding: 2rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 1rem;
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,.65);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  margin-bottom: 1rem;
}

.detail-title {
  flex: 1;
  padding: 1rem;
  border-radius: 1.1rem;
  color: white;
  background: var(--detail-color, var(--blue));
  box-shadow: var(--shadow);
}

.detail-title .eyebrow {
  margin-bottom: .35rem;
  opacity: .82;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.detail-title h1 {
  margin-bottom: .3rem;
  font-size: clamp(1.45rem, 6vw, 2.25rem);
}

.detail-title p { margin: 0; line-height: 1.4; }

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin: 1rem 0;
}

.content-panel {
  margin-top: .9rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(30, 54, 78, .06);
}

.content-panel h2 {
  margin-bottom: .8rem;
  font-size: 1.18rem;
}

.content-panel p,
.content-panel li { line-height: 1.55; }

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 0;
  list-style: none;
}

.topic-list li {
  padding: .4rem .65rem;
  border-radius: .65rem;
  color: var(--detail-color, var(--blue));
  background: color-mix(in srgb, var(--detail-color, var(--blue)) 10%, white);
  font-weight: 700;
  font-size: .88rem;
}

.mobile-pdf-note {
  padding: 1.2rem;
  border-radius: 1rem;
  background: #e9f0f8;
  color: var(--navy);
  line-height: 1.5;
}

.pdf-frame {
  display: none;
  width: 100%;
  height: 75vh;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: white;
}

.interval-table {
  display: grid;
  gap: .6rem;
}

.interval-row {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: .8rem;
  padding: .8rem;
  border-radius: .85rem;
  background: #f5f8fc;
}

.interval-symbol {
  display: grid;
  place-items: center;
  min-height: 2.7rem;
  border-radius: .7rem;
  color: white;
  background: var(--violet);
  font-size: 1.05rem;
  font-weight: 850;
}

.number-line {
  width: 100%;
  height: 4rem;
  margin-top: .4rem;
}

details {
  margin-top: .7rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: #f8fafc;
}

summary {
  padding: .8rem;
  font-weight: 750;
  cursor: pointer;
}

details p { padding: 0 .8rem .8rem; margin: 0; }

.construction-image {
  display: block;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  border-radius: .9rem;
  border: 1px solid var(--line);
  background: white;
}

.step-grid {
  display: grid;
  gap: .7rem;
}

.step-card {
  padding: .9rem;
  border-left: .35rem solid var(--detail-color, var(--blue));
  border-radius: .75rem;
  background: #f6f8fb;
}

.step-card h3 { margin-bottom: .4rem; font-size: 1rem; }
.step-card p { margin: 0; color: var(--muted); }

.memory-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .7rem;
  margin-top: 1rem;
}

.memory-strip span {
  padding: .85rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--detail-color) 10%, white);
  border: 1px solid color-mix(in srgb, var(--detail-color) 22%, white);
  font-weight: 750;
  text-align: center;
}

.offline-note {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

@media (min-width: 720px) {
  .shell { padding-inline: 1.5rem; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intro-panel { padding: 1.35rem 1.5rem; }
  .mobile-pdf-note { display: none; }
  .pdf-frame { display: block; }
}

@media (min-width: 1020px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
  .material-card, button { transition: transform .16s ease, box-shadow .16s ease; }
  .material-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
}
