:root {
  --paper: #fbfaf5;
  --sheet: #fff;
  --grid: rgba(70, 110, 180, .12);
  --rule-line: rgba(70, 110, 180, .24);
  --ink: #1c2541;
  --muted: #535c74;
  --blue: #2443a6;
  --blue-dark: #152a72;
  --red: #cf3a2a;
  --yellow: #ffe372;
  --display: "Unbounded", "Arial Black", sans-serif;
  --sans: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Literata", Georgia, serif;
  --hand: "Caveat", "Segoe Print", cursive;
  --brush: "Ma Shan Zheng", "Kaiti SC", "KaiTi", serif;
  --pad: clamp(16px, 5vw, 64px);
  --rule: 34px;
  --lift: 0 1px 2px rgba(28, 37, 65, .07), 0 22px 44px -26px rgba(28, 37, 65, .38);
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font: 400 17px/1.6 var(--sans); color: var(--ink); -webkit-font-smoothing: antialiased;
  /* squared exercise-book paper */
  background: linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
              linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
              var(--paper);
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 2.5px solid var(--red); outline-offset: 3px; border-radius: 4px; }
:lang(uk) q { quotes: "«" "»"; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--blue); color: #fff; padding: 10px 16px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* red-pen marks */
.pen { position: absolute; overflow: visible; pointer-events: none; fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pen path { vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; }
.js .pen path { stroke-dashoffset: 1; transition: stroke-dashoffset .9s cubic-bezier(.6, .1, .3, 1) var(--delay, 0s); }
.js .pen.on path { stroke-dashoffset: 0; }
.note { font: 600 1.65rem/1.1 var(--hand); color: var(--red); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 1rem/1.2 var(--sans); color: #fff; background: var(--blue); padding: 15px 26px; border-radius: 12px; box-shadow: 0 4px 0 var(--blue-dark); transition: transform .12s, box-shadow .12s, background .12s; }
.btn:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--blue-dark); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--blue-dark); }
.btn-small { padding: 10px 18px; font-size: .92rem; box-shadow: 0 3px 0 var(--blue-dark); }
.chip { display: inline-block; font: 500 .95rem/1.2 var(--sans); padding: 9px 16px; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--sheet); transition: background .15s; }
.chip:hover { background: var(--yellow); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px var(--pad); }
.name { font: 700 1rem/1 var(--display); letter-spacing: -.01em; }
.top-right { display: flex; align-items: center; gap: 14px; }
.lang { font: 600 .85rem/1 var(--sans); padding: 8px 10px; border-radius: 8px; }
.lang:hover { background: var(--yellow); }

