:root {
  color-scheme: dark;
  --bg: #07121f;
  --panel: #0c1d2d;
  --line: #284052;
  --gold: #e2bb65;
  --ivory: #f7f2e8;
  --muted: #b3c1cf;
  --red: #f49a98;
  --green: #79d9b2;
  font-family: Inter, Arial, sans-serif;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0, #16344870, transparent 65%), var(--bg);
  color: var(--ivory);
  min-height: 100vh;
}
body:before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(#c8a45a06 1px, transparent 1px),
    linear-gradient(90deg, #c8a45a06 1px, transparent 1px);
  background-size: 65px 65px;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
.button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 18px;
  background: #102333;
  color: var(--ivory);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  line-height: 1.3;
}
button:hover,
.button:hover {
  border-color: var(--gold);
  background: #193346;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: linear-gradient(120deg, #f4d688, #d7a744);
  color: #111b27;
  border-color: #edc970;
  font-weight: 700;
}
.primary:hover {
  background: #edcb7b;
}
.outline {
  border-color: #a17e3b;
  background: transparent;
}
.small {
  font-size: 0.85rem;
  padding: 8px 12px;
}
.danger {
  color: var(--red);
}
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
header {
  padding: 20px 4vw;
  display: flex;
  gap: 25px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #07121fe8;
}
header nav {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}
.wordmark {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 2px;
}
.gold {
  color: var(--gold);
}
header select {
  width: auto;
}
main {
  min-height: 75vh;
  max-width: 1500px;
  margin: auto;
  padding: 36px 4vw;
}
h1 {
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: -1.4px;
  margin: 0 0 14px;
  line-height: 1.1;
}
h2 {
  font-size: 25px;
  margin: 8px 0 20px;
}
h3 {
  margin: 0 0 12px;
}
p {
  line-height: 1.65;
}
.muted,
.hint {
  color: var(--muted);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
}
.home {
  text-align: center;
  max-width: 1250px;
  margin: auto;
}
.orbit {
  display: grid;
  grid-template-columns: 1fr 300px 1fr;
  gap: 30px;
  align-items: center;
  margin: 45px 0 20px;
}
.brand-hero {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 100%;
  filter: drop-shadow(0 0 35px #d4af371a);
}
.portal {
  text-align: left;
  display: flex;
  gap: 20px;
  align-items: center;
  min-height: 125px;
  border: 1px solid #c39a4c88;
  border-radius: 22px;
  padding: 22px;
  background: linear-gradient(140deg, #142c3a77, #06101c);
  box-shadow: 0 12px 35px #0002;
}
.portal span.icon {
  color: var(--gold);
  font-size: 32px;
}
.portal strong {
  display: block;
  font-size: 21px;
  margin-bottom: 8px;
}
.portal small {
  color: var(--muted);
  line-height: 1.4;
  display: block;
}
.portal:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
}
.tagline {
  font-size: clamp(34px, 5vw, 65px);
  font-weight: 850;
  letter-spacing: -2px;
  line-height: 1.06;
  margin: 30px 0 20px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.between {
  justify-content: space-between;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.two {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
.card {
  background: linear-gradient(130deg, #102333be, #081522e8);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 20px;
}
.cream {
  background: var(--ivory);
  color: #142334;
  border-color: var(--gold);
}
.badge {
  display: inline-block;
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--gold);
}
.workspace {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 30px;
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar a {
  padding: 13px;
  border-radius: 10px;
}
.sidebar a:hover {
  background: var(--panel);
  color: var(--gold);
}
.stats .card {
  padding: 22px;
  color: var(--gold);
  font-size: 20px;
}
.stat-number {
  font-size: 34px;
  font-weight: 700;
  margin-right: 10px;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
}
td,
th {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
th {
  color: var(--muted);
  font-weight: 500;
}
.table-wrap {
  overflow: auto;
}
label {
  display: block;
  font-size: 14px;
  margin: 14px 0 7px;
}
input,
textarea,
select {
  background: #061320;
  color: var(--ivory);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
  width: 100%;
  min-width: 0;
}
textarea {
  min-height: 90px;
}
input[type="checkbox"] {
  width: auto;
}
form {
  max-width: 800px;
}
dialog {
  background: var(--bg);
  color: var(--ivory);
  border: 1px solid var(--gold);
  border-radius: 18px;
  max-width: 650px;
  width: 95%;
  max-height: 90vh;
  overflow: auto;
  padding: 28px;
}
dialog::backdrop {
  background: #000b;
}
.skip {
  position: absolute;
  left: 20px;
  top: -100px;
}
.skip:focus {
  top: 10px;
}
footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 13px;
}
#notice:not(:empty) {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ivory);
  color: #142334;
  border-radius: 12px;
  padding: 16px 24px;
  z-index: 300;
  max-width: 90vw;
  box-shadow: 0 10px 30px #0007;
}
.quiz {
  max-width: 1000px;
  margin: auto;
}
.choice {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  margin: 7px 0;
  padding: 18px;
}
.choice.selected {
  border-color: var(--gold);
  background: #b28b3228;
}
.choice.correct {
  border-color: var(--green);
}
.choice.wrong {
  border-color: var(--red);
}
.choice b {
  border: 1px solid currentColor;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
progress {
  width: 100%;
  height: 8px;
  accent-color: var(--gold);
}
.feedback {
  border-left: 3px solid var(--gold);
  padding: 16px;
  background: #e2bb6511;
  white-space: pre-wrap;
}
.reader {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
}
.reader .toolbar {
  margin-bottom: 16px;
}
.book-area {
  background: #030b13;
  padding: 12px;
  min-height: 450px;
  overflow: auto;
  border-radius: 12px;
}
.book-simple {
  display: flex;
  gap: 0;
  justify-content: center;
}
.pdfpage {
  background: #fff;
  overflow: hidden;
}
.pdfpage canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
.reader.full {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  padding: 20px;
  overflow: auto;
}
.prewrap {
  white-space: pre-wrap;
}
.contents {
  max-height: 65vh;
  overflow: auto;
}
.reading-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.error {
  border-color: var(--red);
}
.empty {
  padding: 35px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.companion {
  position: fixed;
  bottom: 8px;
  left: 12px;
  width: 65px;
  height: 65px;
  z-index: 20;
  pointer-events: none;
  animation: roam 40s linear infinite alternate;
}
.companion img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: bob 1s ease-in-out infinite alternate;
}
.pet-hide {
  position: fixed;
  bottom: 7px;
  left: 85px;
  z-index: 21;
  font-size: 12px;
  padding: 5px;
}
.companion.spark img {
  filter: drop-shadow(0 0 10px gold);
}
@keyframes roam {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(100vw - 160px));
  }
}
@keyframes bob {
  from {
    transform: translateY(0) rotate(-2deg);
  }
  to {
    transform: translateY(-3px) rotate(2deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (max-width: 950px) {
  .orbit {
    grid-template-columns: 1fr 220px 1fr;
    gap: 15px;
  }
  .portal {
    padding: 17px;
    min-height: 140px;
  }
  .portal span.icon {
    display: none;
  }
  .portal strong {
    font-size: 17px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .two {
    grid-template-columns: 1fr;
  }
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  .reader {
    grid-template-columns: 1fr;
  }
  .reader aside {
    display: none;
  }
  header {
    flex-wrap: wrap;
  }
  header nav {
    order: 3;
    width: 100%;
    font-size: 14px;
  }
}
@media (max-width: 600px) {
  main {
    padding: 25px 18px;
  }
  .orbit {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
  }
  .brand-hero {
    grid-column: 1 / 3;
    grid-row: 1;
    width: 210px;
    justify-self: center;
  }
  .portal {
    min-height: 125px;
    padding: 15px;
  }
  .tagline {
    letter-spacing: -1px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 18px;
  }
  .reader .toolbar button {
    padding: 8px;
  }
  .companion {
    width: 45px;
    height: 45px;
  }
  .row > h1 {
    font-size: 30px;
  }
  .book-area {
    padding: 2px;
    min-height: 300px;
  }
  header nav {
    gap: 12px;
  }
  .book-simple {
    display: block;
  }
}
.demo-banner {
  padding: 10px 20px;
  text-align: center;
  background: #e2bb65;
  color: #07121f;
  font-size: 13px;
}
.demo-banner a {
  text-decoration: underline;
  font-weight: 700;
}
@media print {
  header,
  footer,
  .sidebar,
  .companion,
  .pet-hide,
  button,
  .button,
  .demo-banner {
    display: none !important;
  }
  body {
    background: white;
    color: black;
  }
  main {
    padding: 0;
  }
  .card {
    background: white;
    color: black;
    border-color: #ccc;
    break-inside: avoid;
  }
  .gold,
  .muted {
    color: #333;
  }
}
.question-image {
  display: block;
  max-width: 100%;
  max-height: 350px;
  margin: 20px auto;
  object-fit: contain;
}
.page-shell {
  padding: 0;
  min-height: 0;
}
.ophys-arcade-page input {
  max-width: 500px;
}
.ophys-arcade-page {
  padding: 15px;
}

/* Immersive PDF book reader */
body.pdf-reader-open { overflow: hidden; }
.reader.full { position: fixed; inset: 0; z-index: 9999; width: 100vw; height: 100dvh; max-width: none; display: flex; flex-direction: column; gap: 0; padding: max(8px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom)); overflow: hidden; border-radius: 0; box-sizing: border-box; }
.reader.full > aside { display: none; }
.reader.full > section { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.reader.full > section > .toolbar:first-child, .reader.full > section > .hint, .reader.full > section > .toolbar:last-child { display: none; }
.reader.full .toolbar { flex: 0 0 auto; margin-bottom: 8px; justify-content: center; }
.reader.full .book-area { flex: 1 1 auto; min-height: 0; width: 100%; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 4px; box-sizing: border-box; }
.reader.full .book-simple { max-height: 100%; align-items: center; }
.reader.full .pdfpage canvas { max-height: 100%; object-fit: contain; }
@media (max-width: 680px) { .reader.full { padding-left: 4px; padding-right: 4px; } .reader.full .toolbar { gap: 4px; } .reader.full .toolbar button { min-height: 36px; padding: 6px 9px; } .reader.full .book-simple { display: flex; } }


/* O'Phys v7: autonomous concours tile layout, included in base stylesheet to avoid missing optional CSS. */
#main .programme-intro{max-width:1000px;margin:clamp(24px,4vw,55px) auto 26px;text-align:left;min-height:0}
#main .programme-intro h1{font-family:Georgia,serif;font-size:clamp(2rem,5vw,3.8rem);line-height:1.12;margin:12px 0 18px}
#main .programme-intro p{max-width:760px;line-height:1.7}
#main .programme-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:clamp(16px,2.8vw,28px)!important;width:100%;max-width:1150px;margin:24px auto 65px;align-items:stretch;min-height:0}
#main .programme-grid .programme-tile{box-sizing:border-box;display:flex!important;flex-direction:column!important;align-items:flex-start;justify-content:flex-start;gap:16px;min-width:0;min-height:330px;padding:clamp(24px,3vw,40px);background:#f7f2e8!important;color:#0b1f3a!important;border:12px solid transparent!important;border-image-source:url('/assets/iznik-ceramic-tile-03.webp')!important;border-image-slice:32!important;border-image-repeat:round!important;box-shadow:0 14px 35px #0005;text-decoration:none!important;overflow-wrap:anywhere;transition:transform .25s ease,box-shadow .25s ease}
#main .programme-tile .programme-tile__eyebrow{display:block;font:700 10px/1.4 Arial,sans-serif;letter-spacing:.15em;text-transform:uppercase;color:#795e35!important}
#main .programme-tile strong{display:block;font-family:Georgia,serif;font-size:clamp(1.55rem,2.7vw,2.4rem);font-weight:400;line-height:1.16;color:#0b1f3a!important}
#main .programme-tile>span:not(.programme-tile__eyebrow):not(.programme-tile__cta){display:block;font-size:clamp(.86rem,1.3vw,1rem);line-height:1.65;color:#3c5063!important}
#main .programme-tile .programme-tile__cta{display:block;margin-top:auto;font-size:.9rem;font-weight:750;color:#173b63!important}
#main .programme-tile:hover,#main .programme-tile:focus-visible{transform:translateY(-4px);box-shadow:0 20px 40px #0006}
@media(max-width:760px){#main .programme-grid{grid-template-columns:minmax(0,1fr)!important;gap:18px!important;margin-top:20px;margin-bottom:32px}#main .programme-grid .programme-tile{min-height:230px;padding:25px 22px;border-width:9px!important;gap:12px}#main .programme-tile strong{font-size:clamp(1.55rem,6vw,2rem)}#main .programme-intro{margin-top:12px}#main .programme-intro h1{font-size:clamp(2rem,8vw,2.6rem)}}
@media(prefers-reduced-motion:reduce){#main .programme-tile{transition:none!important}}
