/* Teacher Library — white, calm, educational. Palette from the English 8 cover
   (peach band, navy, teal badge) + muted American red. System fonts only. */

:root {
  --navy: #1f2a55;
  --navy-2: #2f3b6b;
  --red: #b5473b;
  --red-soft: #f8e9e6;
  --peach: #f7b572;
  --peach-deep: #e8913a;
  --peach-soft: #fff5ea;
  --teal: #5db4cf;
  --teal-deep: #2b7f9e;
  --ink: #2b3040;
  --muted: #626877;
  --faint: #6b7180;
  --hair: #ebe6de;
  --hair-2: #f3efe9;
  --paper: #ffffff;
  --cream: #fcfaf6;
  --focus: #2b7f9e;

  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;

  --radius: 18px;
  --shadow: 0 1px 2px rgba(31, 42, 85, .05), 0 10px 30px -12px rgba(31, 42, 85, .18);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--navy); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 48px);
}
.top::before { /* a thin stars-and-stripes thread along the very top */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--navy) 0 22%, transparent 22%),
    repeating-linear-gradient(90deg, var(--red) 0 18px, #fff 18px 24px);
  opacity: .85;
}
.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  text-decoration: none;
}
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name strong { font: 600 19px/1.15 var(--serif); letter-spacing: .005em; }
.brand-name span { font-size: 12.5px; color: var(--muted); letter-spacing: .01em; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex: none;
  transition: border-color .2s, background-color .2s;
}
.link-btn:hover { border-color: #d9d2c6; background: var(--cream); }
.link-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link-btn .tr { font-weight: 400; color: var(--muted); }

/* ---------- shared bits ---------- */
.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--red);
}
.eyebrow .tr { color: var(--faint); font-weight: 600; }
.tr { color: var(--muted); font-weight: 400; }
.ribbon { display: block; width: 92px; height: 18px; margin: 0 0 16px; }
.ribbon svg { width: 100%; height: 100%; overflow: visible; }