/* hero */
.hero { display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; gap: clamp(24px, 5vw, 72px); min-height: calc(100svh - 72px); max-width: 1320px; margin: 0 auto; padding: 8px var(--pad) 56px; }
.note-hero { display: inline-flex; align-items: flex-start; transform: rotate(-3deg); margin-left: 4px; }
.pen-arrow { position: relative; width: 56px; height: 40px; margin: 12px 0 0 10px; --delay: .9s; }
h1 { font: 700 clamp(2.3rem, 6vw, 5.2rem)/1.12 var(--display); letter-spacing: -.035em; margin: 6px 0 26px; }
h1 > span { display: block; }
.line2 { white-space: nowrap; margin-top: .06em; }
.mark { position: relative; display: inline-block; white-space: nowrap; }
.and { display: inline-block; font: 700 1.05em/1 var(--hand); color: var(--red); letter-spacing: 0; margin-right: .42em; transform: rotate(-8deg) translateY(.04em); }
.pen-under { left: 0; bottom: -.12em; width: 100%; height: .22em; --delay: .2s; }
.pen-circle { left: -4%; top: -2%; width: 108%; height: 112%; --delay: .55s; }
.h1-small { font: 500 clamp(1.05rem, 1.7vw, 1.45rem)/1.3 var(--sans); letter-spacing: 0; color: var(--muted); margin-top: 18px; }
.lead { max-width: 33rem; font-size: 1.1rem; color: var(--muted); margin-bottom: 20px; }
.creds { display: flex; flex-wrap: wrap; gap: 8px 24px; font-weight: 500; }
.creds li { display: inline-flex; align-items: center; gap: 8px; }
.pen-tick { position: relative; width: 20px; height: 20px; stroke-width: 2.6; flex: none; }
.creds li:nth-child(1) .pen-tick { --delay: 1.1s; }
.creds li:nth-child(2) .pen-tick { --delay: 1.3s; }
.creds li:nth-child(3) .pen-tick { --delay: 1.5s; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-top: 32px; }
.or { font: 600 1.45rem/1 var(--hand); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* polaroid */
.scrap { position: relative; width: min(100%, 420px); justify-self: center; padding: 24px 0 40px; }
.polaroid { position: relative; width: 100%; background: var(--sheet); padding: 14px 14px 0; box-shadow: var(--lift); transform: rotate(2.5deg); }
.polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.polaroid figcaption { font: 600 1.9rem/1 var(--hand); text-align: center; padding: 14px 0 18px; }
.tape { position: absolute; z-index: 1; top: -15px; left: 50%; width: 118px; height: 32px; background: rgba(140, 175, 230, .55); transform: translateX(-50%) rotate(-4deg); clip-path: polygon(3% 0, 97% 4%, 100% 50%, 96% 100%, 2% 96%, 0 50%); }

/* subjects: ruled sheet + Chinese practice grid */
.subjects { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 3vw, 40px); max-width: 1320px; margin: 0 auto; padding: clamp(16px, 3vw, 32px) var(--pad) clamp(24px, 5vw, 56px); }
.sheet { position: relative; background: var(--sheet); box-shadow: var(--lift); padding: var(--rule) clamp(24px, 4vw, 48px) calc(var(--rule) * 1.5); line-height: var(--rule); }
.sheet-en {
  --margin: clamp(44px, 5vw, 64px);
  padding-left: calc(var(--margin) + 22px);
  background: linear-gradient(90deg, transparent calc(var(--margin) - 1px), rgba(207, 58, 42, .5) 0 calc(var(--margin) + 1px), transparent 0),
              repeating-linear-gradient(transparent 0 calc(var(--rule) - 1px), var(--rule-line) 0 var(--rule)) 0 calc(var(--rule) * 3 - 8px) / 100% calc(100% - var(--rule) * 4.5) no-repeat,
              var(--sheet);
}
.sheet header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; }
.sheet h2 { font: 700 clamp(1.7rem, 3vw, 2.5rem)/calc(var(--rule) * 2) var(--display); letter-spacing: -.03em; }
.ipa { font-size: 1.05rem; color: var(--muted); }
.sheet-sub { font-weight: 500; }
.lines li { padding-left: 1.3em; position: relative; }
.lines li::before { content: "—"; position: absolute; left: 0; color: var(--blue); }
.note-sheet { display: block; width: fit-content; line-height: var(--rule); transform: rotate(-2deg); margin: 0 0 0 -4px; }
.note-exam { display: block; line-height: var(--rule); }
.sheet-foot { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin-top: calc(var(--rule) * .5); padding: 10px 0 4px; background: var(--sheet); }
.sheet-foot .btn { order: 1; }
/* on the ruled sheet, the price row covers the lines from the margin to the edge */
.sheet-en .sheet-foot { margin-left: -20px; padding-left: 20px; margin-right: calc(-1 * clamp(24px, 4vw, 48px)); }
.sheet-price { display: flex; flex-direction: column; line-height: 1.25; }
.sheet-price strong { font: 700 1.5rem/1.1 var(--display); letter-spacing: -.02em; white-space: nowrap; }
.sheet-price span { font-size: .95rem; color: var(--muted); }

