:root {
  --night: #07110d;
  --forest-950: #0b1c15;
  --forest-900: #102b20;
  --forest-800: #184331;
  --forest-700: #246247;
  --moss: #7aa564;
  --moss-light: #b8cf91;
  --sand: #d9c698;
  --amber: #d99a43;
  --orange: #c96d32;
  --bone: #efe7d2;
  --paper: #f5f0e4;
  --ink: #14231c;
  --white: #fffdf8;
  --danger: #9c3f35;
  --shadow: 0 24px 65px rgba(5, 17, 13, .18);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 78px; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 22%, rgba(122, 165, 100, .08), transparent 26rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}
button, a { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.skip-link {
  position: fixed; top: -5rem; left: 1rem; z-index: 1000;
  padding: .8rem 1rem; border-radius: 8px; color: white; background: var(--night);
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky; top: 0; z-index: 80;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.5rem;
  min-height: 76px; padding: .85rem clamp(1rem, 4vw, 4.5rem);
  color: white; background: rgba(7, 17, 13, .92); border-bottom: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: .8rem; color: white; text-decoration: none; font-weight: 900; letter-spacing: .01em; }
.brand-mark {
  display: inline-grid; place-items: center; width: 42px; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%; color: var(--night); background: var(--amber); font-family: Georgia, serif; font-weight: 900;
  box-shadow: inset 0 0 0 5px rgba(7,17,13,.1);
}
.main-nav { display: flex; justify-content: center; gap: clamp(1rem, 3vw, 2.6rem); }
.main-nav a { color: rgba(255,255,255,.75); text-decoration: none; font-size: .9rem; font-weight: 800; }
.main-nav a:hover, .main-nav a:focus-visible { color: var(--amber); }
.sound-toggle, .primary-button, .secondary-button, .filter-button {
  min-height: 46px; border: 0; border-radius: 999px; font-weight: 900;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}
.sound-toggle:hover, .primary-button:hover, .secondary-button:hover, .filter-button:hover { transform: translateY(-2px); }
.sound-toggle { display: inline-flex; align-items: center; gap: .55rem; padding: .65rem .95rem; color: white; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; padding: .85rem 1.25rem; text-decoration: none; }
.primary-button { color: var(--night); background: var(--amber); box-shadow: 0 9px 0 #8b5924, 0 18px 35px rgba(217,154,67,.18); }
.primary-button:active { transform: translateY(4px); box-shadow: 0 5px 0 #8b5924; }
.secondary-button { color: var(--forest-900); background: transparent; border: 1.5px solid var(--forest-800); }
.secondary-button.light { color: white; border-color: rgba(255,255,255,.5); }

.hero {
  position: relative; display: grid; grid-template-columns: minmax(0, .92fr) minmax(420px, 1.08fr);
  min-height: calc(100vh - 76px); overflow: hidden; color: white;
  background:
    radial-gradient(circle at 78% 18%, rgba(217,154,67,.18), transparent 26rem),
    linear-gradient(122deg, #07110d 0%, #102b20 48%, #203e2f 100%);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.28), transparent 58%), radial-gradient(circle at 50% 120%, rgba(122,165,100,.25), transparent 55%);
}
.hero-content { position: relative; z-index: 6; align-self: center; padding: clamp(4.5rem, 8vw, 8rem) clamp(1.2rem, 5vw, 6rem); }
.eyebrow { margin: 0 0 .65rem; color: var(--amber); font-size: .76rem; font-weight: 1000; letter-spacing: .18em; text-transform: uppercase; }
.hero h1 { max-width: 10ch; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.1rem, 7vw, 6.9rem); font-weight: 700; line-height: .93; letter-spacing: -.055em; }
.hero h1 span { display: block; color: var(--moss-light); font-style: italic; }
.hero-text { max-width: 58ch; margin: 1.6rem 0 0; color: rgba(255,255,255,.8); font-size: clamp(1.02rem, 2vw, 1.2rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }
.hero .secondary-button { color: white; border-color: rgba(255,255,255,.35); }
.science-note { display: grid; grid-template-columns: auto 1fr; gap: .8rem; max-width: 620px; margin-top: 2.5rem; padding: 1rem 1.1rem; border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-md); background: rgba(255,255,255,.055); backdrop-filter: blur(12px); }
.science-note p { margin: 0; color: rgba(255,255,255,.72); font-size: .85rem; }
.science-note strong { color: white; }
.hero-visual { position: relative; z-index: 4; min-height: 650px; }
.hero-dino { position: absolute; z-index: 5; right: -2%; bottom: 8%; width: min(880px, 112%); max-width: none; filter: drop-shadow(0 35px 35px rgba(0,0,0,.46)); transform-origin: 60% 90%; animation: breathe 5.5s ease-in-out infinite; }
.hero-ground { position: absolute; right: -20%; bottom: -13%; width: 130%; height: 33%; border-radius: 50% 40% 0 0; background: radial-gradient(ellipse at top, #38523c 0%, #142a20 45%, #09150f 80%); filter: blur(.2px); }
.specimen-label { position: absolute; z-index: 8; right: 8%; top: 12%; display: grid; gap: .15rem; padding: .9rem 1rem; border-left: 2px solid var(--amber); background: rgba(5,16,11,.32); backdrop-filter: blur(9px); }
.specimen-label span, .specimen-label small { color: rgba(255,255,255,.62); font-size: .72rem; text-transform: uppercase; letter-spacing: .11em; }
.specimen-label strong { font-family: Georgia, serif; font-size: 1.2rem; font-style: italic; }
.hero-mist { position: absolute; z-index: 3; width: 70%; height: 20%; border-radius: 50%; background: rgba(205,224,206,.12); filter: blur(48px); animation: drift 10s ease-in-out infinite alternate; }
.mist-one { right: -5%; bottom: 20%; }
.mist-two { right: 25%; bottom: 8%; opacity: .6; animation-delay: -4s; }
.forest-layer { position: absolute; z-index: 2; right: 0; bottom: 0; left: 42%; height: 88%; opacity: .4; background: repeating-linear-gradient(92deg, transparent 0 62px, rgba(4,13,9,.85) 64px 79px, transparent 81px 145px); clip-path: polygon(0 18%, 10% 0, 18% 25%, 28% 6%, 35% 31%, 45% 4%, 56% 28%, 68% 2%, 78% 24%, 90% 5%, 100% 18%, 100% 100%, 0 100%); }
.forest-front { z-index: 7; left: 58%; opacity: .52; transform: scaleX(-1); }
.scroll-cue { position: absolute; z-index: 10; bottom: 1.3rem; left: 50%; display: flex; align-items: center; gap: .7rem; transform: translateX(-50%); color: rgba(255,255,255,.46); font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; }
.scroll-cue span { display: block; width: 1px; height: 34px; background: linear-gradient(white, transparent); }

.era-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid rgba(20,35,28,.1); background: var(--bone); }
.era-strip div { padding: 1.1rem clamp(1rem, 4vw, 3.5rem); border-right: 1px solid rgba(20,35,28,.1); }
.era-strip span, .era-strip strong { display: block; }
.era-strip span { color: var(--orange); font-family: Georgia, serif; font-size: 1.3rem; font-weight: 700; }
.era-strip strong { margin-top: .15rem; color: rgba(20,35,28,.58); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }

.section { width: min(1200px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(4.8rem, 8vw, 7.5rem) 0; }
.section-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .78fr); align-items: end; gap: 2rem; margin-bottom: 2.2rem; }
.section-heading h2 { margin: 0; color: var(--forest-950); font-family: Georgia, serif; font-size: clamp(2.45rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -.04em; }
.section-heading > p { margin: 0; color: rgba(20,35,28,.68); font-size: 1.02rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.5rem; }
.filter-button { padding: .67rem 1rem; color: var(--forest-900); background: #e3dac4; }
.filter-button.active { color: white; background: var(--forest-800); }
.dino-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.2rem; }
.dino-card { position: relative; display: flex; min-height: 440px; flex-direction: column; overflow: hidden; border: 1px solid rgba(11,28,21,.1); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow); transition: transform .24s ease, box-shadow .24s ease; }
.dino-card:hover { transform: translateY(-8px); box-shadow: 0 30px 75px rgba(5,17,13,.24); }
.card-art { position: relative; display: grid; min-height: 220px; place-items: center; overflow: hidden; background: radial-gradient(circle at 72% 25%, rgba(255,255,255,.22), transparent 26%), linear-gradient(145deg, var(--card-light), var(--card-dark)); }
.card-art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(4,14,9,.3)); }
.card-art::after { content: ""; position: absolute; right: -8%; bottom: -22%; width: 170px; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255,255,255,.04), 0 0 0 58px rgba(255,255,255,.03); }
.dino-image { position: relative; z-index: 2; width: 94%; height: 190px; object-fit: contain; filter: drop-shadow(0 18px 15px rgba(0,0,0,.33)); transition: transform .25s ease; }
.dino-card:hover .dino-image { transform: scale(1.06) translateY(-3px); }
.diet-badge { position: absolute; top: 14px; left: 14px; z-index: 4; padding: .4rem .72rem; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; color: white; background: rgba(5,17,13,.48); font-size: .7rem; font-weight: 1000; text-transform: uppercase; letter-spacing: .07em; backdrop-filter: blur(9px); }
.card-content { display: flex; flex: 1; flex-direction: column; padding: 1.2rem; }
.card-index { color: var(--orange); font-size: .7rem; font-weight: 900; letter-spacing: .14em; }
.card-content h3 { margin: .35rem 0 0; color: var(--forest-950); font-family: Georgia, serif; font-size: 1.55rem; line-height: 1.05; }
.scientific-name { margin: .25rem 0 .8rem; color: var(--forest-700); font-size: .8rem; font-style: italic; }
.card-fact { margin: 0; color: rgba(20,35,28,.72); font-size: .92rem; }
.card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-top: auto; padding-top: 1rem; }
.card-meta span { padding: .65rem; border-radius: 11px; background: #eee7d7; font-size: .76rem; }
.card-actions { display: flex; gap: .55rem; margin-top: .8rem; }
.card-actions button { flex: 1; min-height: 43px; border: 0; border-radius: 11px; font-weight: 900; }
.sound-button { color: white; background: var(--forest-800); }
.info-button { color: var(--night); background: var(--amber); }

.fact-banner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.4rem; width: min(1200px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(1.5rem, 4vw, 2.6rem); border-radius: var(--radius-xl); color: white; background: linear-gradient(115deg, rgba(255,255,255,.04), transparent 55%), var(--forest-900); box-shadow: var(--shadow); }
.fact-banner .eyebrow { color: var(--moss-light); }
.fact-banner p { margin: 0; }
.fact-number { font-family: Georgia, serif; font-size: clamp(3rem, 7vw, 5rem); line-height: 1; color: rgba(255,255,255,.14); }

.quiz-section { width: min(920px, calc(100% - 2rem)); }
.quiz-card, .game-panel { padding: clamp(1.4rem, 4vw, 2.6rem); border: 1px solid rgba(11,28,21,.1); border-radius: var(--radius-xl); background: var(--white); box-shadow: var(--shadow); }
.quiz-topline, .game-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; color: var(--forest-800); font-size: .86rem; font-weight: 900; }
.progress-track { height: 10px; margin: 1rem 0 2rem; overflow: hidden; border-radius: 99px; background: #ded4bd; }
.progress-bar { width: 20%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--amber)); transition: width .3s ease; }
.quiz-card h3 { margin: 0 0 1.4rem; color: var(--forest-950); font-family: Georgia, serif; font-size: clamp(1.5rem, 3vw, 2.15rem); }
.quiz-answers { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.answer-button { min-height: 64px; padding: 1rem; border: 1.5px solid #dcd1b8; border-radius: 14px; color: var(--ink); background: #f0eadc; font-weight: 900; text-align: left; }
.answer-button:hover:not(:disabled) { border-color: var(--moss); transform: translateY(-2px); }
.answer-button.correct { border-color: #2e8555; background: #dff0df; }
.answer-button.wrong { border-color: var(--danger); background: #f5ddd6; }
.answer-button:disabled { cursor: default; }
.quiz-feedback, .game-message { min-height: 1.6rem; margin: 1rem 0; font-weight: 900; }
.hidden { display: none !important; }

.fossil-section { width: min(980px, calc(100% - 2rem)); }
.game-status { margin-bottom: 1.3rem; }
.game-status div { min-width: 110px; }
.game-status span, .game-status strong { display: block; }
.game-status span { color: var(--forest-700); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.game-status strong { color: var(--forest-950); font-size: 1.2rem; }
.dig-site { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.dig-tile { position: relative; display: grid; min-height: 120px; place-items: center; overflow: hidden; border: 0; border-radius: 17px; background: radial-gradient(circle at 35% 28%, #d5ad70 0 8%, transparent 9%), radial-gradient(circle at 70% 65%, #8d5a31 0 7%, transparent 8%), linear-gradient(145deg, #b9874c, #674324); box-shadow: inset 0 -8px 0 rgba(45,25,11,.22); font-size: 2.7rem; transition: transform .18s ease; }
.dig-tile:hover:not(:disabled) { transform: translateY(-4px) rotate(-1deg); }
.dig-tile::before { content: ""; width: 58px; height: 42px; border-radius: 48% 54% 45% 57%; background: linear-gradient(145deg, #6e6257, #3f3933); box-shadow: inset -8px -6px 0 rgba(0,0,0,.18), 0 11px 12px rgba(0,0,0,.2); transition: transform .25s ease, opacity .25s ease; }
.dig-tile.revealed::before { opacity: 0; transform: scale(1.6) rotate(20deg); }
.dig-tile.fossil { background: linear-gradient(145deg, #ead39f, #bb8449); }
.dig-tile.empty { background: linear-gradient(145deg, #bc9466, #845a38); }

.dino-dialog { width: min(720px, calc(100% - 2rem)); max-height: 88vh; overflow: auto; padding: 0; border: 0; border-radius: var(--radius-xl); color: var(--ink); background: var(--white); box-shadow: 0 36px 100px rgba(0,0,0,.45); }
.dino-dialog::backdrop { background: rgba(3,12,8,.78); backdrop-filter: blur(6px); }
.dialog-close { position: sticky; z-index: 8; top: .8rem; float: right; width: 42px; aspect-ratio: 1; margin: .8rem .8rem -3rem 0; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; color: white; background: rgba(7,17,13,.82); font-size: 1.55rem; }
.dialog-hero { position: relative; display: grid; min-height: 300px; place-items: center; overflow: hidden; background: radial-gradient(circle at 70% 20%, rgba(255,255,255,.22), transparent 25%), linear-gradient(145deg, var(--dialog-light), var(--dialog-dark)); }
.dialog-hero::after { content: ""; position: absolute; inset: auto -20% -40% -20%; height: 60%; border-radius: 50%; background: rgba(5,17,13,.22); }
.dialog-image { position: relative; z-index: 2; width: 88%; height: 260px; object-fit: contain; filter: drop-shadow(0 22px 20px rgba(0,0,0,.38)); }
.dialog-body { padding: 1.6rem 1.7rem 1.9rem; }
.dialog-body h2 { margin: 0; color: var(--forest-950); font-family: Georgia, serif; font-size: clamp(2.1rem, 6vw, 3.8rem); line-height: .95; }
.dialog-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin: 1.2rem 0; }
.dialog-facts div { padding: .85rem; border-radius: 13px; background: #eee7d7; }
.dialog-facts span, .dialog-facts strong { display: block; }
.dialog-facts span { color: var(--forest-700); font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }

.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 2.2rem clamp(1rem, 4vw, 4.5rem); color: white; background: var(--night); }
.footer-brand { display: flex; align-items: center; gap: .8rem; }
.footer-brand strong, .footer-brand small { display: block; }
.footer-brand small { color: rgba(255,255,255,.52); }
.site-footer p { margin: 0; color: rgba(255,255,255,.65); }
.site-footer a { color: var(--amber); }
.noscript { padding: 1rem; color: white; background: var(--danger); text-align: center; }

.credits-page { min-height: 100vh; color: var(--ink); background: var(--paper); }
.credits-shell { width: min(900px, calc(100% - 2rem)); margin: 0 auto; padding: 4rem 0 6rem; }
.credits-shell h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.7rem, 7vw, 5rem); }
.credits-list { display: grid; gap: 1rem; margin-top: 2rem; }
.credit-card { padding: 1.2rem; border-radius: var(--radius-md); background: white; box-shadow: var(--shadow); }
.credit-card h2 { margin: 0 0 .35rem; font-family: Georgia, serif; }
.credit-card p { margin: .2rem 0; }
.credit-card a { color: var(--forest-700); }

@keyframes breathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-8px) scale(1.012); } }
@keyframes drift { from { transform: translateX(-7%); } to { transform: translateX(8%); } }

@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; }
  .hero-content { padding-bottom: 1rem; }
  .hero-visual { min-height: 520px; }
  .hero-dino { right: 4%; bottom: 4%; width: min(800px, 94%); }
  .forest-layer { left: 20%; }
  .dino-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .site-header { grid-template-columns: 1fr auto; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; width: 100%; }
  .button-label { display: none; }
  .hero-visual { min-height: 430px; }
  .specimen-label { top: 4%; right: 4%; }
  .scroll-cue { display: none; }
  .era-strip { grid-template-columns: 1fr; }
  .era-strip div { border-right: 0; border-bottom: 1px solid rgba(20,35,28,.1); }
  .section-heading, .fact-banner { grid-template-columns: 1fr; }
  .fact-number { display: none; }
  .quiz-answers { grid-template-columns: 1fr; }
  .dig-site { grid-template-columns: repeat(3, 1fr); }
  .site-footer { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .dino-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(3rem, 15vw, 4.8rem); }
  .hero-visual { min-height: 350px; }
  .hero-dino { width: 108%; right: -10%; }
  .dig-site { grid-template-columns: repeat(2, 1fr); }
  .dialog-facts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
:focus-visible { outline: 4px solid var(--amber); outline-offset: 3px; }
