:root {
  --paper: #f6f1e6;
  --card: #fffdf8;
  --ink: #1c2430;
  --muted: #5b6573;
  --line: #d7cbb6;
  --primary: #334e8c;
  --primary-dark: #263a6a;
  --accent: #c45f3c;
  --correct: #2f6b45;
  --correct-bg: #e7f4ea;
  --wrong: #a92a20;
  --wrong-bg: #fdecea;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --content: 52rem;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Nunito, "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(circle at top left, rgba(196, 95, 60, 0.1), transparent 26%), var(--paper);
}
button, input, select { font: inherit; }
button, a, label { touch-action: manipulation; }
a { color: var(--primary); }

.site-header { background: var(--primary); color: white; }
.site-header-inner {
  width: min(70rem, calc(100% - 2rem));
  margin: auto;
  padding: 0.7rem 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1.5rem;
}
.site-header a {
  color: white;
  font-weight: 800;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding: 4px 0;
}
.site-brand { font-size: 1.1rem; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.35rem; }
.site-header a:hover,
.site-header a[aria-current="page"] {
  border-bottom-color: #fff;
}
.site-header .site-header-cta {
  padding: 3px 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
}
.site-header .site-header-cta:hover,
.site-header .site-header-cta:focus-visible,
.site-header .site-header-cta[aria-current="page"] {
  background: white;
  color: var(--primary);
  border-color: white;
}

.page {
  width: min(70rem, calc(100% - 2rem));
  margin: auto;
  padding: 2.5rem 0 4rem;
}
.hero { max-width: var(--content); margin: auto; text-align: center; }
.kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1, h2, h3 { line-height: 1.15; }
h1 { margin: 0 0 1rem; font: 700 clamp(2rem, 6vw, 3.4rem)/1.1 Georgia, serif; }
h2 { font: 700 1.55rem/1.2 Georgia, serif; }
.lead { max-width: 65ch; margin: 0 auto; color: var(--muted); font-size: 1.08rem; line-height: 1.65; }

.class-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin: 1.7rem auto 0;
}
.class-grid a, .button, button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  background: var(--card);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.class-grid a:hover, .class-grid a[aria-current="page"], button.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #e1a437;
  outline-offset: 2px;
}
button:disabled { cursor: not-allowed; opacity: 0.55; }

.content-section { max-width: var(--content); margin: 2.5rem auto 0; line-height: 1.65; }
.steps { padding-left: 1.4rem; }
.steps li + li { margin-top: 0.5rem; }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.feature-grid article, .note {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
  background: rgba(255, 253, 248, 0.75);
}
.feature-grid h3 { color: var(--primary); margin: 0 0 0.4rem; }
.feature-grid p, .note p { margin: 0; color: var(--muted); }

.breadcrumbs { margin-bottom: 1rem; color: var(--muted); font-size: 0.92rem; }
.breadcrumbs ol { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li + li::before { content: "›"; margin-right: 0.35rem; color: var(--line); }

.landing-content { max-width: var(--content); margin: 2.4rem auto; line-height: 1.65; }
.landing-content h2 { margin: 2.2rem 0 0.6rem; }
.landing-content h3 { margin: 1.3rem 0 0.35rem; font-size: 1.15rem; }
.landing-content p { margin: 0.65rem 0; }
.landing-content a { font-weight: 800; }
.landing-category { margin-top: 1.4rem; }
.landing-faq h3 { font-family: Nunito, "Segoe UI", system-ui, sans-serif; font-size: 1.05rem; }
.landing-topic-list { display: grid; gap: 0.7rem; padding: 0; list-style: none; }
.landing-topic-list li { padding: 0.9rem 1rem; border-left: 4px solid var(--primary); background: rgba(255,255,255,.45); }
.landing-topic-list strong { display: block; color: var(--ink); }
.landing-topic-list span { color: var(--muted); }
.hub-link-list { display: grid; gap: 0.5rem; padding-left: 1.2rem; }
.hub-link-list li { color: var(--muted); }
.sticky-cta {
  position: sticky;
  bottom: 0;
  z-index: 20;
  padding: 0.9rem;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
  text-align: center;
}
.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.75rem 1.2rem;
  border-radius: 12px;
  font-weight: 900;
  text-decoration: none;
}
.primary { border: 1px solid var(--primary); background: var(--primary); color: white; }
.primary:hover { background: var(--primary-dark); }
.secondary { border: 1px solid var(--line); background: var(--card); color: var(--primary); }
.secondary:hover { border-color: var(--primary); }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.2rem 0; }
.landing-content code {
  padding: 0.18rem 0.42rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.94em;
}
.landing-content ol { padding-left: 1.4rem; }
.landing-content ol li + li { margin-top: 0.4rem; }
.landing-content ul { padding-left: 1.4rem; }
.landing-content ul li + li { margin-top: 0.35rem; }

