:root {
  --ink: #24332e;
  --muted: #66756f;
  --cream: #fffaf0;
  --paper: #ffffff;
  --green: #166b55;
  --mint: #dff3e9;
  --yellow: #f6c84c;
  --orange: #ef7651;
  --lavender: #ddd8ff;
  --blue: #cce9f2;
  --line: #e7e4d9;
  --shadow: 0 18px 50px rgba(57, 66, 55, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "Nunito", system-ui, sans-serif;
  min-width: 320px;
}
button { font: inherit; color: inherit; }
button:focus-visible { outline: 4px solid rgba(239, 118, 81, .35); outline-offset: 3px; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; overflow: hidden; position: relative; }
.app-shell::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .35; background-image: radial-gradient(#dddbc9 0.7px, transparent 0.7px); background-size: 18px 18px; }

.topbar {
  height: 86px; max-width: 1240px; margin: auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 5;
  border-bottom: 1px solid rgba(36, 51, 46, .1);
}
.brand { border: 0; background: none; display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px; text-align: left; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px 16px 16px 5px; background: var(--green); font-size: 25px; box-shadow: 0 6px 0 #0c4d3c; }
.brand strong { display: block; font: 700 20px/1 "Fredoka", sans-serif; letter-spacing: -.3px; }
.brand small { color: var(--muted); font-weight: 800; font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.mini-stat { display: flex; gap: 8px; align-items: center; padding: 7px 14px; border: 1px solid var(--line); background: rgba(255,255,255,.65); border-radius: 99px; }
.mini-stat > span:first-child { font-size: 20px; }
.mini-stat span:last-child { display: flex; flex-direction: column; line-height: 1; }
.mini-stat small { font-size: 8px; color: var(--muted); font-weight: 900; letter-spacing: 1px; }
.mini-stat strong { font-size: 16px; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); background: #fff; border-radius: 50%; cursor: pointer; font-size: 18px; }

main { max-width: 1240px; margin: auto; padding: 0 28px; position: relative; z-index: 1; }
.hero { min-height: 500px; display: grid; grid-template-columns: 1.08fr .92fr; align-items: center; gap: 40px; padding: 54px 0 34px; }
.hero-copy { max-width: 640px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: 2px; }
.eyebrow i { display: block; width: 20px; height: 3px; background: var(--yellow); border-radius: 10px; }
h1, h2 { font-family: "Fredoka", sans-serif; margin: 0; }
h1 { font-size: clamp(48px, 6.5vw, 82px); line-height: .93; letter-spacing: -3.5px; margin-top: 18px; }
h1 em { font-style: normal; color: var(--orange); position: relative; }
h1 em::after { content: ""; position: absolute; left: 3px; right: 0; bottom: -8px; height: 7px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 10'%3E%3Cpath d='M2 7C50 1 150 1 198 5' fill='none' stroke='%23f6c84c' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E") center/100% 100% no-repeat; }
.hero-copy > p { max-width: 540px; color: var(--muted); font-size: 18px; line-height: 1.6; margin: 28px 0; }
.hero-actions, .result-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.primary-button { border: 0; color: white; background: var(--green); padding: 16px 20px 16px 23px; border-radius: 14px; font-weight: 900; cursor: pointer; box-shadow: 0 6px 0 #0b4f3e; transition: transform .2s, box-shadow .2s; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #0b4f3e; }
.primary-button:active { transform: translateY(4px); box-shadow: 0 2px 0 #0b4f3e; }
.primary-button span { margin-left: 18px; font-size: 20px; }
.primary-button.compact { padding: 12px 24px; }
.text-button { border: 0; background: transparent; padding: 13px 4px; font-weight: 900; cursor: pointer; border-bottom: 2px solid transparent; }
.text-button:hover { border-color: var(--yellow); }
.text-button span { margin-right: 7px; color: var(--orange); }

.hero-art { min-height: 395px; position: relative; }
.sun-orbit { position: absolute; width: 340px; height: 340px; border-radius: 50%; background: var(--yellow); left: 50%; top: 50%; transform: translate(-50%,-50%); box-shadow: inset 0 0 0 18px rgba(255,255,255,.22); }
.sun-orbit::after { content: ""; position: absolute; inset: -24px; border: 2px dashed rgba(36,51,46,.16); border-radius: 50%; }
.animal-bubble { position: absolute; display: grid; place-items: center; border: 7px solid white; box-shadow: var(--shadow); animation: float 5s ease-in-out infinite; }
.animal-bubble span { filter: drop-shadow(0 5px 0 rgba(0,0,0,.08)); }
.bubble-dog { width: 178px; height: 178px; border-radius: 48% 52% 42% 58%; background: #d7a26b; left: 28%; top: 19%; font-size: 105px; z-index: 2; }
.bubble-cat { width: 130px; height: 130px; border-radius: 44% 56% 54% 46%; background: var(--lavender); right: 5%; top: 12%; font-size: 76px; animation-delay: -.8s; }
.bubble-bird { width: 116px; height: 116px; border-radius: 58% 42% 50% 50%; background: var(--mint); left: 6%; top: 57%; font-size: 66px; animation-delay: -2.2s; }
.bubble-fish { width: 128px; height: 128px; border-radius: 53% 47% 61% 39%; background: var(--blue); right: 12%; bottom: 0; font-size: 70px; animation-delay: -3.2s; }
.sparkle { position: absolute; color: var(--orange); font-size: 27px; }
.s1 { left: 8%; top: 21%; }.s2 { right: 0; top: 49%; color: var(--green); }.s3 { left: 48%; bottom: 3%; font-size: 11px; }
@keyframes float { 0%,100%{ transform: translateY(0) rotate(-1deg) } 50%{ transform: translateY(-12px) rotate(2deg) } }

.choose-section { padding: 60px 0 74px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-heading h2, .learn-header h2 { font-size: 35px; letter-spacing: -1px; margin-top: 8px; }
.section-heading > p, .learn-header p { color: var(--muted); font-size: 14px; }
.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.category-card { border: 0; text-align: left; min-height: 210px; padding: 22px; position: relative; overflow: hidden; border-radius: 24px; cursor: pointer; transition: transform .22s, box-shadow .22s; box-shadow: inset 0 0 0 1px rgba(36,51,46,.07); }
.category-card:hover { transform: translateY(-6px) rotate(-.5deg); box-shadow: 0 18px 30px rgba(30,50,40,.12); }
.category-card[data-category="dog"] { background: #f8dfbf; }
.category-card[data-category="cat"] { background: #e4ddf7; }
.category-card[data-category="bird"] { background: #d9eee5; }
.category-card[data-category="fish"] { background: #d9edf3; }
.category-card[data-category="shark"] { background: #d5e9ed; }
.category-card[data-category="whale"] { background: #dce5f5; }
.category-card small { font-size: 10px; font-weight: 900; letter-spacing: 1.5px; opacity: .65; }
.category-card h3 { font: 700 25px "Fredoka"; margin: 4px 0; }
.category-card p { width: 62%; margin: 0; font-size: 12px; line-height: 1.45; color: #52615b; }
.category-card .card-emoji { position: absolute; font-size: 90px; right: 4px; bottom: -10px; filter: drop-shadow(0 9px 0 rgba(0,0,0,.06)); transition: transform .25s; }
.category-card:hover .card-emoji { transform: scale(1.09) rotate(4deg); }
.category-card .go-dot { position: absolute; bottom: 19px; left: 21px; width: 33px; height: 33px; background: white; border-radius: 50%; display: grid; place-items: center; font-weight: 900; }

.game-view { padding: 30px 0 70px; min-height: calc(100vh - 86px); }
.game-topline { display: grid; grid-template-columns: 1fr minmax(250px, 420px) 1fr; align-items: center; gap: 20px; margin-bottom: 24px; }
.back-button { justify-self: start; border: 0; background: transparent; font-weight: 900; cursor: pointer; color: var(--muted); padding: 10px 0; }
.back-button:hover { color: var(--ink); }
.round-progress { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .5px; }
.progress-track { height: 8px; background: #e5e4db; border-radius: 99px; overflow: hidden; }
.progress-track > div { height: 100%; width: 20%; background: var(--orange); border-radius: inherit; transition: width .35s; }
.score-pill { justify-self: end; background: white; border: 1px solid var(--line); border-radius: 99px; padding: 8px 16px; display: flex; align-items: center; gap: 7px; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 22px; align-items: stretch; }
.quiz-card, .answer-panel { background: rgba(255,255,255,.83); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 28px; }
.quiz-card { padding: 28px; }
.question-heading { position: relative; text-align: center; }
.category-tag { display: inline-block; padding: 6px 10px; border-radius: 99px; background: var(--mint); color: var(--green); font-size: 9px; font-weight: 900; letter-spacing: 1.5px; }
.question-heading h2 { font-size: 32px; margin: 8px 0 16px; }
.speak-button { position: absolute; right: 0; top: 0; border: 1px solid var(--line); background: white; border-radius: 99px; padding: 8px 11px; font-size: 11px; font-weight: 900; cursor: pointer; }
.portrait-stage { height: 310px; border-radius: 22px; display: grid; place-items: center; position: relative; overflow: hidden; background: #f5ead8; }
.portrait-stage::before { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.12); z-index: 1; pointer-events: none; }
.portrait-stage svg { width: 72%; height: 88%; position: relative; z-index: 1; filter: drop-shadow(0 15px 0 rgba(36,51,46,.07)); }
.animal-photo, .photo-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
.photo-backdrop { object-fit: cover; filter: blur(18px) saturate(.8); transform: scale(1.12); opacity: .46; }
.animal-photo { object-fit: contain; z-index: 2; padding: 7px; }
.clue-card { display: flex; align-items: center; gap: 12px; background: #fff8df; border: 1px solid #f6e6ad; border-radius: 16px; padding: 11px 15px; margin-top: 16px; }
.clue-card > span { width: 36px; height: 36px; display: grid; place-items: center; background: white; border-radius: 50%; }
.clue-card p { margin: 0; display: flex; flex-direction: column; font-size: 13px; }
.clue-card p span { color: var(--muted); }
.answer-panel { padding: 28px; display: flex; flex-direction: column; justify-content: center; }
.answer-kicker { color: var(--muted); font-size: 10px; letter-spacing: 1.5px; font-weight: 900; margin-bottom: 11px; }
.answer-list { display: grid; gap: 11px; }
.answer-button { width: 100%; border: 2px solid var(--line); background: white; border-radius: 15px; min-height: 59px; padding: 11px 14px; display: flex; align-items: center; gap: 12px; text-align: left; font-weight: 900; cursor: pointer; transition: border .15s, background .15s, transform .15s; }
.answer-button:hover:not(:disabled) { transform: translateX(4px); border-color: var(--yellow); background: #fffdf4; }
.answer-button .option-letter { width: 33px; height: 33px; display: grid; place-items: center; background: #f3f2ec; border-radius: 9px; font: 700 14px "Fredoka"; }
.answer-button.correct { border-color: #3a9b76; background: #e8f7ef; }
.answer-button.wrong { border-color: var(--orange); background: #fff0eb; animation: shake .35s; }
.answer-button.faded { opacity: .4; }
.answer-button:disabled { cursor: default; }
.answer-button .feedback-icon { margin-left: auto; }
@keyframes shake { 25%{transform:translateX(-5px)} 50%{transform:translateX(5px)} 75%{transform:translateX(-3px)} }
.hint-button { margin-top: 15px; border: 1px dashed #c8c4b3; background: transparent; border-radius: 14px; padding: 11px; color: var(--muted); font-size: 12px; font-weight: 900; cursor: pointer; }
.hint-button:hover { background: #fffaf0; color: var(--ink); }

.learn-view { padding: 36px 0 70px; }
.learn-header { display: grid; grid-template-columns: 170px 1fr 170px; text-align: center; align-items: start; }
.filter-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 30px 0 24px; }
.filter-button { border: 1px solid var(--line); background: white; padding: 9px 15px; border-radius: 99px; font-size: 12px; font-weight: 900; cursor: pointer; }
.filter-button.active { color: white; background: var(--green); border-color: var(--green); }
.breed-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.breed-card { border: 1px solid var(--line); background: white; border-radius: 21px; overflow: hidden; text-align: left; cursor: pointer; padding: 0; box-shadow: 0 8px 24px rgba(50,60,50,.06); transition: transform .2s; }
.breed-card:hover { transform: translateY(-5px); }
.breed-card-art { height: 155px; display: grid; place-items: center; position: relative; overflow: hidden; }
.breed-card-art::before { content:""; position:absolute; width:115px; height:115px; border-radius:50%; background:rgba(255,255,255,.55); }
.breed-card-art svg { width: 80%; height: 92%; z-index: 1; filter: drop-shadow(0 8px 0 rgba(0,0,0,.06)); }
.breed-card-art .animal-photo { padding: 5px; }
.breed-card-copy { padding: 14px 16px 17px; }
.breed-card-copy small { color: var(--muted); font-size: 9px; letter-spacing: 1.2px; font-weight: 900; }
.breed-card-copy h3 { font: 700 19px "Fredoka"; margin: 3px 0; }
.breed-card-copy span { color: var(--green); font-size: 11px; font-weight: 900; }

.results-view { min-height: calc(100vh - 130px); display: grid; place-items: center; padding: 50px 0; }
.results-card { width: min(570px, 100%); text-align: center; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 30px; padding: 48px; position: relative; }
.badge-burst { margin: 0 auto 20px; width: 105px; height: 105px; display: grid; place-items: center; border-radius: 50% 45% 50% 48%; background: var(--yellow); font-size: 56px; transform: rotate(-4deg); }
.badge-burst span { transform: rotate(4deg); }
.results-card h2 { font-size: 38px; margin: 9px 0; }
.results-card > p { color: var(--muted); margin: 0 auto 17px; max-width: 400px; }
.result-score { display: inline-flex; flex-direction: column; padding: 10px 28px; background: var(--cream); border-radius: 15px; }
.result-score strong { font: 700 36px/1 "Fredoka"; color: var(--green); }
.result-score span { font-size: 10px; letter-spacing: 1px; font-weight: 900; color: var(--muted); text-transform: uppercase; }
.stars { font-size: 34px; letter-spacing: 6px; color: var(--yellow); margin: 13px 0 20px; text-shadow: 0 2px 0 #d49f1a; }
.result-actions { justify-content: center; }

.fact-modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(29,42,37,.55); backdrop-filter: blur(4px); }
.modal-card { width: min(410px,100%); position: relative; z-index: 1; background: white; border-radius: 28px; padding: 25px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.25); animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.modal-close { position: absolute; z-index: 2; right: 14px; top: 14px; width: 35px; height: 35px; border: 0; border-radius: 50%; background: white; cursor: pointer; font-size: 23px; }
#factPortrait { height: 190px; border-radius: 19px; margin-bottom: 16px; display: grid; place-items: center; overflow: hidden; }
#factPortrait svg { width: 72%; height: 95%; filter: drop-shadow(0 9px 0 rgba(0,0,0,.06)); }
#factPortrait { position: relative; }
.source-links { display: flex; align-items: center; justify-content: center; gap: 7px 16px; flex-wrap: wrap; margin: -4px auto 20px; }
.photo-source, .info-source { color: var(--green); font-size: 11px; font-weight: 900; }
.modal-card h2 { font-size: 30px; margin: 8px 0; }
.modal-card p { color: var(--muted); line-height: 1.55; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 30px; transform: translateX(-50%); background: var(--ink); color: white; padding: 12px 20px; border-radius: 99px; font-weight: 900; font-size: 13px; box-shadow: var(--shadow); animation: toast-in .25s; }
@keyframes toast-in { from { transform: translate(-50%,12px); opacity:0; } }
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 10px; height: 18px; border-radius: 3px; animation: confetti-fall 1.2s ease-in forwards; }
@keyframes confetti-fall { to { transform: translate(var(--drift), 105vh) rotate(720deg); } }
footer { max-width: 1184px; margin: auto; border-top: 1px solid var(--line); padding: 20px 0 28px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .5px; display: flex; justify-content: space-between; position: relative; z-index: 1; }
footer a { color: inherit; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 42px; }
  .hero-art { min-height: 350px; order: -1; }
  .sun-orbit { width: 290px; height: 290px; }
  .bubble-dog { left: 31%; }
  .category-grid, .breed-grid { grid-template-columns: repeat(2, 1fr); }
  .game-layout { grid-template-columns: 1fr; }
  .answer-panel { padding: 20px; }
  .answer-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .topbar { height: 72px; padding: 0 17px; }
  .brand-mark { width: 41px; height: 41px; font-size: 21px; }
  .brand strong { font-size: 17px; }.brand small, .mini-stat small { display:none; }
  .mini-stat { padding: 7px 10px; }.icon-button { width: 38px;height:38px; }
  main { padding: 0 16px; }
  .hero { padding-top: 25px; gap: 15px; }
  .hero-art { min-height: 275px; }
  .sun-orbit { width: 215px; height: 215px; }
  .bubble-dog { width:125px;height:125px;font-size:75px;left:27%;top:20%;border-width:5px; }
  .bubble-cat { width:91px;height:91px;font-size:54px;right:5%;border-width:5px; }
  .bubble-bird { width:80px;height:80px;font-size:48px;left:2%;border-width:5px; }
  .bubble-fish { width:90px;height:90px;font-size:53px;right:7%;border-width:5px; }
  h1 { font-size: 49px; letter-spacing: -2px; }
  .hero-copy > p { font-size: 16px; margin: 23px 0; }
  .hero-actions { align-items: stretch; flex-direction: column; gap: 8px; }
  .section-heading { align-items: start; flex-direction: column; }
  .section-heading > p { margin: 0; }
  .category-grid { grid-template-columns: 1fr; }
  .category-card { min-height: 160px; }
  .category-card .card-emoji { font-size: 80px; right: 15px; }
  .game-topline { grid-template-columns: 1fr auto; gap: 10px; }
  .round-progress { grid-column: 1 / -1; grid-row: 2; }
  .score-pill { grid-column: 2; grid-row: 1; }
  .back-button span { display:none; }
  .quiz-card { padding: 17px; }
  .question-heading { text-align:left; }
  .question-heading h2 { font-size:27px; }
  .speak-button span { display:none; }
  .portrait-stage { height: 250px; }
  .answer-list { grid-template-columns: 1fr; }
  .learn-header { grid-template-columns: 35px 1fr; gap: 4px; text-align:left; }
  .learn-header h2 { font-size:29px; }
  .breed-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .breed-card-art { height: 125px; }
  .breed-card-copy { padding: 11px; }
  .breed-card-copy h3 { font-size: 16px; }
  .results-card { padding: 36px 20px; }
  footer { margin: 0 16px; flex-direction:column; gap:6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
