html, body { height: 100%; }
/* the page never zooms: no double-tap zoom on buttons and panels */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
:root { --serif: "Shippori Mincho", "Hiragino Mincho ProN", serif; }
/* English: decided before the page is drawn; hidden until applied */
html[lang="en"] { --serif: "EB Garamond", "Shippori Mincho", Georgia, serif; }
html.lang-wait body { visibility: hidden; }
html[lang="en"] .l-ja, html:not([lang="en"]) .l-en { display: none; }
body {
  margin: 0;
  overflow: hidden;
  font-family: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", sans-serif;
  --ink: #ece5d3;
  --ink-soft: rgba(236, 229, 211, 0.72);
  --ink-faint: rgba(236, 229, 211, 0.48);
  --gold: #d3ab4e;
  --pill-bg: rgba(13, 24, 40, 0.52);
  --pill-border: rgba(236, 229, 211, 0.22);
  --text-shadow: 0 1px 10px rgba(6, 12, 22, 0.7), 0 0 3px rgba(6, 12, 22, 0.6);
  color: var(--ink);
  background: #152639;
}
#scene { position: fixed; inset: 0; display: block; touch-action: none; }
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse 125% 95% at 50% 42%, rgba(0,0,0,0) 58%, rgba(5, 10, 18, 0.28) 100%);
}
.grain {
  position: fixed; inset: -24px; pointer-events: none; z-index: 4; opacity: 0.085; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' seed='17'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.62'/%3E%3C/svg%3E");
}
#fadeVeil {
  position: fixed; inset: 0; pointer-events: none; z-index: 6; opacity: 0;
  background: radial-gradient(ellipse 120% 100% at 50% 45%, #16283e 0%, #0d1826 100%);
  transition: opacity 0.38s ease;
}
#fadeVeil.on { opacity: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nos { position: fixed; inset: 0; z-index: 30; margin: 0; display: flex; align-items: center; justify-content: center; letter-spacing: 0.14em; }
.serif { font-family: var(--serif); }

