@font-face {
  font-family: Heebo;
  src: url('/fonts/heebo-variable.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f7f5ec;
  --white: #fffef9;
  --ink: #14332c;
  --muted: #435d55;
  --green: #134a3c;
  --light-green: #e4eee6;
  --line: #cdd8ce;
  --gold: #f2bf57;
  --focus: #784b09;
  font-family: Heebo, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, select, input { font: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.shell { max-width: 1240px; width: calc(100% - 96px); margin: 0 auto; }

.site-header { border-bottom: 1px solid var(--line); }
.header-layout { display: flex; justify-content: space-between; align-items: center; min-height: 68px; gap: 14px; }
.brand { order: 2; font-weight: 850; font-size: 1.14rem; text-decoration: none; }
.site-nav { display: flex; gap: 24px; }
.site-nav a, .back-link, .open-original {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 650;
  color: var(--green);
  text-underline-offset: 4px;
}
.site-nav a { text-decoration: none; }
.site-nav a:hover, .brand:hover { text-decoration: underline; text-underline-offset: 4px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.13fr) minmax(0, 1fr);
  overflow: hidden;
  margin: 26px 0 42px;
  min-height: 350px;
  border-radius: 24px;
  background: #123d33;
  color: #fffaf0;
  box-shadow: 0 12px 30px #173a2d15;
}
.hero-image {
  min-height: 100%;
  background: linear-gradient(90deg, transparent 75%, #123d33), url('/media/house-dark.webp') center / cover no-repeat;
}
.hero-copy { display: grid; align-content: center; justify-items: end; gap: 16px; padding: 32px 52px 36px 22px; }
.hero h1 { font-size: clamp(3.2rem, 7.3vw, 6.8rem); line-height: .96; font-weight: 900; }
.hero h1 span { color: var(--gold); }
.hero p { color: #eef4ea; max-width: 28ch; font-size: clamp(1.05rem, 1.7vw, 1.3rem); line-height: 1.4; }
.primary-link, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 18px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.primary-link { background: var(--green); color: #fff; }
.primary-link:hover { background: #0c382c; }
.primary-link:disabled { background: #dae3da; color: #506559; cursor: default; }
.hero .primary-link { background: var(--gold); color: #272f1d; }
.hero .primary-link:hover { background: #ffd17b; }
.hero .primary-link:focus-visible { outline-color: #fff; }
.secondary { color: var(--green); background: var(--white); border-color: var(--line); }
.secondary:hover, .secondary[aria-current] { background: var(--light-green); border-color: #7d9d89; }

.collection { margin: 0 0 44px; scroll-margin-top: 20px; }
.section-title { margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.section-title h2 { font-size: clamp(1.75rem, 3.2vw, 2.45rem); line-height: 1.15; font-weight: 850; }
.activity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 20px; }
.slot-1 { grid-column: 3; }
.slot-2 { grid-column: 2; }
.slot-3 { grid-column: 1; }
.card { min-width: 0; }
.card > a {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 3px 8px #132f2410;
  transition: box-shadow .18s ease, transform .18s ease;
}
.card > a:hover { box-shadow: 0 7px 19px #132f2423; transform: translateY(-3px); }
.card-art { aspect-ratio: 16 / 8.5; background: #dce8df; overflow: hidden; }
.card-art img { width: 100%; height: 100%; object-fit: cover; }
.art-all-simulations img { object-position: center 64%; }
.art-colour-mixing img { object-position: center 45%; }
.art-tree-workshop { background: radial-gradient(ellipse at 50% 45%, #e6edba, #bfd694); }
.art-tree-workshop img { object-fit: contain; padding: 5px 0; }
.card-copy { padding: 14px 17px 18px; }
.card h3 { font-weight: 820; font-size: clamp(1.2rem, 2.2vw, 1.5rem); line-height: 1.3; }
.card p { font-size: 1rem; line-height: 1.45; color: var(--muted); margin-top: 6px; }
.timeline-art {
  height: 100%;
  background: repeating-linear-gradient(90deg, transparent 0 29px, #e1efca20 30px 31px),
    repeating-linear-gradient(0deg, transparent 0 29px, #e1efca20 30px 31px), #244941;
  display: grid;
  place-items: center;
}
.art-axis { width: 77%; height: 2px; background: #e6edba; position: relative; }
.art-axis i {
  display: block;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #e6edba;
  box-shadow: 0 0 0 6px #b1cf9d32;
  position: absolute;
  top: 50%;
  left: 18%;
  transform: translate(-50%, -50%);
}
.art-axis i:nth-child(2) { left: 47%; background: #f2bf57; }
.art-axis i:nth-child(3) { left: 81%; background: #b9dbbc; }

.activity-header .header-layout { min-height: 58px; }
.sim-shell { height: calc(100dvh - 59px); display: flex; flex-direction: column; }
.sim-heading { display: flex; align-items: center; justify-content: space-between; min-height: 51px; gap: 10px; }
.sim-heading .open-original { font-size: .86rem; }
.sim-heading h1 { font-size: clamp(1.1rem, 2.5vw, 1.6rem); font-weight: 850; }
.sim-shell iframe { display: block; width: 100%; flex: 1; min-height: 0; border: 0; background: #fff; }
.portrait-hint { display: none; }

.game-shell { max-width: 1070px; margin-bottom: 42px; }
.game-shell > h1 { margin: 26px 0 16px; font-size: clamp(2.1rem, 5vw, 3.5rem); line-height: 1.1; font-weight: 875; }
.play-panel { min-width: 0; padding: 22px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; }
.play-panel h2 { margin-bottom: 12px; font-weight: 830; font-size: clamp(1.35rem, 3vw, 1.8rem); }
.play-panel h3 { line-height: 1.3; }
.hint { margin-top: 9px; color: var(--muted); line-height: 1.5; }
.question { margin-top: 15px; font-size: 1.18rem; font-weight: 750; line-height: 1.45; }
.challenge-art { width: 100%; aspect-ratio: 16 / 8.4; object-fit: contain; background: #e7eee6; border-radius: 11px; }
.actions { display: flex; margin-top: 16px; justify-content: end; gap: 9px; flex-wrap: wrap; }
.feedback { background: #e9f2e7; border: 1px solid #9db9a2; border-radius: 10px; margin-top: 14px; padding: 13px 15px; }
.feedback p, .feedback ul { margin-top: 6px; }

.house-layout { display: grid; grid-template-columns: minmax(0, 1fr) 175px; gap: 16px; align-items: start; }
.house-locations { display: grid; grid-template-columns: 1fr; gap: 5px; }
.house-locations h2 { font-size: 1.15rem; }
.house-locations button { justify-content: end; padding: 6px 12px; }
.house-map { position: relative; overflow: hidden; border-radius: 11px; }
.house-map img { width: 100%; }
.map-pin {
  position: absolute;
  width: clamp(32px, 4vw, 42px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: 0;
  cursor: pointer;
}
.map-pin::after {
  content: '';
  position: absolute;
  inset: 20%;
  border: 2px solid #fff9d2;
  border-radius: 50%;
  background: #edb448;
  box-shadow: 0 1px 5px #111, 0 0 0 4px #edb44840;
}
.map-pin:hover::after { background: #ffe091; }
.map-pin:focus-visible { outline-color: #fff9d2; outline-offset: 0; }
.guess-panel { display: grid; gap: 10px; margin-top: 12px; }
.guess-group { background: #f0f3eb; padding: 11px 12px 13px; border-radius: 9px; }
.guess-group h3 { margin: 0 0 7px; font-size: 1rem; }
.field-grid { display: flex; gap: 9px; flex-wrap: wrap; flex-direction: row-reverse; }
.field-grid > * { flex: 1 1 135px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: .95rem; font-weight: 690; }
.field select, .fixed-field strong { width: 100%; min-height: 45px; border: 1px solid #aebfb4; border-radius: 8px; color: var(--ink); }
.field select {
  appearance: none;
  padding: 7px 9px 7px 28px;
  cursor: pointer;
  background:
    linear-gradient(45deg, transparent 50%, #30594a 50%) 10px center / 5px 5px,
    linear-gradient(-45deg, transparent 50%, #30594a 50%) 15px center / 5px 5px,
    var(--white);
  background-repeat: no-repeat;
}
.fixed-field strong { padding: 9px; background: #dfece0; }
.answer-chain { font-weight: 800; }

.timeline-game { max-width: 850px; margin: 0 auto; }
.timeline-game h2 { font-size: clamp(1.65rem, 4vw, 2.5rem); margin: 10px 0; }
.timeline-board { padding: 18px 22px 40px; background: #e5eee4; border-radius: 11px; }
.timeline-top { display: flex; justify-content: space-between; align-items: baseline; gap: 5px 12px; flex-wrap: wrap; }
.timeline-guess { display: flex; align-items: baseline; margin-left: auto; gap: 10px; }
.timeline-guess output { font-weight: 850; font-size: 1.25rem; }
.timeline-key { color: #842334; font-weight: 750; font-size: .9rem; }
.timeline-key::before { content: '▾ '; }
.timeline-rail { position: relative; margin: 17px 6px 0; }
.timeline-rail input { appearance: none; display: block; width: 100%; margin: 0; height: 36px; background: transparent; cursor: pointer; }
.timeline-rail input::-webkit-slider-runnable-track { height: 5px; border-radius: 10px; background: #457a63; }
.timeline-rail input::-moz-range-track { height: 5px; border-radius: 10px; background: #457a63; }
.timeline-rail input::-webkit-slider-thumb {
  appearance: none;
  width: 23px;
  height: 23px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #614710;
}
.timeline-rail input::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--gold); border: 2px solid #614710; }
.actual-marker {
  position: absolute;
  z-index: 1;
  top: -3px;
  border: 7px solid transparent;
  border-top: 11px solid #a32637;
  transform: translateX(-50%);
  pointer-events: none;
}
.year-anchors { position: absolute; left: 0; right: 0; }
.year-anchors span { position: absolute; transform: translateX(-50%); white-space: nowrap; font-size: .81rem; color: var(--muted); }
.year-anchors span:first-child { transform: none; }
.year-anchors span:last-child { transform: translateX(-100%); }

.round-links { display: flex; flex-direction: row-reverse; gap: 8px; margin-bottom: 10px; }
.sound-scene { max-width: 100%; }
.sound-scene .challenge-art { aspect-ratio: 16 / 6; object-fit: cover; object-position: center 46%; }
.audio-grid { display: flex; flex-direction: row-reverse; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.audio-card { flex: 1 1 230px; min-width: 0; display: grid; gap: 9px; border-radius: 10px; padding: 12px; background: #eff3ea; }
.audio-card audio { width: 100%; height: 45px; }
.sound-answers { direction: rtl; padding: 0 19px 0 0; }

@media (max-width: 920px) {
  .shell { width: calc(100% - 48px); }
  .hero { min-height: 315px; }
  .hero-copy { padding-right: 28px; }
  .activity-grid { gap: 13px; }
  .house-layout { grid-template-columns: minmax(0, 1fr) 142px; gap: 10px; }
}

@media (max-width: 620px) {
  .shell { width: calc(100% - 28px); }
  .header-layout { min-height: 59px; }
  .site-nav { gap: 12px; }
  .site-nav a, .back-link { font-size: .9rem; }
  .brand { font-size: 1rem; }
  .hero { grid-template-columns: 1fr; margin-top: 15px; margin-bottom: 27px; border-radius: 15px; }
  .hero-image { grid-row: 2; min-height: 171px; background-image: linear-gradient(#123d33, transparent 26%), url('/media/house-dark.webp'); }
  .hero-copy { grid-row: 1; padding: 20px 19px 8px; gap: 11px; }
  .hero h1 { font-size: clamp(3rem, 12vw, 4.8rem); }
  .hero h1 br { display: none; }
  .hero h1 br::after { content: ' '; }
  .hero p { max-width: 29ch; }
  .collection { margin-bottom: 29px; }
  .activity-grid { grid-template-columns: 1fr; gap: 11px; }
  .activity-grid > :nth-child(n) { grid-area: auto; }
  .card > a { display: grid; grid-template-columns: 36% 1fr; align-items: stretch; }
  .card-art { aspect-ratio: auto; min-height: 99px; position: relative; }
  .card-art img { position: absolute; inset: 0; }
  .card-copy { padding: 10px 12px; }
  .card h3 { font-size: 1.13rem; }
  .card p { font-size: .92rem; margin-top: 3px; }
  .game-shell > h1 { margin: 19px 0 12px; }
  .play-panel { padding: 12px; }
  .house-layout { display: flex; flex-direction: column; align-items: stretch; }
  .house-locations { order: -1; display: flex; flex-wrap: wrap; justify-content: end; gap: 4px; }
  .house-locations h2 { display: none; }
  .house-locations button { padding: 3px 8px; font-size: .83rem; justify-content: center; }
  .challenge-art, .sound-scene .challenge-art { aspect-ratio: 16 / 9; }
  .timeline-board { padding: 13px 12px 36px; }
  .timeline-guess output { font-size: 1.05rem; }
  .actions { margin-top: 11px; gap: 6px; }
  .actions button { padding-right: 10px; padding-left: 10px; }
}

@media (max-width: 620px) and (orientation: portrait) {
  .portrait-hint { display: block; background: var(--light-green); color: var(--green); padding: 7px 14px; font-size: .88rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
