/* The landing page (public/index.html, written by scripts/korean/landing.ts), the legal pages and the 404:
   the alley market's materials (src/worlds/market/ink.tsx) — hanji cream, sumi ink, tteokbokki chili — and
   the app's sheets: an ink border with an offset shadow. Body text in the system face, as in the app. */
:root {
  --paper: #f6f1e7;
  --sheet: #fbf8f1;
  --ink: #2b2825;
  --ink-soft: #6b5e57;
  --line: #d9cbae;
  --accent: #c83827;
  --accent-deep: #9e2b1e;
  --board: #b98a55;
  --shadow: rgba(43, 40, 37, 0.2);
  color-scheme: only light;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

a {
  color: var(--accent);
}

.top,
main,
footer {
  max-width: 1040px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
  box-sizing: border-box;
}

/* the header: the favicon's Grandma Horang, the name and the owner's Korean name; the levels */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
  padding-bottom: 12px;
  border-bottom: 2.5px solid var(--ink);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
}
.brand span {
  display: grid;
  line-height: 1.1;
  white-space: nowrap;
}
.brand small {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.top-levels {
  display: flex;
  gap: 4px;
}
.top-levels a {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--sheet);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.9rem;
  text-decoration: none;
}
.top-levels a:hover {
  background: var(--accent);
  color: var(--sheet);
}
.top-go {
  font-weight: 700;
}

section {
  padding: 28px 0 8px;
}
.band {
  padding-top: 36px;
}

h1 {
  font-size: clamp(2rem, 7vw, 3.1rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 10px 0 14px;
}
h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.35rem;
  font-weight: 900;
  margin: 0 0 16px;
}
h2::after {
  content: "";
  flex: 1;
  border-top: 2.5px dotted var(--line);
}

.lead {
  font-size: 1.12rem;
  max-width: 34em;
  margin: 0 0 22px;
}