/* ---- top area ---- */
#titleBlock {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 20px; z-index: 10;
  pointer-events: none; text-shadow: var(--text-shadow);
}
#titleBlock h1 {
  margin: 0; font-family: var(--serif); font-weight: 500;
  font-size: 21px; letter-spacing: 0.34em; color: var(--ink);
}
#speciesSub {
  margin: 5px 0 0 2px; font-size: 10.5px; letter-spacing: 0.14em; color: var(--ink-soft);
  transition: opacity 0.3s ease;
}
#speciesTabs {
  position: fixed; top: calc(20px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 10; display: flex; gap: 20px; align-items: baseline; white-space: nowrap;
}
.spTab {
  appearance: none; cursor: pointer; background: none; border: none; padding: 3px 1px 5px;
  font-family: var(--serif); font-size: 13px; letter-spacing: 0.12em;
  color: var(--ink-faint); text-shadow: var(--text-shadow);
  border-bottom: 1px solid transparent; transition: color 0.35s ease, border-color 0.35s ease;
}
.spTab:hover { color: var(--ink-soft); }
.spTab.active { color: var(--ink); border-bottom-color: var(--gold); }
.spTab:active { transform: scale(0.97); }
#topBtns {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 10;
  display: flex; gap: 6px;
}
.pill {
  appearance: none; cursor: pointer;
  font-family: "Zen Kaku Gothic New", sans-serif; font-size: 11px; letter-spacing: 0.1em;
  color: var(--ink); background: var(--pill-bg); border: 1px solid var(--pill-border);
  border-radius: 999px; padding: 6px 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.pill:active { transform: scale(0.97); }
@media (max-width: 900px) {
  #speciesTabs { top: calc(66px + env(safe-area-inset-top)); left: 20px; transform: none; gap: 15px; }
  .spTab { font-size: 12px; }
  #titleBlock h1 { font-size: 19px; }
}
@media (max-width: 430px) {
  #speciesTabs { gap: 11px; }
  .spTab { font-size: 11.5px; letter-spacing: 0.06em; }
}


/* ---- sky picker (species selection) ---- */
#skyPicker {
  position: fixed; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 10;
}
#skyBtn { font-family: var(--serif); font-size: 12.5px; letter-spacing: 0.12em; padding: 7px 16px; }
@media (max-width: 900px) {
  #skyPicker { top: calc(64px + env(safe-area-inset-top)); left: 20px; transform: none; }
}
body.accompany #skyPicker { display: none; }
.skyCard { max-width: 430px; }
.skyCard h2 { font-size: 19px; word-break: keep-all; overflow-wrap: anywhere; }
.skyGroup { margin-top: 14px; }
.skyGroup h5 {
  margin: 0 0 4px; font-family: var(--serif); font-weight: 500;
  font-size: 12px; letter-spacing: 0.3em; color: #8a6d2f;
}
.skyItem {
  display: block; width: 100%; text-align: left; appearance: none; cursor: pointer;
  background: none; border: none; border-bottom: 1px solid rgba(38,49,61,0.10);
  padding: 9px 2px 10px; font-family: inherit; color: inherit;
}
.skyItem:active { transform: scale(0.99); }
.skyItem .si-name { font-family: var(--serif); font-size: 15.5px; letter-spacing: 0.08em; color: #26313d; }
.skyItem.cur .si-name { color: #8a6d2f; }
.skyItem .si-sub { font-size: 11px; letter-spacing: 0.04em; color: rgba(38,49,61,0.62); margin-top: 2px; line-height: 1.6; }
/* ---- bottom: readout + dial ---- */
#bottomUI {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}
#bottomUI::before {
  content: ""; position: absolute; inset: -70px 0 0 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(9, 17, 29, 0) 0%, rgba(9, 17, 29, 0.38) 46%, rgba(9, 17, 29, 0.62) 100%);
}
#readout {
  text-align: center; text-shadow: var(--text-shadow); margin-bottom: 2px;
  padding: 10px 34px 6px; border-radius: 50%;
  background: radial-gradient(ellipse 100% 100% at 50% 50%, rgba(7,13,23,0.42) 0%, rgba(7,13,23,0.18) 55%, rgba(7,13,23,0) 78%);
}
#dateLabel {
  font-family: var(--serif); font-size: 27px; font-weight: 500; letter-spacing: 0.22em;
  color: var(--ink); line-height: 1.25; text-indent: 0.22em;
}
#phaseLabel { font-size: 12px; letter-spacing: 0.3em; color: var(--ink-soft); margin-top: 2px; text-indent: 0.3em; }
#journeyLabel { font-size: 11px; letter-spacing: 0.16em; color: var(--ink-faint); margin-top: 4px; min-height: 14px; }
#hint {
  font-size: 11.5px; letter-spacing: 0.14em; color: var(--ink-soft); text-shadow: var(--text-shadow);
  margin: 9px 0 1px; transition: opacity 1.1s ease; text-align: center; padding: 0 24px; min-height: 15px;
}
#hint.gone { opacity: 0; }
#dialRow {
  position: relative; display: flex; align-items: flex-end; justify-content: center; width: 100%;
  pointer-events: none;
}
#dialWrap { position: relative; pointer-events: auto; }
#dial { display: block; cursor: grab; touch-action: none; outline: none; }
#dial:active { cursor: grabbing; }
#dial:focus-visible { filter: drop-shadow(0 0 6px rgba(211, 171, 78, 0.55)); }
#sideBtns {
  position: absolute; right: 14px; bottom: 16px; pointer-events: auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
