:root {
  --ink: #26332d;
  --paper: #f4f0e5;
  --accent: #b76d3b;
  --line: rgba(38, 51, 45, .22);
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #b8c9c3; color: var(--ink); font-family: Arial, Helvetica, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, a { -webkit-tap-highlight-color: transparent; }
button, a { color: inherit; }
button { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--paper); outline-offset: 4px; }
#scene { position: fixed; inset: 0; cursor: grab; }
#scene.dragging { cursor: grabbing; }
#scene canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(29,43,41,.12), transparent 24%, transparent 66%, rgba(27,30,24,.3)), radial-gradient(ellipse at center, transparent 48%, rgba(31,39,30,.14) 110%); }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .055; mix-blend-mode: multiply; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E"); }
.interface { transition: opacity .45s ease, transform .45s ease; }
body.ui-hidden .interface { opacity: 0; pointer-events: none; }
.masthead { position: fixed; z-index: 5; top: 0; left: 0; width: 100%; height: 100px; padding: 27px 36px; display: flex; align-items: flex-start; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; }
.brand > span { display: flex; flex-direction: column; gap: 5px; }
.brand strong { font-size: 13px; letter-spacing: .24em; font-weight: 700; }
.brand small { font-size: 8px; letter-spacing: .27em; opacity: .68; }
.location { margin-top: 12px; display: flex; align-items: center; gap: 10px; font-size: 8px; letter-spacing: .18em; font-weight: 600; }
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: #9b5b36; box-shadow: 0 0 0 3px rgba(155,91,54,.12); }
.location-divider { width: 1px; height: 9px; background: var(--line); margin: 0 3px; }
.notes-button { border: 0; padding: 9px 0 9px 15px; background: none; display: flex; align-items: center; gap: 15px; font-size: 9px; letter-spacing: .18em; cursor: pointer; }
.notes-button svg { width: 18px; height: 18px; transition: transform .25s; }
.notes-button:hover svg { transform: translate(2px,-2px); }
.chapter { position: fixed; z-index: 3; left: 37px; top: 118px; display: flex; align-items: center; gap: 12px; font-size: 8px; letter-spacing: .2em; }
.chapter > span:first-child { font-family: Georgia, serif; font-style: italic; font-size: 12px; letter-spacing: 0; }
.chapter i { display: block; width: 29px; height: 1px; background: var(--ink); opacity: .45; }
.species { position: fixed; z-index: 3; left: 37px; bottom: 137px; pointer-events: none; text-shadow: 0 1px 15px rgba(240,232,204,.15); }
.eyebrow { display: flex; align-items: center; gap: 9px; font-size: 8px; font-weight: 600; letter-spacing: .18em; }
.eyebrow > span { width: 21px; height: 1px; background: var(--accent); }
.species h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(38px, 4.2vw, 65px); line-height: .95; letter-spacing: -.045em; font-weight: 400; margin: 13px 0 10px; }
.species p { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: 13px; font-style: italic; opacity: .76; }
.view-switch { position: fixed; z-index: 5; right: 34px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.view-label { font-size: 7px; letter-spacing: .22em; margin: 0 2px 12px 0; opacity: .65; }
.view-button { width: 105px; position: relative; border: 0; border-right: 1px solid rgba(38,51,45,.25); background: transparent; padding: 10px 13px 10px 8px; text-align: right; font-family: Georgia, serif; font-size: 13px; opacity: .53; cursor: pointer; transition: opacity .25s, border-color .25s, background .25s; }
.view-button span { font-family: Arial, sans-serif; font-size: 7px; letter-spacing: .08em; margin-right: 9px; vertical-align: 2px; }
.view-button:hover { opacity: .85; }
.view-button.active { opacity: 1; border-right: 2px solid var(--ink); background: linear-gradient(90deg, transparent, rgba(244,240,229,.12)); }
.control-wrap { position: fixed; z-index: 6; bottom: max(26px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(546px, calc(100% - 48px)); }
.controls { height: 70px; padding: 0 20px 0 14px; display: flex; align-items: center; gap: 16px; border: 1px solid rgba(246,241,223,.26); border-radius: 4px; background: rgba(32,42,35,.83); box-shadow: 0 12px 45px rgba(25,30,23,.17), inset 0 1px rgba(255,255,255,.035); color: #f3eee1; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.play-button { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; border: 1px solid rgba(244,238,222,.45); background: transparent; color: #f4eee0; display: grid; place-items: center; cursor: pointer; transition: color .2s, background .2s; }
.play-button:hover { background: #f4eee0; color: #2a352d; }
.play-button svg { width: 17px; height: 17px; }
.play-icon { display: none; }
body.paused .pause-icon { display: none; }
body.paused .play-icon { display: block; }
.movement-copy { display: flex; flex-direction: column; gap: 5px; min-width: 92px; }
.movement-copy span, .speed-control label { font-size: 7px; letter-spacing: .17em; opacity: .58; }
.movement-copy strong { font-family: Georgia, serif; font-size: 13px; font-weight: 400; white-space: nowrap; }
.control-divider { height: 26px; width: 1px; flex: 0 0 1px; background: rgba(244,238,222,.16); }
.speed-control { flex: 1; min-width: 100px; }
.speed-control label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.speed-control output { color: #f4eee0; opacity: 1; font-size: 8px; letter-spacing: .08em; }
input[type="range"] { display: block; appearance: none; -webkit-appearance: none; width: 100%; height: 2px; margin: 0; border: 0; border-radius: 2px; background: linear-gradient(to right, #d8c6a5 50%, rgba(244,238,222,.2) 50%); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 8px; height: 8px; border-radius: 50%; background: #eee5d4; box-shadow: 0 0 0 3px rgba(238,229,212,.09); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border: 0; border-radius: 50%; background: #eee5d4; }
.reset-button { padding: 7px 0; border: 0; background: none; color: inherit; display: flex; align-items: center; gap: 7px; cursor: pointer; opacity: .7; transition: opacity .2s; }
.reset-button:hover { opacity: 1; }
.reset-button svg { width: 17px; height: 17px; }
.reset-button span { font-size: 7px; letter-spacing: .12em; white-space: nowrap; }
.under-controls { display: flex; justify-content: space-between; margin-top: 12px; color: rgba(242,237,220,.75); font-size: 7px; letter-spacing: .15em; text-shadow: 0 1px 4px rgba(20,26,21,.45); }
.under-controls > span:first-child { display: flex; align-items: center; gap: 6px; }
.under-controls i { display: block; width: 4px; height: 4px; border-radius: 50%; background: #d6a66f; }
.under-controls b { font-weight: 400; margin: 0 6px; }
.soundless { position: fixed; z-index: 2; left: 38px; bottom: 43px; height: 20px; display: flex; align-items: center; gap: 3px; opacity: .65; }
.soundless span { width: 1px; height: 8px; background: var(--paper); animation: meter 2.5s ease-in-out infinite alternate; }
.soundless span:nth-child(2) { height: 15px; animation-delay: -.8s; }.soundless span:nth-child(3) { height: 11px; animation-delay: -1.4s; }.soundless span:nth-child(4) { height: 18px; animation-delay: -.3s; }.soundless span:nth-child(5) { height: 6px; animation-delay: -1.1s; }
@keyframes meter { to { transform: scaleY(.45); } }
body.paused .soundless span { animation-play-state: paused; }
.field-notes { position: fixed; z-index: 8; right: 28px; top: 84px; width: 322px; padding: 24px 25px 20px; color: #eee8da; background: rgba(32,43,36,.91); border: 1px solid rgba(255,255,255,.14); border-radius: 3px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 20px 60px rgba(25,30,24,.22); opacity: 0; transform: translateX(25px); pointer-events: none; }
.field-notes.open { opacity: 1; transform: translateX(0); pointer-events: auto; }
.notes-top { display: flex; justify-content: space-between; align-items: center; font-size: 7px; letter-spacing: .2em; opacity: .65; }
.notes-top button { border: 0; background: none; color: inherit; font-family: Georgia, serif; font-size: 24px; line-height: 16px; cursor: pointer; padding: 0 0 5px 8px; }
.field-notes h2 { font-family: Georgia, serif; font-size: 35px; font-weight: 400; line-height: 1.02; letter-spacing: -.025em; margin: 23px 0 14px; }
.notes-intro { color: rgba(238,232,218,.68); font-family: Georgia, serif; font-size: 12px; line-height: 1.6; }
.facts { margin: 22px 0; padding: 17px 0; border-top: 1px solid rgba(255,255,255,.12); border-bottom: 1px solid rgba(255,255,255,.12); display: grid; grid-template-columns: 1fr 1fr; gap: 18px 10px; }
.facts div:last-child { grid-column: 1 / -1; }
.facts dt, .note-label { font-size: 7px; letter-spacing: .16em; opacity: .48; margin-bottom: 7px; }
.facts dd { margin: 0; font-family: Georgia, serif; font-size: 17px; }
.facts small { font-family: Arial, sans-serif; font-size: 8px; opacity: .55; }
.gait-note p { font-size: 10px; line-height: 1.65; color: rgba(238,232,218,.68); }
.gait-diagram { display: flex; align-items: center; margin-top: 17px; }
.gait-diagram span { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid rgba(238,232,218,.28); border-radius: 50%; font-size: 7px; }
.gait-diagram i { width: 20px; height: 1px; background: rgba(238,232,218,.16); }
.notes-footer { margin-top: 24px; font-size: 6px; letter-spacing: .13em; opacity: .36; }
#toast { position: fixed; z-index: 10; top: 95px; left: 50%; transform: translate(-50%,-8px); padding: 9px 14px; border-radius: 2px; color: #f2ecdf; background: rgba(35,45,38,.75); font-size: 8px; letter-spacing: .14em; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; }
#toast.show { opacity: 1; transform: translate(-50%,0); }
.loading { position: fixed; z-index: 50; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #d5d0ba; transition: opacity .8s ease, visibility .8s; }
.loading.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-mark { width: 60px; height: 60px; display: grid; place-items: center; border: 1px solid rgba(38,51,45,.4); border-radius: 50%; font-family: Georgia, serif; font-style: italic; font-size: 20px; margin-bottom: 22px; }
.loading > span { font-size: 12px; letter-spacing: .32em; margin-left: .32em; }
.loading p { margin: 12px 0 23px; font-family: Georgia, serif; font-size: 12px; font-style: italic; opacity: .55; }
.loading-line { width: 120px; height: 1px; background: rgba(38,51,45,.16); overflow: hidden; }
.loading-line i { display: block; width: 45%; height: 100%; background: #566258; animation: loading 1.4s ease-in-out infinite; }
@keyframes loading { from { transform: translateX(-110%); } to { transform: translateX(330%); } }
.no-script { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; background: #d5d0ba; font-family: Georgia,serif; }
@media (max-width: 800px) {
  .masthead { padding: 21px 22px; }
  .location { display: none; }
  .chapter { left: 23px; top: 98px; }
  .species { left: 23px; bottom: 135px; }
  .species h1 { font-size: 42px; }
  .eyebrow { font-size: 6px; }
  .view-switch { right: 16px; }
  .view-button { width: 85px; font-size: 12px; }
  .view-button span { display: none; }
  .soundless { display: none; }
  .field-notes { right: 16px; top: 76px; }
}
@media (max-width: 540px) {
  .brand strong { font-size: 11px; }.brand small { font-size: 6px; }.brand-mark { width: 32px; height: 32px; }
  .notes-button span { display: none; }
  .species { bottom: 135px; }
  .species p { font-size: 11px; }
  .view-switch { top: 40%; }
  .view-label { display: none; }
  .view-button { width: 32px; height: 32px; overflow: hidden; color: transparent; padding: 0; border: 1px solid rgba(38,51,45,.25); border-radius: 50%; margin-bottom: 5px; }
  .view-button span { display: inline; color: var(--ink); margin: 0; font-size: 8px; vertical-align: 0; }
  .view-button.active { border: 1px solid var(--ink); background: rgba(244,240,229,.2); }
  .control-wrap { width: calc(100% - 28px); bottom: max(20px, env(safe-area-inset-bottom)); }
  .controls { height: 64px; padding: 0 13px; gap: 11px; }
  .movement-copy { min-width: 78px; }.movement-copy strong { font-size: 12px; }
  .reset-button span { display: none; }.reset-button svg { width: 19px; }
  .under-controls { font-size: 5px; letter-spacing: .1em; }
  .under-controls > span:last-child { font-size: 0; }.under-controls > span:last-child b { display: none; }.under-controls > span:last-child::after { content: 'DRAG · PINCH TO EXPLORE'; font-size: 6px; }
  .field-notes { width: calc(100% - 32px); max-height: calc(100% - 180px); overflow-y: auto; }
}
@media (max-height: 650px) and (min-width: 700px) {
  .species { bottom: 120px; }.species h1 { font-size: 40px; }.chapter { top: 95px; }
  .field-notes { max-height: calc(100% - 180px); overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) { .loading-line i, .soundless span { animation: none; } * { scroll-behavior: auto; } }
