:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #5a6675;
  --blue: #1769a8;
  --blue-dark: #0f4e82;
  --yellow: #ffd545;
  --paper: #fffdf4;
  --line: rgba(23, 32, 51, 0.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: #f4f6f8;
}

body.worksheet-page {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fff8df 0, #fff8df 55px, #f4f6f8 56px);
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgba(23, 105, 168, 0.16);
}

body,
button {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--blue);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

:where(a, button):focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 40;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.worksheet-topbar {
  min-height: 56px;
  padding: 10px 18px;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--yellow);
  background: rgba(255, 253, 244, 0.96);
  box-shadow: 0 12px 30px rgba(23, 32, 51, 0.08);
}

.brand {
  display: inline-flex;
  min-width: 0;
  gap: 9px;
  align-items: center;
  color: var(--blue);
  font-weight: 900;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: var(--yellow);
  font-size: 20px;
  line-height: 1;
}

.top-links {
  display: flex;
  gap: clamp(12px, 2vw, 26px);
  align-items: center;
  color: var(--blue-dark);
  font-size: 0.9rem;
  font-weight: 850;
}

.print-actions {
  width: min(920px, calc(100vw - 32px));
  margin: 22px auto 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.print-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 11px 20px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.print-button.primary {
  background: var(--yellow);
}

.print-button.secondary {
  background: #fff;
}

.print-button:hover {
  transform: translateY(-2px);
}

.print-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}

.sheet-wrap {
  padding: 0 16px 44px;
}

.print-sheet {
  width: min(920px, 100%);
  min-height: 1188px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px);
  border: 3px solid var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.14);
}

.print-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 26px;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 3px solid var(--ink);
}

.eyebrow {
  margin: 0 0 10px;
  color: #d99a00;
  font-size: 0.84rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1,
h2 {
  letter-spacing: 0;
  text-wrap: balance;
}

h1 {
  max-width: 620px;
  margin-bottom: 12px;
  color: var(--blue);
  font-size: clamp(2.8rem, 7vw, 5.4rem);
  line-height: 0.95;
  font-weight: 950;
}

.header-copy p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.45;
}

.cover-badge {
  margin: 0;
  padding: 8px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  transform: rotate(2deg);
  box-shadow: 8px 8px 0 var(--yellow);
}

.cover-badge img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: cover;
}

.worksheet-block {
  margin-top: 22px;
  padding: 20px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fff;
}

.worksheet-block h2 {
  margin-bottom: 12px;
  color: var(--blue);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.1;
  font-weight: 950;
}

.worksheet-block p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 1.05rem;
}

.write-lines {
  min-height: 92px;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 29px,
      rgba(23, 32, 51, 0.42) 30px,
      transparent 31px
    );
}

.write-lines.short {
  min-height: 120px;
}

.draw-box {
  min-height: 390px;
  border: 2px dashed rgba(23, 32, 51, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(23, 32, 51, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(23, 32, 51, 0.04) 1px, transparent 1px),
    #fff;
  background-size: 28px 28px;
}

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

.sheet-footer {
  margin-top: 22px;
  padding-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-top: 3px solid var(--ink);
  color: var(--muted);
}

.sheet-footer p {
  margin: 0;
}

@media (max-width: 720px) {
  .worksheet-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .print-actions,
  .print-button {
    width: 100%;
  }

  .print-sheet {
    min-height: auto;
  }

  .print-header,
  .two-columns {
    grid-template-columns: 1fr;
  }

  .cover-badge {
    width: min(180px, 70vw);
    transform: none;
  }
}

@media print {
  @page {
    size: letter;
    margin: 0.32in;
  }

  html,
  body.worksheet-page {
    background: #fff;
  }

  .skip-link,
  .worksheet-topbar,
  .print-actions {
    display: none;
  }

  .sheet-wrap {
    padding: 0;
  }

  .print-sheet {
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .print-header {
    grid-template-columns: minmax(0, 1fr) 128px;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom-width: 2px;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 0.68rem;
  }

  h1 {
    max-width: 500px;
    margin-bottom: 8px;
    font-size: 2.35rem;
    line-height: 0.96;
  }

  .header-copy p:not(.eyebrow) {
    font-size: 0.9rem;
    line-height: 1.25;
  }

  .cover-badge {
    padding: 5px;
    border-width: 2px;
    box-shadow: none;
  }

  .worksheet-block {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-top: 12px;
    padding: 12px 14px;
    border-width: 2px;
  }

  .worksheet-block h2 {
    margin-bottom: 7px;
    font-size: 1.05rem;
    line-height: 1.05;
  }

  .worksheet-block p {
    margin-bottom: 6px;
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .write-lines {
    min-height: 58px;
    background:
      repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 20px,
        rgba(23, 32, 51, 0.42) 21px,
        transparent 22px
      );
  }

  .write-lines.short {
    min-height: 70px;
  }

  .draw-box {
    min-height: 255px;
    background-size: 22px 22px;
  }

  .two-columns {
    gap: 12px;
  }

  .sheet-footer {
    margin-top: 12px;
    padding-top: 9px;
    border-top-width: 2px;
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