#todayBtn { transition: opacity 0.4s ease; }
#todayBtn.hidden { opacity: 0.38; }
#followBtn {
  font-family: var(--serif); font-size: 13px; letter-spacing: 0.14em;
  padding: 9px 16px;
}
#schematicNote {
  position: fixed; left: 16px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 9;
  font-size: 9.5px; letter-spacing: 0.12em; color: var(--ink-soft); text-shadow: var(--text-shadow);
  pointer-events: none; line-height: 1.8; text-align: left; white-space: nowrap;
}
@media (max-width: 560px) { #schematicNote { display: none; } }
/* copyright and the way back to PLAYGROUND: small, at the edge */
#credit {
  position: fixed; left: 16px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 9;
  display: flex; align-items: baseline; gap: 10px; white-space: nowrap;
  font-size: 9.5px; letter-spacing: 0.08em; color: var(--ink-faint); text-shadow: var(--text-shadow);
}
#credit a { color: inherit; text-decoration: none; }
#credit a:hover, #credit a:focus-visible { color: var(--ink); text-decoration: underline; }
#credit .pg { font-family: var(--serif); font-size: 10.5px; letter-spacing: 0.22em; color: var(--ink-soft); }
#schematicNote { bottom: calc(34px + env(safe-area-inset-bottom)); }
body.accompany #credit { display: none; }
@media (max-width: 560px) {
  #credit { left: auto; right: 12px; bottom: calc(6px + env(safe-area-inset-bottom)); font-size: 8.5px; gap: 7px; }
  #credit .pg { font-size: 9.5px; }
  #credit .cw { display: none; }
}
.card .cardCredit { font-size: 11px; color: rgba(38, 49, 61, 0.6); margin-top: 18px; }
.card .cardCredit a { color: inherit; }
/* phones: dial at the left, the three buttons in a column at the right */
@media (max-width: 560px) {
  body:not(.accompany) #dialRow { justify-content: flex-start; padding-left: 10px; box-sizing: border-box; }
  body:not(.accompany) #sideBtns { bottom: 50%; transform: translateY(50%); }
}
/* wide landscape screens (body.side, set from computeView): the
   readout and the dial stand in a column at the right of the plate */
body.side:not(.accompany) #bottomUI {
  left: auto; width: 360px; top: 0; justify-content: flex-end;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
}
body.side:not(.accompany) #bottomUI::before {
  inset: 0 0 0 -80px;
  background: linear-gradient(to right, rgba(9, 17, 29, 0) 0%, rgba(9, 17, 29, 0.34) 30%, rgba(9, 17, 29, 0.52) 100%);
}
body.side:not(.accompany) #readout { padding: 10px 18px 6px; max-width: 330px; box-sizing: border-box; }
body.side:not(.accompany) #dialRow { flex-direction: column; align-items: center; }
body.side:not(.accompany) #sideBtns {
  position: static; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center;
  margin-top: 12px; max-width: 330px;
}
body.side #skyPicker { left: calc((100% - 360px) / 2 + 14px); }

/* ---- accompany UI ---- */
#backBtn {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 14px; z-index: 11;
}
#legBox {
  position: fixed; left: 0; right: 0; bottom: calc(34px + env(safe-area-inset-bottom)); z-index: 10;
  text-align: center; pointer-events: none; text-shadow: var(--text-shadow); padding: 0 28px;
}
#legLine {
  font-family: var(--serif); font-size: 19px; font-weight: 500;
  letter-spacing: 0.12em; color: var(--ink); line-height: 1.5;
}
#legSub { font-size: 11.5px; letter-spacing: 0.18em; color: var(--ink-soft); margin-top: 6px; }
body.accompany #titleBlock, body.accompany #schematicNote, body.accompany #speciesTabs { display: none; }
/* in accompany mode the year dial stays within reach, compact,
   so time can be scrubbed forward and back while flying */
body.accompany #readout, body.accompany #hint { display: none; }
/* while flying with the flock, autoplay stays at hand (bottom right) */
body.accompany #todayBtn, body.accompany #followBtn { display: none; }
body.accompany #sideBtns { right: 14px; bottom: 12px; transform: none; }
body.accompany #dialWrap { transform: scale(0.64); transform-origin: 50% 100%; }
body.accompany #legBox { bottom: calc(178px + env(safe-area-inset-bottom)); }
body:not(.accompany) #backBtn, body:not(.accompany) #legBox { display: none; }