.grid-chars { position: absolute; top: 26px; right: clamp(20px, 3vw, 40px); display: flex; }
.cell { position: relative; width: 92px; height: 92px; margin-top: 30px; display: grid; place-items: center; font: 400 4.2rem/1 var(--brush); border: 1.5px solid rgba(207, 58, 42, .65);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 92 92'%3E%3Cg stroke='%23cf3a2a' stroke-opacity='.35' stroke-dasharray='4 4'%3E%3Cpath d='M46 0v92M0 46h92M0 0l92 92M92 0L0 92'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100%; }
.cell + .cell { border-left: 0; }
/* four-line pinyin strip above each square, as in Chinese practice books */
.cell i { position: absolute; bottom: 100%; left: -1.5px; right: -1.5px; height: 30px; font: 600 1.45rem/30px var(--hand); font-style: normal; color: var(--red); text-align: center;
  background: repeating-linear-gradient(transparent 0 6.5px, rgba(207, 58, 42, .35) 6.5px 7.5px); border: 1.5px solid rgba(207, 58, 42, .65); border-bottom: 0; }
.cell + .cell i { left: 0; border-left: 0; }

/* about (dictionary entry) + how to start */
.bottom { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(28px, 5vw, 72px); align-items: center; max-width: 1320px; margin: 0 auto; padding: clamp(24px, 4vw, 48px) var(--pad) clamp(48px, 7vw, 88px); scroll-margin-top: 16px; }
.dict { background: var(--sheet); box-shadow: var(--lift); padding: clamp(22px, 3.5vw, 40px) clamp(20px, 3.5vw, 44px); font: 400 1.05rem/1.6 var(--serif); transform: rotate(-.6deg); }
.dict-photo { float: right; width: 36%; max-width: 210px; margin: 4px 0 12px 22px; padding: 6px; border: 1px solid var(--ink); }
.dict-photo img { aspect-ratio: 4 / 5; object-fit: cover; }
.dict h2 { overflow: hidden; font: 700 1.9rem/1.2 var(--serif); letter-spacing: -.01em; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1.5px solid var(--ink); }
.senses { counter-reset: s; }
.senses li { counter-increment: s; margin: 6px 0; }
.senses li::before { content: counter(s) ". "; font-weight: 700; }
.example { margin-top: 14px; }

.start .note-title { font-size: 2.6rem; font-weight: 700; transform: rotate(-2deg); transform-origin: left; margin-bottom: 10px; }
.steps { counter-reset: n; }
.steps li { counter-increment: n; display: grid; grid-template-columns: 40px 1fr; align-items: baseline; padding: 12px 0; border-bottom: 1.5px dashed var(--rule-line); }
.steps li::before { content: counter(n); font: 700 2.1rem/1 var(--hand); color: var(--blue); }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
/* first contact option is the main one; the rest are quieter */
.btn-contact + .btn-contact { background: var(--sheet); color: var(--ink); box-shadow: 0 4px 0 var(--ink); outline: 1.5px solid var(--ink); outline-offset: -1.5px; }
.btn-contact + .btn-contact:hover { box-shadow: 0 2px 0 var(--ink); }
.facts { margin-top: 18px; font-size: .92rem; color: var(--muted); }

/* reviews as sticky notes */
.reviews { display: flex; flex-wrap: wrap; justify-content: center; gap: 28px; max-width: 1320px; margin: 0 auto; padding: 0 var(--pad) clamp(48px, 7vw, 88px); }
.sticky-review { width: min(300px, 100%); padding: 22px 20px 18px; background: linear-gradient(172deg, #ffeb8f, var(--yellow)); box-shadow: 0 16px 22px -14px rgba(28, 37, 65, .45); transform: rotate(-2deg); }
.sticky-review blockquote { font: 600 1.45rem/1.2 var(--hand); margin-bottom: 12px; }
.sticky-review figcaption { font: 500 .88rem/1.4 var(--sans); }
.sticky-review.s1 { transform: rotate(2deg); background: linear-gradient(172deg, #d9f0ff, #c3e3fb); }
.sticky-review.s2 { transform: rotate(-1.5deg); background: linear-gradient(172deg, #ffe0e6, #ffcfd9); }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 20px var(--pad); border-top: 1px solid var(--rule-line); font-size: .88rem; color: var(--muted); }
.foot .note { font-size: 1.35rem; }

.notfound { min-height: 100vh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 14px; padding: var(--pad); }
.notfound h1 { font-size: clamp(4rem, 14vw, 7rem); margin-bottom: 20px; }

/* responsive */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-bottom: 24px; }
  .scrap { width: min(86%, 380px); }
  .subjects, .bottom { grid-template-columns: 1fr; }
  .bottom { max-width: 760px; }
  .subjects { max-width: 760px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top { padding-top: 14px; padding-bottom: 6px; }
  .name { font-size: .8rem; white-space: nowrap; }
  .top-right { gap: 4px; }
  .top .btn-small { font-size: .8rem; padding: 9px 12px; white-space: nowrap; }
  h1 { font-size: clamp(1.9rem, 9.4vw, 2.5rem); }
  .hero-cta .btn { flex: 1 1 100%; }
  .sheet-en { --margin: 34px; padding-left: 50px; }
  .grid-chars { position: static; margin: -4px 0 14px; }
  .cell { width: 76px; height: 76px; font-size: 3.4rem; }
  .dict-photo { width: 34%; margin-left: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .pen path { stroke-dashoffset: 0; transition: none; }
  .btn, .chip { transition: none; }
}