/* ---------- login ---------- */
.login {
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  padding: 12px 16px 0;
}
.login::before, .shelf-page::before { /* faint dotted exercise-book paper behind the content */
  content: "";
  position: absolute;
  inset: -90px 0 0;
  z-index: -1;
  background-image: radial-gradient(circle, #e4ddd1 1.1px, transparent 1.4px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 35%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 60% 70% at 50% 35%, #000 20%, transparent 75%);
  pointer-events: none;
}
.card {
  width: 100%;
  max-width: 452px;
  padding: 34px 36px 30px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--hair);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.card h1 {
  margin: 0 0 8px;
  font: 600 clamp(28px, 3.2vw, 34px)/1.15 var(--serif);
  color: var(--navy);
  letter-spacing: -.005em;
}
.lead { margin: 0 0 22px; color: var(--muted); font-size: 15px; }
.lead .tr { display: block; margin-top: 2px; font-size: 13.5px; color: var(--faint); }

.field { display: block; margin: 0 0 16px; }
.field-label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--navy); }
.field-label .tr { font-weight: 400; font-size: 13px; color: var(--faint); }
.input-wrap { position: relative; display: block; }
.field input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1px solid #ddd6cb;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: 16px var(--sans);
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: #a5a9b4; }
.field input:hover { border-color: #cdc4b6; }
.field input:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 4px rgba(247, 181, 114, .35); }
.field input[aria-invalid="true"] { border-color: var(--red); }
.has-toggle input { padding-right: 52px; }
.toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.toggle:hover { background: var(--hair-2); color: var(--navy); }
.toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.toggle .eye-off { display: none; }
.toggle[aria-pressed="true"] .eye { display: none; }
.toggle[aria-pressed="true"] .eye-off { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font: 600 16px var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, transform .2s;
}
.btn:hover { background: var(--navy-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
.btn:hover svg { transform: translateX(3px); }
.btn .tr { color: rgba(255, 255, 255, .72); font-weight: 400; }
.btn[disabled] { opacity: .7; cursor: progress; }
.btn-block { width: 100%; margin-top: 6px; }

.alert {
  display: flex;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #efcfc9;
  border-radius: 12px;
  background: var(--red-soft);
  color: #7c2d24;
  font-size: 14px;
  line-height: 1.45;
}
.alert[hidden] { display: none; }
.alert svg { flex: none; width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: var(--red); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.alert strong { display: block; color: #6a241c; }
.alert span { display: block; color: #8f4a41; }

.note {
  display: flex;
  gap: 10px;
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px dashed var(--hair);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.note svg { flex: none; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--teal-deep); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.note .tr { display: block; color: var(--faint); }

/* ---------- scene (line-art panorama, built by scene.js) ---------- */
.scene {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: -80px;
  pointer-events: none;
  user-select: none;
}
.scene > svg { width: 100%; height: auto; max-height: 360px; overflow: hidden; }
.scene-library { margin-top: 8px; }

.ln { fill: none; stroke: var(--navy); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ln-thin { stroke-width: 1; opacity: .7; }
.ln-far { stroke: #a9b0c6; stroke-width: 1.2; }
.ln-teal { stroke: var(--teal-deep); }
.ln-red { stroke: var(--red); }
.ln-peach { stroke: var(--peach-deep); }
.fill-peach { fill: var(--peach); }
.fill-peach-soft { fill: var(--peach-soft); }
.fill-white { fill: #fff; }
.fill-navy { fill: var(--navy); }
.fill-red { fill: var(--red); }
.water { stroke: var(--teal); stroke-width: 1.4; stroke-linecap: round; opacity: .55; }
.lane { stroke: #c9c3b8; stroke-width: 1.6; stroke-dasharray: 18 16; stroke-linecap: round; }

/* draw-in: scene.js sets each stroke's dasharray/dashoffset to its length; it traces itself once, staggered by --d */
.draw { animation: draw var(--t, 2.4s) cubic-bezier(.45, .05, .25, 1) var(--d, 0s) forwards; }
.fade { opacity: 0; animation: fade 1.6s ease var(--d, 0s) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
.water-drift { animation: drift 7s ease-in-out infinite alternate; }
.water-drift.b { animation-duration: 9s; animation-delay: -3s; }
@keyframes drift { from { transform: translateX(-7px); } to { transform: translateX(7px); } }

/* ---------- sign-in stage: book preview · form · word of the day ---------- */
.stage {
  width: 100%;
  max-width: 1240px;
  display: grid;
  grid-template-columns: minmax(0, 452px);
  grid-template-areas: "card" "book" "word";
  justify-content: center;
  align-items: center;
  gap: 28px;
}
.stage .card { grid-area: card; justify-self: center; }
/* the stage overlaps the top of the drawing: let clicks through to the landmarks */
.page-login .login { pointer-events: none; }
.stage .card, .stage .side { pointer-events: auto; }
.side-book { grid-area: book; }
.side-word { grid-area: word; }
.side[hidden] { display: none; }
.side-label {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--red);
}
.side-label .tr { display: block; margin-top: 3px; color: var(--faint); font-weight: 600; letter-spacing: .02em; text-transform: none; }

/* typed greeting above the title */
.greet { margin: 0 0 4px; min-height: 1.45em; font: italic 500 19px/1.45 var(--serif); color: var(--red); }
.greet-line { white-space: nowrap; }
.caret {
  display: inline-block;
  width: 1.5px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -.12em;
  background: currentColor;
}
.greet.is-holding .caret { animation: caret 1.1s steps(1) infinite; }
.greet.is-still .caret { display: none; }
@keyframes caret { 50% { opacity: 0; } }
.card.is-called { animation: called 1.6s ease; }
@keyframes called {
  0%, 30% { border-color: var(--peach); box-shadow: var(--shadow), 0 0 0 5px rgba(247, 181, 114, .4); }
  100% { border-color: var(--hair); box-shadow: var(--shadow), 0 0 0 0 rgba(247, 181, 114, 0); }
}

/* book preview: a closed English 8 that opens a little on hover */
.side-book { display: grid; justify-items: center; gap: 22px; text-align: center; }
.book3d {
  --bw: 150px;
  position: relative;
  width: var(--bw);
  aspect-ratio: 320 / 417;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  perspective: 1000px;
}
.book3d::after { /* soft contact shadow on the table */
  content: "";
  position: absolute;
  left: -4%;
  right: -14%;
  bottom: -9px;
  height: 16px;
  background: radial-gradient(ellipse at 45% 50%, rgba(31, 42, 85, .2), rgba(31, 42, 85, 0) 70%);
  z-index: -1;
}
.book3d-body {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
  transform: rotateX(4deg) rotateY(-26deg);
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
.book3d-cover, .book3d-page, .book3d-back, .book3d-edge { position: absolute; display: block; }
.book3d-cover {
  inset: 0;
  overflow: hidden;
  border-radius: 2px 5px 5px 2px;
  background: var(--peach);
  transform-origin: left center;
  transform: translateZ(9px);
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08), 6px 14px 26px -12px rgba(31, 42, 85, .5);
}
.book3d-cover img { width: 100%; height: 100%; object-fit: cover; }
.book3d-cover::after { /* spine crease */
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 9px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .2), rgba(255, 255, 255, .25) 55%, rgba(0, 0, 0, 0));
}
.book3d-page {
  inset: 3px 3px 3px 0;
  overflow: hidden;
  padding: 16% 12% 0 14%;
  border-radius: 0 3px 3px 0;
  background: #fffdf9;
  transform: translateZ(8px);
  box-shadow: inset 6px 0 10px -8px rgba(31, 42, 85, .35);
  text-align: left;
}
.book3d-page-unit { display: block; font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.book3d-page-title { display: block; margin-top: 4px; font: 600 12px/1.2 var(--serif); color: var(--navy); }
.book3d-page-lines {
  display: block;
  height: 46%;
  margin-top: 10px;
  background: repeating-linear-gradient(180deg, #e6e0d6 0 1px, transparent 1px 9px);
}
.book3d-edge { /* the block of pages, seen on the right */
  top: 3px;
  bottom: 3px;
  right: -8px;
  width: 16px;
  background: repeating-linear-gradient(90deg, #fffdf9 0 1.5px, #e7e0d4 1.5px 2.5px);
  transform: rotateY(90deg);
}
.book3d-back {
  inset: 0;
  border-radius: 2px 5px 5px 2px;
  background: #e9a35f;
  transform: translateZ(-9px);
}
.book3d:hover .book3d-body, .book3d:focus-visible .book3d-body { transform: rotateX(3deg) rotateY(-16deg); }
.book3d:hover .book3d-cover, .book3d:focus-visible .book3d-cover { transform: translateZ(9px) rotateY(-34deg); }
.book3d:focus-visible { outline-offset: 8px; }
.book-meta { min-width: 0; }
.book-meta h2 { margin: 0; font: 600 26px/1.15 var(--serif); color: var(--navy); }
.book-level { margin: 4px 0 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.chips li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 8px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  white-space: nowrap;
}
.chips svg { width: 15px; height: 15px; fill: none; stroke: var(--peach-deep); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.book3d-page-cta { position: absolute; left: 14%; bottom: 9%; font-size: 9.5px; font-weight: 700; color: var(--teal-deep); white-space: nowrap; }

/* word of the day: a 3 x 5 index card that turns over */
.side-word { display: flex; flex-direction: column; align-items: center; text-align: center; }
.wotd { position: relative; width: 100%; max-width: 300px; perspective: 1200px; }
.wotd-flip {
  display: block;
  width: 100%;
  height: 186px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: opacity .18s ease, transform .18s ease;
}
.wotd-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotate(-1.4deg);
  transition: transform .75s cubic-bezier(.2, .7, .2, 1);
}
.wotd-flip:hover .wotd-inner { transform: rotate(-.4deg) translateY(-2px); }
.wotd.is-flipped .wotd-inner { transform: rotate(1deg) rotateY(180deg); }
.wotd.is-turning .wotd-flip { opacity: 0; transform: translateX(12px); }
.wotd-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0 18px 10px 22px;
  border: 1px solid #e6e0d6;
  border-radius: 4px;
  background-color: #fff;
  /* red headline rule, blank top, then pale blue ruled lines */
  background-image:
    linear-gradient(180deg, transparent 45px, rgba(181, 71, 59, .5) 45px 46.5px, transparent 46.5px),
    linear-gradient(180deg, #fff 0 46px, transparent 46px),
    repeating-linear-gradient(180deg, transparent 0 25px, #dbe6ee 25px 26px);
  box-shadow: 0 1px 2px rgba(31, 42, 85, .06), 0 14px 28px -16px rgba(31, 42, 85, .35);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.wotd-back { transform: rotateY(180deg); }
.wotd-word { font: 600 30px/46px var(--serif); color: var(--navy); letter-spacing: -.005em; }
.wotd-ipa { margin-top: 1px; font-size: 16px; line-height: 26px; color: var(--ink); }
.wotd-pos { font: italic 14px/26px var(--serif); color: var(--muted); }
.wotd-cta { display: flex; align-items: center; gap: 6px; margin-top: auto; font-size: 12px; line-height: 26px; color: var(--muted); }
.wotd-cta svg, .wotd-next svg { flex: none; width: 15px; height: 15px; fill: none; stroke: var(--teal-deep); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wotd-cta .tr { color: var(--faint); }
.wotd-from { order: -1; font-size: 11.5px; line-height: 46px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.wotd-tr { display: flex; align-items: baseline; gap: 8px; margin-top: 1px; font-size: 15px; line-height: 25px; color: var(--ink); }
.wotd-tr b { flex: none; width: 24px; font-size: 10.5px; letter-spacing: .08em; color: var(--teal-deep); }
.wotd-ex { margin-top: 2px; font: italic 14.5px/26px var(--serif); color: var(--navy-2); }
.wotd-ex mark { padding: 0 1px; color: inherit; background: linear-gradient(180deg, transparent 58%, rgba(247, 181, 114, .55) 58%); }
.wotd-say {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hair);
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  transition: background-color .2s, border-color .2s;
}
.wotd-say:hover { background: var(--cream); border-color: #d9d2c6; }
.wotd-say[hidden] { display: none; }
.wotd-say svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wotd-say.is-speaking .w1 { animation: sound .9s ease-in-out infinite; }
.wotd-say.is-speaking .w2 { animation: sound .9s ease-in-out .15s infinite; }
@keyframes sound { 50% { opacity: .25; } }
.wotd-next {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 16px 0 0;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--navy);
  font: 600 13.5px var(--sans);
  cursor: pointer;
}
.wotd-next:hover { background: var(--hair-2); }
.wotd-next { text-align: left; line-height: 1.3; }
.wotd-next .tr { display: block; font-size: 12px; font-weight: 400; }

/* ---------- interactive scene (sign-in page) ---------- */
.scene-login { position: relative; }
.scene-hint {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto 4px;
  padding: 0 16px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  text-align: left;
}
.scene-hint .tr { display: block; color: var(--faint); }
.scene-hint svg { flex: none; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--teal-deep); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.scene .hot { pointer-events: auto; cursor: pointer; outline: none; }
.scene .hit { fill: transparent; stroke: none; }
.scene .ring { fill: none; stroke: var(--focus); stroke-width: 2; opacity: 0; }
.scene .hot:focus-visible .ring { opacity: 1; }
.scene .hot .ln { transition: stroke-width .25s ease, stroke .6s ease; }
.scene .hot:hover .ln, .scene .hot.is-active .ln { stroke-width: 2.1; }
.scene .hot:hover .ln-thin, .scene .hot.is-active .ln-thin { stroke-width: 1.4; }
.beep { opacity: 0; pointer-events: none; transform-box: fill-box; transform-origin: 20% 100%; transform: scale(.6); transition: opacity .2s ease, transform .35s cubic-bezier(.3, 1.5, .5, 1); }
.beep.is-on { opacity: 1; transform: none; }
.beep-text { font: 700 12px var(--sans); fill: var(--navy); }
.plane-g { opacity: 0; transition: opacity .9s ease; }
.plane-g.is-flying { opacity: 1; transition-duration: .3s; }
.trail { fill: none; stroke: var(--navy-2); stroke-width: 1.2; stroke-dasharray: 1 6; stroke-linecap: round; opacity: .45; }

/* day -> evening (click the sun): a warm wash, lit windows, the bridge "necklace", the moon */
.dusk { opacity: 0; transition: opacity 1.8s ease; }
.night { opacity: 0; transition: opacity 1.4s ease .3s; }
.is-evening .dusk, .is-evening .night { opacity: 1; }
.ln-moon { fill: #fff; stroke: var(--navy-2); stroke-width: 1.3; stroke-linejoin: round; }
.star { opacity: .5; }
.sun { transition: transform 1.8s cubic-bezier(.4, 0, .2, 1); }
.is-evening .sun { transform: translateY(14px); }
.sun-fill { fill: var(--peach-soft); transition: fill 1.8s ease; }
.is-evening .sun-fill { fill: #fcd9b0; }
.sun-line { transition: stroke 1.8s ease; }
.is-evening .sun-line { stroke: #d4772a; }
.win, .lamp { opacity: 0; transition: opacity .8s ease var(--wd, 0s); }
.win { fill: var(--peach); }
.lamp { fill: var(--peach-deep); }
.is-evening .win { opacity: .9; }
.is-evening .lamp { opacity: 1; }
.ln-far { transition: stroke 1.6s ease; }
.is-evening .ln-far { stroke: #8d95b2; }

/* fact card next to a landmark */
.tip {
  position: absolute;
  z-index: 20;
  width: 292px;
  max-width: calc(100vw - 24px);
  padding: 12px 16px 12px;
  border: 1px solid var(--hair);
  border-top: 3px solid var(--navy);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.42;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
}
.tip[hidden] { display: none; }
.tip.is-on { opacity: 1; transform: none; }
.tip p { margin: 0; }
.tip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px !important; }
.tip-title { font: 600 17px/1.2 var(--serif); color: var(--navy); }
.tip-tag { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--red-soft); color: var(--red); font-size: 11.5px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.tip-en { margin-bottom: 6px !important; }
.tip-tr { color: var(--muted); font-size: 12px; }
.tip-tr + .tip-tr { margin-top: 2px !important; }

/* ---------- library ---------- */
.shelf-page {
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 48px) 0;
}
.shelf-head { margin: 0 0 30px; }
.shelf-head h1 {
  margin: 0;
  font: 600 clamp(32px, 4.2vw, 46px)/1.1 var(--serif);
  color: var(--navy);
  letter-spacing: -.01em;
}
.shelf-head h1 .tr { display: block; margin-top: 6px; font: 400 clamp(17px, 1.8vw, 20px)/1.3 var(--sans); color: var(--faint); letter-spacing: 0; }
.shelf-head p:not(.eyebrow) { margin: 14px 0 0; max-width: 620px; color: var(--muted); }

.books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 470px), 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.book {
  position: relative;
  display: grid;
  grid-template-columns: 158px 1fr;
  grid-template-areas: "cover body" "cover open";
  grid-template-rows: auto 1fr;
  column-gap: 26px;
  align-items: start;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s;
}
.book:hover { transform: translateY(-3px); box-shadow: 0 1px 2px rgba(31, 42, 85, .05), 0 18px 40px -16px rgba(31, 42, 85, .26); }
.cover {
  position: relative;
  grid-area: cover;
  display: block;
  aspect-ratio: 1575 / 2048;
  border-radius: 3px 8px 8px 3px;
  background: var(--peach) linear-gradient(180deg, var(--peach) 0 44%, #fff 44% 46.5%, var(--teal) 46.5%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08), 4px 10px 22px -10px rgba(31, 42, 85, .45);
  overflow: hidden;
  transform: perspective(700px) rotateY(-7deg);
  transform-origin: left center;
  transition: transform .45s cubic-bezier(.2, .7, .2, 1);
}
.book:hover .cover { transform: perspective(700px) rotateY(-2deg); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover::after { /* spine crease */
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 9px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .18), rgba(255, 255, 255, .25) 55%, rgba(0, 0, 0, 0));
}
.book-body { grid-area: body; display: flex; flex-direction: column; }
.badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 12px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: #eaf5f9;
  color: var(--teal-deep);
  font-size: 12.5px;
  font-weight: 600;
}
.badge b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--teal-deep); color: #fff; font-size: 12px; }
.book h2 { margin: 0; font: 600 28px/1.15 var(--serif); color: var(--navy); }
.book .level { margin: 6px 0 0; color: var(--ink); font-weight: 600; font-size: 15px; }
.book .by { margin: 10px 0 0; color: var(--muted); font-size: 14px; font-style: italic; }
.book .feats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 14px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.book .feats li { display: inline-flex; align-items: center; gap: 6px; }
.book .feats svg { width: 15px; height: 15px; fill: none; stroke: var(--peach-deep); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.book .open { grid-area: open; align-self: end; padding-top: 20px; }
.book .open .btn { min-height: 46px; }

.book-soon {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 24px;
  border: 1.5px dashed #e3ddd2;
  border-radius: var(--radius);
  background: transparent;
  color: var(--faint);
  text-align: center;
  font-size: 14px;
}
.book-soon svg { width: 46px; height: 46px; margin: 0 auto 12px; fill: none; stroke: #c4bcae; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.book-soon strong { display: block; color: var(--muted); font: 600 17px/1.3 var(--serif); }

.status { color: var(--muted); }

/* ---------- footer ---------- */
.foot {
  position: relative;
  z-index: 2;
  padding: 4px 16px 14px;
  background: #fff;
  color: var(--faint);
  font-size: 12.5px;
  text-align: center;
}

/* ---------- sign-in stage layouts ---------- */
@media (max-width: 1179px) {
  .scene-login { margin-top: 12px; }
  .side-book { grid-template-columns: auto 1fr; justify-items: start; align-items: center; gap: 26px; text-align: left; }
  .side-book .chips { justify-content: flex-start; }
  .book3d { --bw: 118px; }
}
@media (min-width: 700px) and (max-width: 1179px) {
  .stage { max-width: 780px; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "card card" "book word"; gap: 36px 32px; align-items: start; }
  .stage .card { width: 100%; max-width: 452px; }
}
@media (min-width: 1180px) {
  .stage {
    grid-template-columns: minmax(230px, 290px) minmax(0, 452px) minmax(230px, 290px);
    grid-template-areas: "book card word";
    column-gap: clamp(40px, 5vw, 84px);
  }
  .scene-hint { position: absolute; z-index: 2; left: 20px; top: 64px; max-width: min(214px, calc(16.8vw - 36px)); /* stays left of the statue */ margin: 0; padding: 0; justify-content: flex-start; }
}

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  .side-book { gap: 20px; }
  .book3d { --bw: 96px; }
  .book-meta h2 { font-size: 23px; }
  .chips li { font-size: 12px; padding: 3px 9px 3px 7px; }
  .greet { font-size: 18px; }
  .top { padding-top: 16px; padding-bottom: 12px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name strong { font-size: 17px; }
  .link-btn .tr { display: none; }
  .card { padding: 26px 20px 22px; border-radius: 18px; }
  .scene { margin-top: 0; }
  .login::before { display: none; }
  .brand-name span { font-size: 11px; max-width: 160px; }
  .book { grid-template-columns: 104px 1fr; grid-template-areas: "cover body" "open open"; column-gap: 16px; padding: 18px; }
  .book h2 { font-size: 23px; }
  .book .feats { display: none; }
  .book .open { padding-top: 18px; }
  .book .open .btn { width: 100%; }
  .book-soon { min-height: 150px; }
}

/* ---------- large boards ---------- */
@media (min-width: 1700px) {
  body { font-size: 17px; }
  .card { max-width: 480px; }
  .shelf-page { max-width: 1280px; }
  .stage { max-width: 1400px; grid-template-columns: minmax(250px, 330px) minmax(0, 480px) minmax(250px, 330px); }
  .book3d { --bw: 172px; }
  .wotd { max-width: 330px; }
  .wotd-flip { height: 200px; }
  .scene > svg { max-height: 440px; }
}

@media (prefers-reduced-motion: reduce) {
  .draw { animation: none; stroke-dasharray: none !important; stroke-dashoffset: 0 !important; }
  .fade { animation: none; opacity: 1; }
  .water-drift { animation: none; }
  .book, .cover, .btn, .btn svg { transition: none; }
  .book3d-body, .book3d-cover, .wotd-inner, .wotd-flip, .tip, .beep, .plane-g,
  .dusk, .night, .sun, .sun-fill, .sun-line, .win, .lamp, .ln-far, .scene .hot .ln { transition: none; }
  .card.is-called, .wotd-say.is-speaking .w1, .wotd-say.is-speaking .w2, .greet.is-holding .caret { animation: none; }
}