/* ---- overlays / cards ---- */
.overlay {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 14, 24, 0.34); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  padding: 22px; opacity: 1; transition: opacity 0.45s ease;
  overflow-y: auto; box-sizing: border-box;
}
.overlay[hidden] { display: none; }
.overlay.fading { opacity: 0; }
.card:focus { outline: none; }
.card {
  background: #fbf8f0; color: #26313d; border-radius: 6px; max-width: 400px; width: 100%;
  padding: 30px 28px 24px; box-shadow: 0 18px 50px rgba(4, 8, 16, 0.45);
  /* the visible height (dvh: without the phone browser's bars), padding
     included, so the panel's top and its close button always show */
  box-sizing: border-box; margin: auto;
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(0); transition: transform 0.45s ease;
}
.overlay.fading .card { transform: translateY(10px); }
.card .found-mark {
  font-size: 10.5px; letter-spacing: 0.5em; color: #a87e24; text-align: center; margin: 0 0 10px;
}
.card h2 {
  font-family: var(--serif); font-weight: 600; font-size: 24px; letter-spacing: 0.1em;
  text-align: center; margin: 0; line-height: 1.4;
}
.card .place-sub {
  text-align: center; font-size: 11px; letter-spacing: 0.24em; color: rgba(38,49,61,0.55); margin: 6px 0 0;
}
.card .rule { width: 34px; height: 1px; background: #a87e24; opacity: 0.65; margin: 18px auto; }
.card ul { list-style: none; margin: 0; padding: 0; }
.card ul li {
  font-family: var(--serif); font-size: 14.5px; line-height: 1.95; letter-spacing: 0.04em;
  padding: 7px 2px; border-bottom: 1px solid rgba(38, 49, 61, 0.07);
}
.card ul li:last-child { border-bottom: none; }
.card .labels { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.tag {
  font-size: 10px; letter-spacing: 0.12em; color: #7a6420; border: 1px solid rgba(168, 126, 36, 0.45);
  border-radius: 999px; padding: 3px 10px;
}
.card .closeRow { text-align: center; margin-top: 22px; }
.cardBtn {
  appearance: none; cursor: pointer; background: none; border: 1px solid rgba(38,49,61,0.3);
  color: #26313d; border-radius: 999px; padding: 8px 22px;
  font-family: var(--serif); font-size: 13px; letter-spacing: 0.2em;
}
.cardBtn:active { transform: scale(0.97); }
.card p.body-text {
  font-size: 13px; line-height: 2.0; letter-spacing: 0.03em; margin: 0 0 12px; color: rgba(38,49,61,0.88);
}
.card p.body-text b { color: #a87e24; font-weight: 500; }
.card h3 {
  font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: 0.14em;
  margin: 0 0 14px; text-align: center;
}
.card h4 {
  font-family: var(--serif); font-size: 14.5px; font-weight: 600; letter-spacing: 0.12em;
  margin: 20px 0 8px; color: #26313d;
}
.card h4:first-of-type { margin-top: 4px; }
.card p.src {
  font-size: 11.5px; line-height: 1.9; letter-spacing: 0.02em; margin: 0 0 6px; color: rgba(38,49,61,0.66);
}
.indexEntry { padding: 13px 2px; border-bottom: 1px solid rgba(38,49,61,0.08); cursor: pointer; }
.indexEntry:last-of-type { border-bottom: none; }
.indexEntry .ie-name { font-family: var(--serif); font-size: 16.5px; letter-spacing: 0.08em; }
.indexEntry .ie-sub { font-size: 10.5px; letter-spacing: 0.16em; color: rgba(38,49,61,0.5); margin-top: 3px; }
.indexEntry.unfound { cursor: default; }
.indexEntry.unfound .ie-name { color: rgba(38,49,61,0.38); letter-spacing: 0.3em; }
.indexNote { font-size: 11px; line-height: 1.9; color: rgba(38,49,61,0.55); text-align: center; margin: 14px 0 0; }

/* ---- today's sky (in the readout) ---- */
#skyNote { margin-top: 8px; }
#skyLine {
  font-family: var(--serif); font-size: 11.5px; letter-spacing: 0.1em;
  color: rgba(233, 205, 140, 0.92); line-height: 1.7;
}
#skyReflect { font-size: 10.5px; letter-spacing: 0.14em; color: var(--ink-faint); margin-top: 2px; line-height: 1.6; }
@media (max-width: 560px) { #skyReflect { display: none; } }

/* ---- story beat margin note ---- */
#beatNote {
  position: fixed; left: 18px; top: 35%; z-index: 12; max-width: 264px;
  background: rgba(10, 18, 30, 0.58); border: 1px solid rgba(236, 229, 211, 0.16);
  border-radius: 10px; padding: 14px 36px 15px 17px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 1; transition: opacity 0.6s ease; pointer-events: auto;
}
#beatNote[hidden] { display: none; }
#beatNote.fading { opacity: 0; }
#beatDate { font-size: 10px; letter-spacing: 0.34em; color: var(--gold); margin-bottom: 6px; }
#beatText {
  font-family: var(--serif); font-size: 13.5px; line-height: 1.95;
  letter-spacing: 0.05em; color: var(--ink); text-shadow: var(--text-shadow);
}
#beatClose {
  position: absolute; top: 6px; right: 8px; appearance: none; cursor: pointer;
  background: none; border: none; color: var(--ink-faint); font-size: 15px; line-height: 1; padding: 4px;
}
#beatClose:active { transform: scale(0.92); }
body.accompany #beatNote { display: none; }
@media (max-width: 700px) {
  #beatNote { top: calc(116px + env(safe-area-inset-top)); left: 12px; max-width: 228px; padding: 11px 30px 12px 13px; }
  #beatText { font-size: 12.5px; }
}