.setup, .worksheet { width: min(var(--content), 100%); margin: 2rem auto 0; }
.setup-card {
  margin-top: 1rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.setup-card h2 { margin: 0 0 0.9rem; font-family: inherit; font-size: 1.05rem; }
.term-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.topic-groups { display: grid; gap: 1.2rem; }
.topic-group h3 { margin: 0 0 0.6rem; font-size: 0.95rem; color: var(--primary); }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.55rem; }
.topic-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.55rem;
  row-gap: 0.15rem;
  align-items: start;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f4ea;
  cursor: pointer;
}
.topic-choice:has(input:checked) { border-color: var(--primary); background: #e9edf7; }
.topic-choice input[data-topic] {
  grid-row: 1 / span 2;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.2rem 0 0;
  accent-color: var(--primary);
}
.topic-choice:has(input:checked) input[data-topic] { grid-row: 1 / span 3; }
.topic-choice-name { font-weight: 800; line-height: 1.25; }
.topic-example { grid-column: 2; display: block; margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.topic-blocks {
  display: none;
  grid-column: 2;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
}
.topic-choice:has(input:checked) .topic-blocks { display: inline-flex; }
.topic-blocks-btn {
  width: 32px; height: 32px; min-height: 32px; padding: 0;
  border-radius: 8px; background: white; font-size: 1.15rem; line-height: 1;
}
.topic-blocks-btn:disabled { opacity: 0.35; }
.topic-blocks-count { min-width: 3.6rem; text-align: center; font-size: 0.82rem; font-weight: 800; }
.hint { margin: 0.8rem 0 0; color: var(--muted); font-size: 0.92rem; }
.topic-choice small b { color: var(--accent); }
.create-row, .worksheet-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.create-row p { flex: 1; margin: 0; color: var(--muted); }
.setting-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-weight: 800;
  cursor: pointer;
}
.setting-switch input { width: 1.2rem; height: 1.2rem; accent-color: var(--primary); }
.create-row button, #check-btn { border-color: var(--accent); background: var(--accent); color: white; }

.worksheet { scroll-margin-top: 1rem; }
.worksheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.worksheet-head h2 { margin-bottom: 0.5rem; }
.tasks { display: grid; gap: 0.8rem; }
.task-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.task-meta { margin: 0 0 0.45rem; color: var(--muted); font-size: 0.8rem; font-weight: 800; }
.task-prompt { margin: 0.5rem 0 0.7rem; font-weight: 800; line-height: 1.5; }
.picture-card { display: block; width: 110px; height: 110px; margin: 0.25rem auto; object-fit: contain; }
.choice-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice { cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  font-weight: 800;
}
.choice input:checked + span { border-color: var(--primary); background: #e9edf7; }
.text-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.answer-input {
  width: min(100%, 18rem);
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
}
.umlaut-bar {
  display: inline-flex;
  gap: 0.35rem;
}
.umlaut-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  background: white;
  font-size: 1rem;
  line-height: 1;
}
.umlaut-btn:hover {
  border-color: var(--primary);
  background: #e9edf7;
}
.umlaut-btn:active {
  background: var(--primary);
  color: white;
}
.audio-task-control {
  display: grid;
  gap: 0.55rem;
}
.audio-btn-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.audio-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0.45rem 0.9rem;
  border-color: var(--primary);
  border-radius: 10px;
  background: #e9edf7;
  color: var(--primary);
  font-weight: 800;
}
.audio-play-btn:hover {
  background: var(--primary);
  color: white;
}
.audio-play-slow {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}
.class-link-panel,
.check-sheet {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.class-link-title {
  margin: 0;
  font-weight: 900;
  color: var(--primary);
}
.class-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.class-link-row input {
  flex: 1 1 16rem;
  min-height: 42px;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8f4ea;
  font-size: 0.9rem;
}
.check-sheet h2 {
  margin: 0 0 0.25rem;
}
.check-sheet-list {
  display: grid;
  gap: 0.45rem;
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
}
.check-sheet-list li {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  line-height: 1.45;
}
.check-sheet-meta {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}
.check-sheet-prompt {
  color: var(--ink);
}
.reading-text {
  margin-bottom: 0.8rem;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--accent);
  background: #fff8ee;
  line-height: 1.65;
}
.order-list { display: grid; gap: 0.45rem; padding: 0; list-style: none; counter-reset: order; }
.order-list li {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.65rem; border: 1px solid var(--line); border-radius: 10px; background: white;
}
.order-list li::before { counter-increment: order; content: counter(order) "."; color: var(--muted); font-weight: 800; }
.order-list li > span:first-of-type { flex: 1; }
.order-actions { display: flex; gap: 0.3rem; }
.order-actions button { min-height: 34px; padding: 0.25rem 0.55rem; }
.matching-list { display: grid; gap: 0.5rem; }
.matching-list label { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 0.7rem; }
.matching-list select { min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 0.4rem; }
.answer-feedback { display: none; margin: 0.75rem 0 0; font-weight: 900; }
.task-card.is-correct { border-color: var(--correct); background: var(--correct-bg); }
.task-card.is-wrong { border-color: var(--wrong); background: var(--wrong-bg); }
.task-card.is-correct .answer-feedback { display: block; color: var(--correct); }
.task-card.is-wrong .answer-feedback { display: block; color: var(--wrong); }
.worksheet-actions { margin-top: 1rem; }
.worksheet-actions #status { flex: 1 1 100%; margin: 0; font-weight: 800; color: var(--muted); }
.empty-online { padding: 1.5rem; text-align: center; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }

.site-footer {
  width: min(70rem, calc(100% - 2rem));
  margin: 2rem auto 0;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  color: var(--muted);
}
.site-footer a { font-weight: 700; text-decoration: none; }
.site-footer a:hover,
.site-footer a[aria-current="page"] { text-decoration: underline; }

.pdf-root {
  --pdf-pad-x: 20px;
  --pdf-gap: 6px;
  position: fixed;
  left: -10000px;
  top: 0;
  width: 794px;
  background: #fff;
  color: #000;
}
.pdf-page {
  width: 794px;
  height: 1123px;
  padding: 16px var(--pdf-pad-x) 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  color: #000;
}
.pdf-probe { height: auto; }
.pdf-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1.5px solid #000;
  color: #000;
}
.pdf-header-main { min-width: 0; flex: 1; }
.pdf-qr {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.pdf-qr img { display: block; width: 92px; height: 92px; image-rendering: pixelated; }
.pdf-header .kicker { margin-bottom: 2px; color: #000; }
.pdf-header h1 { margin: 0 0 2px; color: #000; font-size: 22px; line-height: 1.15; }
.pdf-header p { margin: 1px 0 3px; color: #000; font-size: 12px; }
.pdf-tasks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: max-content;
  align-content: start;
  align-items: start;
  gap: var(--pdf-gap);
  min-height: 0;
}
.pdf-measure {
  position: absolute;
  width: calc(794px - 2 * var(--pdf-pad-x));
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: max-content;
  align-items: start;
  gap: var(--pdf-gap);
  visibility: hidden;
}
.pdf-page .task-card,
.pdf-measure .task-card {
  min-height: 0;
  overflow: hidden;
  padding: 6px 7px;
  border: 1px solid #000;
  border-radius: 4px;
  background: #fff;
  color: #000;
  box-shadow: none;
}
.pdf-page .task-card.task-reading,
.pdf-page .task-card.task-trace,
.pdf-measure .task-card.task-reading,
.pdf-measure .task-card.task-trace {
  grid-column: 1 / -1;
}
.pdf-page .task-meta,
.pdf-measure .task-meta { margin-bottom: 2px; color: #000; font-size: 11px; }
.pdf-page .task-prompt,
.pdf-measure .task-prompt {
  width: 100%;
  max-width: 100%;
  margin: 2px 0 4px;
  color: #000;
  font-size: 13px;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}
.pdf-page .picture-card,
.pdf-measure .picture-card { width: 78px; height: 78px; margin: 2px auto; background: #fff; }
.pdf-page .choice-list,
.pdf-measure .choice-list { gap: 3px; }
.pdf-page .choice span,
.pdf-measure .choice span {
  min-height: 22px;
  padding: 1px 6px;
  border-color: #000;
  background: #fff;
  color: #000;
  font-size: 13px;
}
.pdf-page .answer-input,
.pdf-measure .answer-input {
  width: 100%;
  min-height: 26px;
  height: 26px;
  border-color: #000;
  background: #fff;
  color: #000;
}
.pdf-page .umlaut-bar,
.pdf-measure .umlaut-bar { display: none; }
.pdf-page .reading-text,
.pdf-measure .reading-text {
  margin: 0 0 4px;
  padding: 3px 6px;
  border: 1px solid #000;
  border-left-width: 3px;
  background: #fff;
  color: #000;
  font-size: 12px;
  line-height: 1.3;
}
.pdf-page .pdf-order,
.pdf-measure .pdf-order {
  display: grid;
  gap: 3px;
  margin: 2px 0;
  padding: 0;
  list-style: none;
  color: #000;
  font-size: 12px;
  line-height: 1.3;
}
.pdf-page .pdf-order li,
.pdf-measure .pdf-order li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.pdf-page .pdf-order-box,
.pdf-measure .pdf-order-box {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border: 1px solid #000;
  border-radius: 2px;
  background: #fff;
}
.pdf-page .pdf-matching,
.pdf-measure .pdf-matching {
  display: grid;
  gap: 4px;
  margin: 2px 0;
  color: #000;
  font-size: 12px;
  line-height: 1.3;
}
.pdf-page .pdf-matching-row,
.pdf-measure .pdf-matching-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}
.pdf-page .pdf-matching-row > span:first-child,
.pdf-measure .pdf-matching-row > span:first-child {
  font-weight: 700;
}
.pdf-page .pdf-matching-row > span:last-child,
.pdf-measure .pdf-matching-row > span:last-child {
  text-align: right;
  font-weight: 700;
}
.pdf-page .pdf-matching-line,
.pdf-measure .pdf-matching-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pdf-page .pdf-matching-line::before,
.pdf-page .pdf-matching-line::after,
.pdf-measure .pdf-matching-line::before,
.pdf-measure .pdf-matching-line::after {
  content: "";
  width: 6px;
  height: 6px;
  border: 1.5px solid #000;
  border-radius: 50%;
  background: #fff;
}
.pdf-page .solution,
.pdf-measure .solution { color: #000; }
.pdf-page .trace-model,
.pdf-measure .trace-model { color: #a8a8a8; }
.pdf-page .lineature > span,
.pdf-measure .lineature > span { border-top-color: #333; }
.pdf-page .lineature > span:nth-child(3),
.pdf-measure .lineature > span:nth-child(3) { border-top-color: #000; }
.pdf-page footer,
.pdf-site-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid #d0d0d0;
  color: #5b6573;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
}
.pdf-site-footer-page {
  flex: 0 0 auto;
}
.pdf-site-footer-promo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  text-align: right;
}
.pdf-site-footer-text {
  max-width: 18rem;
}
.pdf-site-footer-qr {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: block;
  image-rendering: pixelated;
}
.solution { color: var(--correct); font-size: 0.85rem; }
.trace-area { display: grid; gap: 6px; margin-top: 2px; }
.lineature { position: relative; height: 42px; margin: 2px 0; }
.lineature > span { position: absolute; left: 0; right: 0; z-index: 1; border-top: 1px solid #777; }
.lineature > span:nth-child(1) { top: 0; }
.lineature > span:nth-child(2) { top: 14px; border-top-style: dashed; }
.lineature > span:nth-child(3) { top: 28px; border-top-width: 1.5px; }
.lineature > span:nth-child(4) { top: 41px; }
.trace-model {
  position: absolute;
  top: -6px;
  left: 10px;
  right: 10px;
  margin: 0;
  color: #a8a8a8;
  font-family: "Andika", "Nunito", "Comic Sans MS", "Segoe UI", system-ui, sans-serif;
  font-size: 36px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.trace-pair {
  display: inline-block;
  margin-right: 28px;
  font-weight: 600;
}
.trace-upper {
  margin-right: 5px;
  font-size: 36px;
  font-weight: 600;
}
.trace-lower {
  position: relative;
  top: 1px;
  font-size: 27px;
  font-weight: 600;
}
.trace-lower.trace-mid {
  font-size: 31px;
}
.trace-lower.trace-asc {
  font-size: 35px;
}

[hidden] { display: none !important; }
.is-hidden { display: none !important; }

.install-banner {
  position: fixed;
  left: calc(16px + env(safe-area-inset-left, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  max-width: 520px;
  margin: 0 auto;
}
body:has(.sticky-cta) .install-banner:not(.is-hidden) {
  bottom: calc(74px + env(safe-area-inset-bottom, 0px));
}
.install-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.install-banner-text {
  flex: 1 1 200px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.install-banner-text strong {
  display: block;
  color: var(--ink);
  font-size: 1.02rem;
}
.install-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.install-banner-btn {
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  white-space: nowrap;
}
.install-banner-btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.install-banner-btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.install-ios-dialog {
  width: min(26rem, calc(100% - 2rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(28, 36, 48, 0.22);
}
.install-ios-dialog::backdrop {
  background: rgba(28, 36, 48, 0.45);
  backdrop-filter: blur(3px);
}
.install-ios-card {
  padding: 1.35rem 1.4rem;
  text-align: left;
}
.install-ios-card h2 {
  margin: 0 0 0.65rem;
  text-align: center;
  font-size: 1.3rem;
}
.install-ios-steps {
  margin: 0.75rem 0 0.9rem;
  padding-left: 1.25rem;
  line-height: 1.55;
}
.install-ios-steps li + li {
  margin-top: 0.45rem;
}
.install-ios-icon {
  display: inline-block;
  font-weight: 800;
  color: var(--primary);
}
.install-ios-card .create-btn {
  width: 100%;
  margin-top: 0.6rem;
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

@media (max-width: 680px) {
  .site-header-inner { align-items: flex-start; flex-direction: column; }
  .site-header nav { gap: 0.45rem 0.8rem; font-size: 0.92rem; }
  .page { padding-top: 1.8rem; }
  .class-grid, .feature-grid, .topic-grid { grid-template-columns: 1fr 1fr; }
  .worksheet-head { display: block; }
  .worksheet-actions > button { width: 100%; }
  .install-banner {
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .install-banner-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .install-banner-actions {
    width: 100%;
  }
  .install-banner-btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 420px) {
  .class-grid, .feature-grid, .topic-grid, .term-grid { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .hero, .setup, .worksheet-actions, .site-footer, .install-banner, .install-ios-dialog { display: none !important; }
  body { background: white; }
}