/* the chili button, pressed into the paper */
.go {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 13px 22px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 3px 4px 0 var(--ink);
  color: var(--sheet);
  font-weight: 800;
  font-size: 1.08rem;
  text-decoration: none;
}
.go:active {
  transform: translate(2px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}
.go small {
  font-weight: 500;
  opacity: 0.9;
}
/* the root's "Open the app" is a form's button, so a crawler finds no link to the app's shell */
.go-form {
  margin: 0;
}
button.go {
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}
.meta {
  color: var(--ink-soft);
  max-width: 36em;
}

/* the app itself, in a phone */
.phone {
  margin: 30px auto 0;
  max-width: 300px;
  text-align: center;
}
.phone img {
  display: block;
  width: 100%;
  height: auto;
  border: 10px solid var(--ink);
  border-radius: 34px;
  box-shadow: 6px 8px 0 var(--shadow);
  background: var(--ink);
}
.phone figcaption {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

/* the worlds: a sheet each, its first character's portrait, the level stamped in the corner */
ul.worlds,
ul.inside,
ul.price {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.world,
.inside li,
.price li {
  position: relative;
  border: 2.5px solid var(--ink);
  padding: 16px;
  background: var(--sheet);
  box-shadow: 3px 4px 0 var(--shadow);
}
.world {
  display: grid;
  grid-template-columns: 72px 1fr;
  column-gap: 14px;
  align-items: start;
  scroll-margin-top: 16px;
}
.world > *:not(.world-face) {
  grid-column: 2;
}
.world-face {
  grid-row: 1 / span 6;
  width: 72px;
  height: 72px;
}
.world .lv {
  position: absolute;
  top: -2.5px;
  right: 14px;
  display: grid;
  justify-items: center;
  min-width: 38px;
  padding: 4px 6px 5px;
  background: var(--accent);
  color: var(--sheet);
  font-weight: 900;
  font-size: 1.15rem;
  line-height: 1;
  border: 2.5px solid var(--ink);
  border-top: 0;
}
.world .lv small {
  font-size: 0.58rem;
  font-weight: 700;
  margin-top: 2px;
  white-space: nowrap;
}
.world-ko {
  display: block;
  margin: 0 56px 0 0;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
}
.world-en {
  display: block;
  margin: 0 56px 6px 0;
  color: var(--ink-soft);
  font-weight: 700;
}
.world p {
  margin: 0 0 6px;
}
.world .cast {
  color: var(--ink-soft);
  font-size: 0.93rem;
}
.world .n {
  display: block;
  margin-top: 4px;
  font-size: 0.88rem;
  font-weight: 800;
}

.inside b {
  display: block;
  font-size: 1.12rem;
  font-weight: 900;
  margin: 0 0 6px;
}
.inside p {
  margin: 0;
}
.price small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.price b {
  display: block;
  font-size: 1.6rem;
  font-weight: 900;
}

.end {
  padding: 40px 0 8px;
  text-align: center;
}

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 36px;
  padding-top: 18px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  border-top: 2.5px solid var(--ink);
  color: var(--ink-soft);
  font-size: 0.92rem;
}

@media (min-width: 720px) {
  ul.worlds,
  ul.inside,
  ul.price {
    grid-template-columns: 1fr 1fr;
  }
}

/* Below the side-by-side hero, the home page reads before it shows: what is inside (next in the source, so focus
   follows the screen; the picture holds nothing to focus) comes up between the hero's text and the app's picture, so
   a phone's first screen is the page's words, not the picture (korean-challenge-D34). */
@media (max-width: 899px) {
  .home {
    display: flex;
    flex-direction: column;
  }
  .home > * {
    order: 3;
  }
  .home > .hero {
    display: contents;
  }
  .home .hero-text {
    order: 0;
    padding-top: 28px;
  }
  .home #inside {
    order: 1;
  }
  .home .phone {
    order: 2;
    margin-bottom: 8px;
  }
}

@media (min-width: 900px) {
  .hero {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 48px;
    align-items: center;
  }
  .phone {
    margin: 0;
  }
}

/* The legal pages (public/privacy.html, terms.html, delete-account.html; written from the app's
   Legal.tsx by src/tests/legalPages.test.tsx): the policy's own headings and its company footer. */
.legal-page main {
  max-width: 68ch;
}
.legal-page .step-title {
  margin: 24px 0 8px;
  font-size: 26px;
  font-weight: 900;
}
.legal-page .legal h3 {
  margin: 24px 0 6px;
}
.legal-foot {
  margin-top: 28px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 14px;
}
.legal-foot p {
  margin: 2px 0;
}

/* the page /authorize serves when a learner connects an agent (oauth.html) */
.consent .warn {
  padding: 10px 12px;
  border: 2px solid var(--accent);
  background: var(--sheet);
}
.consent .warn[hidden] {
  display: none;
}
.consent .decide {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 22px;
}
.consent button {
  font: inherit;
  cursor: pointer;
}
.consent .go:disabled {
  opacity: 0.5;
  cursor: default;
}
.consent .deny {
  padding: 13px 22px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 4px;
  background: var(--sheet);
  color: var(--ink);
  font-weight: 700;
}

/* The reference pages (public/topik/, public/hangul.html, written by scripts/korean/pages.ts): the same
   sheets, ink and chili, for tables of words, the papers' formats and the free scenes. */
.trail {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.ref-page h1 small,
.ref-page h2 small {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.5em;
  font-weight: 700;
  letter-spacing: 0;
}
.ref-page h2 {
  margin-top: 30px;
}
.ref-page h3 {
  margin: 22px 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
}
.top-levels a[aria-current] {
  background: var(--accent);
  color: var(--sheet);
}
.scroll {
  overflow-x: auto;
  margin: 0 0 8px;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  border: 2.5px solid var(--ink);
  background: var(--sheet);
  box-shadow: 3px 4px 0 var(--shadow);
  font-size: 0.95rem;
}
table.data th,
table.data td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.data th {
  font-weight: 800;
  background: var(--paper);
}
table.data td[lang="ko"],
table.data th[lang="ko"] {
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
}
table.words td:first-child {
  width: 34%;
}
table.compare th:first-child {
  width: 6.5em;
}
table.chart {
  width: auto;
}
table.letters {
  max-width: 36em;
}
table.chart th,
table.chart td {
  text-align: center;
  padding: 6px 8px;
}
table.chart td span {
  display: block;
  font-size: 1.2rem;
  font-weight: 600;
}
table.chart td small {
  color: var(--ink-soft);
  font-size: 0.78rem;
}
.finals {
  font-size: 1.15rem;
  letter-spacing: 0.15em;
}
.parts b {
  color: var(--accent);
}
ol.lessons {
  padding-left: 2.6em;
}
ol.lessons li {
  margin: 0 0 6px;
}
ol.lessons .en,
.quiz .en {
  color: var(--ink-soft);
}
ol.lessons small {
  white-space: nowrap;
}
ul.cast-list {
  padding-left: 1.2em;
}
ul.cast-list li {
  margin: 0 0 6px;
}
ol.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}
ol.toc a {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--sheet);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}
.ref-page section {
  padding: 4px 0 0;
  scroll-margin-top: 12px;
}
.scene {
  margin: 0 0 16px;
  padding: 6px 16px;
  border: 2.5px solid var(--ink);
  background: var(--sheet);
  box-shadow: 3px 4px 0 var(--shadow);
}
.scene p {
  display: grid;
  grid-template-columns: 7em 1fr;
  column-gap: 12px;
  margin: 10px 0;
}
.scene b {
  grid-row: 1 / span 3;
  font-weight: 800;
}
.scene .ko {
  font-size: 1.12rem;
}
.scene .roman {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-style: italic;
}
.scene .en {
  font-size: 0.95rem;
}
ol.quiz {
  margin: 16px 0;
  padding-left: 1.4em;
}
ol.quiz > li {
  margin: 0 0 14px;
}
ol.quiz p {
  margin: 0 0 4px;
}
ol.quiz details {
  margin-top: 4px;
}
ol.quiz summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}
/* the header is ~390px at full size: on a 375 or 360px phone the levels ran past the edge and the page scrolled
   sideways (korean-challenge-D41) */
@media (max-width: 400px) {
  .top {
    gap: 8px;
  }
  .top-levels {
    gap: 3px;
  }
  .top-levels a {
    width: 24px;
    height: 24px;
    font-size: 0.82rem;
  }
}
/* a 320px phone: the levels need the name's room, and Grandma Horang alone is the brand; the app's picture keeps
   its frame inside the column */
@media (max-width: 340px) {
  /* hidden from the eye only: the link's name is this text (the icon's alt is empty) */
  .brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .phone img {
    box-sizing: border-box;
  }
}
@media (max-width: 480px) {
  .scene p {
    grid-template-columns: 1fr;
  }
  .scene b {
    grid-row: auto;
  }
}