/* ---- protagonist panel / journal ---- */
/* the bird itself: one real photograph at the head of the protagonist card */
.heroPhoto { margin: -30px -28px 20px; }
.heroPhoto img {
  display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; transition: opacity 0.25s ease;
  border-radius: 6px 6px 0 0; background: #e6dfcf;
}
.heroPhoto figcaption {
  padding: 7px 28px 0; font-size: 10px; line-height: 1.7; letter-spacing: 0.04em;
  color: rgba(38, 49, 61, 0.55); text-align: left;
}
.heroPhoto a, .photoCredits a { color: inherit; text-decoration: underline; text-decoration-color: rgba(38, 49, 61, 0.25); text-underline-offset: 2px; }
.photoCredits { margin: 6px 0 10px !important; }
.photoCredits li {
  font-family: inherit !important; font-size: 11px !important; line-height: 1.7 !important;
  letter-spacing: 0.02em !important; padding: 4px 0 !important; color: rgba(38, 49, 61, 0.72);
}
.card .hero-note {
  font-size: 11px; line-height: 1.9; letter-spacing: 0.04em; color: rgba(38,49,61,0.55);
  text-align: center; margin: 18px 0 0;
}
.jh-head { font-size: 10px; letter-spacing: 0.34em; color: #a87e24; margin: 22px 0 2px; }
.jh-head:first-child { margin-top: 0; }
.jh-hero { padding: 4px 2px 13px; border-bottom: 1px solid rgba(38,49,61,0.08); cursor: pointer; }
.jh-hero .ie-name { font-family: var(--serif); font-size: 16.5px; letter-spacing: 0.08em; }
.jh-hero .ie-sub { font-size: 10.5px; letter-spacing: 0.16em; color: rgba(38,49,61,0.5); margin-top: 3px; }
.jh-hero .ie-line { font-family: var(--serif); font-size: 13px; line-height: 1.85; color: rgba(38,49,61,0.78); margin-top: 7px; }
.beatEntry { padding: 9px 2px; border-bottom: 1px solid rgba(38,49,61,0.07); }
.beatEntry:last-of-type { border-bottom: none; }
.beatEntry .be-date { font-size: 10px; letter-spacing: 0.26em; color: rgba(38,49,61,0.48); }
.beatEntry .be-text { font-family: var(--serif); font-size: 13.5px; line-height: 1.85; margin-top: 2px; color: rgba(38,49,61,0.9); }
.jh-quiet { font-size: 11.5px; line-height: 1.9; color: rgba(38,49,61,0.5); padding: 8px 2px 2px; }

/* ---- language button ---- */
#langBtn { font-family: "EB Garamond", Georgia, serif; font-size: 12px; letter-spacing: 0.12em; padding: 5px 11px; }
html[lang="en"] #langBtn { font-family: "Shippori Mincho", serif; font-size: 11.5px; }
#dataBtn .nl { display: none; }
/* phones: the language button sits on the second row, at the right */
@media (max-width: 560px) {
  #langBtn { position: fixed; top: calc(66px + env(safe-area-inset-top)); right: 14px; }
  #dataBtn .wl { display: none; }
  #dataBtn .nl { display: inline; }
}

/* ---- English: Latin text wants little tracking and a larger serif ---- */
html[lang="en"] body * { letter-spacing: 0.01em !important; }
html[lang="en"] body { word-break: normal; overflow-wrap: break-word; hyphens: none; }
html[lang="en"] #titleBlock h1 { font-size: 23px; letter-spacing: 0.06em !important; font-weight: 500; }
html[lang="en"] #speciesSub { font-size: 11px; }
html[lang="en"] #skyBtn { font-size: 14px; }
html[lang="en"] #dateLabel { font-size: 30px; letter-spacing: 0.02em !important; }
html[lang="en"] #phaseLabel { letter-spacing: 0.04em !important; text-indent: 0; }
html[lang="en"] #legLine { font-size: 21px; }
html[lang="en"] #beatText { font-size: 15.5px; line-height: 1.6; }
html[lang="en"] #beatDate, html[lang="en"] .jh-head, html[lang="en"] .beatEntry .be-date { letter-spacing: 0.16em !important; text-transform: uppercase; }
html[lang="en"] .found-mark { letter-spacing: 0.32em !important; }
html[lang="en"] .card h2 { font-size: 27px; letter-spacing: 0.01em !important; line-height: 1.25; }
html[lang="en"] .card h3 { font-size: 20px; }
html[lang="en"] .card h4 { font-size: 16.5px; }
html[lang="en"] .card .place-sub { letter-spacing: 0.06em !important; }
html[lang="en"] #cardLines li { font-size: 16px; line-height: 1.6; margin-bottom: 0.5em; }
html[lang="en"] .card .body-text { font-size: 13px; line-height: 1.75; }
html[lang="en"] .skyGroup h5 { font-size: 13px; letter-spacing: 0.14em !important; text-transform: uppercase; }
html[lang="en"] .skyItem .si-name { font-size: 17.5px; }
html[lang="en"] .indexEntry .ie-name, html[lang="en"] .jh-hero .ie-name { font-size: 18px; }
html[lang="en"] .jh-hero .ie-line, html[lang="en"] .beatEntry .be-text { font-size: 15px; line-height: 1.6; }
html[lang="en"] #skyLine { font-size: 13px; }
html[lang="en"] #schematicNote { line-height: 1.5; }
@media (max-width: 560px) {
  html[lang="en"] #titleBlock h1 { font-size: 19px; }
  html[lang="en"] #skyBtn { font-size: 13px; padding: 7px 13px; }
}
@media (max-width: 400px) { html[lang="en"] #titleBlock h1 { font-size: 17.5px; letter-spacing: 0.03em !important; } }

/* ---- phones: header, panels, dial ---- */
@media (max-width: 900px) {
  #skyPicker { top: var(--sky-top, calc(64px + env(safe-area-inset-top))); }
}
@media (max-width: 560px) {
  #langBtn { top: var(--sky-top, calc(66px + env(safe-area-inset-top))); }
  #titleBlock { right: 14px; }
  #titleBlock h1 { font-size: 18px; letter-spacing: 0.26em; }
  #speciesSub { padding-right: 52px; line-height: 1.5; }
  #topBtns { gap: 5px; }
  #topBtns .pill { padding: 6px 10px; }
  #bottomUI { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .overlay { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .card { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding: 26px 22px 20px; }
  .heroPhoto { margin: -26px -22px 18px; }
  .heroPhoto figcaption { padding: 7px 22px 0; }
  body.accompany #indexBtn, body.accompany #dataBtn { display: none; }
}
@media (max-width: 380px) {
  #titleBlock h1 { font-size: 16px; letter-spacing: 0.16em; }
  html[lang="en"] #titleBlock h1 { font-size: 15px; }
  #topBtns .pill { padding: 5px 8px; font-size: 10.5px; }
  #topBtns { right: 10px; gap: 4px; }
}
/* phones held sideways: a narrow column for the readout and the dial */
body.shortSide:not(.accompany) #bottomUI { width: 290px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
body.shortSide:not(.accompany) #readout { padding: 4px 10px 2px; max-width: 280px; }
body.shortSide:not(.accompany) #dateLabel { font-size: 21px; }
body.shortSide:not(.accompany) #phaseLabel { font-size: 11px; }
body.shortSide:not(.accompany) #skyNote, body.shortSide:not(.accompany) #hint { display: none; }
body.shortSide:not(.accompany) #sideBtns { margin-top: 6px; gap: 6px; }
body.shortSide:not(.accompany) #sideBtns .pill { padding: 5px 10px; }
body.shortSide #schematicNote { display: none; }
body.shortSide #credit { left: auto; right: 12px; bottom: calc(4px + env(safe-area-inset-bottom)); font-size: 8.5px; }
body.shortSide #credit .cw { display: none; }
/* short phones: a more compact readout, so the map has room above it */
@media (max-width: 560px) {
  #hint.gone { min-height: 0; height: 0; margin: 0; }
}
@media (max-width: 560px) and (max-height: 760px) {
  #readout { padding: 6px 26px 4px; }
  #dateLabel { font-size: 23px; }
  html[lang="en"] #dateLabel { font-size: 25px; }
  #phaseLabel { font-size: 11px; }
  #skyLine { font-size: 11px; line-height: 1.55; }
  html[lang="en"] #skyLine { font-size: 12.5px; }
}
/* the remaining clearances found in the layout check */
@media (max-width: 560px) { #speciesSub { margin-top: 9px; } }
@media (max-width: 340px) { #titleBlock h1 { font-size: 15px; letter-spacing: 0.1em; } }
@media (max-width: 900px) and (orientation: portrait) { #bottomUI { padding-bottom: calc(26px + env(safe-area-inset-bottom)); } }
body.shortSide #credit { left: 16px; right: auto; }

/* ---- legibility over bright skies (accompany mode) ----
   the line under the scene and the dial get their own soft dark
   ground, so they read on a pale noon sky or snow as well as at night */
body.accompany #legBox {
  left: 50%; right: auto; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 24px); box-sizing: border-box;
  padding: 14px 40px 12px; border-radius: 50%;
  background: radial-gradient(ellipse 100% 100% at 50% 50%, rgba(7,13,23,0.46) 0%, rgba(7,13,23,0.26) 45%, rgba(7,13,23,0.08) 62%, rgba(7,13,23,0) 72%);
  text-shadow: 0 1px 8px rgba(4, 9, 17, 0.9), 0 0 2px rgba(4, 9, 17, 0.8);
}
body.accompany #legSub { color: rgba(236, 229, 211, 0.9); }
#dialDisc { fill: rgba(9, 17, 29, 0.22); }
body.accompany #dialDisc { fill: rgba(9, 17, 29, 0.5); }
body.accompany #dial text { fill: rgba(240, 234, 220, 0.92); }
body.accompany #dial line, body.accompany #dial circle.ring { stroke: rgba(240, 234, 220, 0.8); }
#legLine { text-wrap: balance; }
/* accompany: the headline fades once read; the dial and autoplay rest */
#legBox { transition: opacity 1.6s ease; }
#legBox.rest { opacity: 0; }
body.accompany #dialWrap, body.accompany #sideBtns { transition: opacity 1.2s ease; }
body.accompany.idle #dialWrap { opacity: 0.38; }
body.accompany.idle #sideBtns { opacity: 0.5; }
#skyNote { transition: opacity 1.6s ease; }
body:not(.side) #skyNote.rest { opacity: 0; }
