:root { --hud: 64px; --tray: 150px; --ink: #2b2b2b; --paper: #fffaf0; --leaf: #2f6a22; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2f6a22; color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
body { position: fixed; inset: 0; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }
#app { position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }

#hud { height: var(--hud); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: linear-gradient(#3f8a32, #2f6a22); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); z-index: 5; }
.title { font-size: 26px; font-weight: 900; letter-spacing: .5px; text-shadow: 0 2px 0 rgba(0,0,0,.25); white-space: nowrap; }
.pill { background: rgba(255,255,255,.18); padding: 6px 12px; border-radius: 20px; font-weight: 700; font-size: 17px; white-space: nowrap; }
#daybar { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 160px; }
#dayTrack { position: relative; flex: 1; height: 14px; border-radius: 7px; background: linear-gradient(90deg, #8fd3ff 0 45%, #f7a76b 55%, #1d2a5e 66% 100%); border: 2px solid rgba(255,255,255,.7); }
#dayFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(0,0,0,.25); border-radius: 7px; }
#sunmoon { position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%); font-size: 26px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
#dayLabel { font-weight: 800; font-size: 16px; width: 90px; }
.hudbtn { background: #fff; color: var(--leaf); border: none; border-radius: 14px; padding: 9px 14px; font-weight: 800; font-size: 17px; box-shadow: 0 3px 0 rgba(0,0,0,.25); white-space: nowrap; }
.hudbtn.icon { padding: 9px 11px; }
.hudbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }

#yard { flex: 1; position: relative; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; touch-action: pan-x; background: #79bd52; scrollbar-width: thin; }
#scene { display: block; height: 100%; }
.spot { cursor: pointer; }
.spot .hit { fill: transparent; touch-action: none; }
.spot .cover { transition: transform .45s cubic-bezier(.3,1.4,.5,1); transform-box: fill-box; transform-origin: 50% 100%; }
.spot.wiggle .cover { animation: wiggle .5s; }
@keyframes wiggle { 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
.spot .holder { transform-box: fill-box; transform-origin: 50% 50%; }
.spot .holder.pop { animation: pop .5s cubic-bezier(.3,1.6,.5,1); }
.spot .holder.waiting { animation: bob 1.6s ease-in-out infinite; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-6px) rotate(3deg); } }
.sparkle { animation: twinkle 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes twinkle { 0%,100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.15); } }

#tray { height: var(--tray); flex: none; display: flex; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(#8a5a32, #6a4222); box-shadow: 0 -3px 8px rgba(0,0,0,.3); z-index: 5; }
.bin { position: relative; flex: 1; border-radius: 18px; background: var(--paper); border: 4px solid var(--c); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 6px 4px; box-shadow: inset 0 -10px 0 rgba(0,0,0,.06), 0 4px 0 rgba(0,0,0,.25); transition: transform .15s, background .15s; }
.bin .kid { font-size: 21px; font-weight: 900; color: var(--c); line-height: 1.05; }
.bin .sci { font-size: 15px; font-weight: 700; color: #555; margin-top: 3px; }
.bin .rule { font-size: 12.5px; color: #444; margin-top: 6px; background: rgba(0,0,0,.06); border-radius: 10px; padding: 2px 8px; }
.bin .count { position: absolute; top: -10px; right: -8px; background: var(--c); color: #fff; font-weight: 900; border-radius: 14px; min-width: 28px; height: 28px; line-height: 28px; font-size: 16px; display: none; border: 2px solid #fff; }
.bin.hover { transform: scale(1.06); background: #fff6c8; }
.bin.answer { animation: answer 1s ease-in-out infinite; }
@keyframes answer { 50% { box-shadow: 0 0 0 8px #ffe14d, 0 4px 0 rgba(0,0,0,.25); transform: scale(1.04); } }
.bin.bounce { animation: binbounce .5s; }
@keyframes binbounce { 30% { transform: scale(1.12); } 60% { transform: scale(.96); } }

#ghost { position: fixed; width: 130px; height: 130px; pointer-events: none; z-index: 50; transform: translate(-50%, -50%) scale(1.1); filter: drop-shadow(0 8px 6px rgba(0,0,0,.35)); }
#ghost.fly { transition: left .4s ease, top .4s ease, transform .4s ease, opacity .4s ease; }

#toast { position: fixed; left: 50%; bottom: calc(var(--tray) + 16px); transform: translateX(-50%); max-width: 760px; background: var(--paper);
  border: 4px solid #f2b705; border-radius: 20px; padding: 12px 20px; font-size: 20px; font-weight: 700; text-align: center; box-shadow: 0 6px 16px rgba(0,0,0,.3); z-index: 40; pointer-events: none; }
#toast.hint { border-color: #e17055; }
.hidden { display: none !important; }
.bubble { position: fixed; z-index: 30; transform: translate(-50%, -100%); background: #fff; border-radius: 16px; padding: 8px 14px; font-weight: 800; font-size: 17px;
  box-shadow: 0 4px 10px rgba(0,0,0,.3); pointer-events: none; max-width: 280px; text-align: center; animation: pop .3s; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -10px; margin-left: -10px; border: 10px solid transparent; border-bottom: 0; border-top-color: #fff; }

#modal { position: fixed; inset: 0; background: rgba(10,25,10,.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
#modalBox { background: var(--paper); border-radius: 26px; max-width: 1060px; width: 100%; max-height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; box-shadow: 0 10px 40px rgba(0,0,0,.4); animation: pop .3s; }
.bigbtn { background: #2f8a2a; color: #fff; border: none; border-radius: 18px; padding: 14px 28px; font-size: 22px; font-weight: 900; box-shadow: 0 4px 0 #1f5a1a; }
.bigbtn.alt { background: #fff; color: #2f6a22; border: 3px solid #2f8a2a; box-shadow: 0 4px 0 #9ab89a; }
.bigbtn.danger { background: #c0392b; box-shadow: 0 4px 0 #7a2018; }
.bigbtn:active { transform: translateY(3px); box-shadow: none; }

/* fact card */
.card { display: grid; grid-template-columns: 340px 1fr; gap: 0; }
.card .pic { background: #efe6cf; border-radius: 26px 0 0 26px; padding: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 3px dashed #cdbf9a; }
.card .pic svg { width: 290px; height: 290px; background: #fffdf6; border-radius: 16px; border: 2px solid #d8caa6; }
.card .pic .ph { font-size: 13px; color: #7a6a4a; margin-top: 8px; text-align: center; font-style: italic; }
.card .info { padding: 20px 26px; }
.card h2 { margin: 0; font-size: 34px; }
.card .latin { font-style: italic; color: #666; font-size: 18px; margin: 2px 0 8px; }
.card .chip { display: inline-block; border-radius: 14px; padding: 4px 12px; color: #fff; font-weight: 900; font-size: 17px; margin-right: 8px; }
.card .badge { display: inline-block; background: #ffe14d; color: #7a1a10; border: 3px solid #c0392b; border-radius: 14px; padding: 3px 10px; font-weight: 900; font-size: 17px; }
.card dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 14px 0 10px; font-size: 18px; line-height: 1.35; }
.card dt { font-weight: 900; color: #2f6a22; }
.card dd { margin: 0; }
.card .wow { background: #fff3c4; border-radius: 14px; padding: 10px 14px; font-size: 18px; margin: 8px 0; }
.card .tip { border-radius: 14px; padding: 10px 14px; font-size: 18px; margin: 8px 0; background: #e8f4e2; }
.card .tip.dangerTip { background: #ffe1dc; border: 2px solid #c0392b; }
.card .actions { text-align: right; margin-top: 12px; }

/* field guide */
.guide { padding: 20px 24px; }
.guide h2 { margin: 0 0 4px; font-size: 32px; }
.guide h3 { margin: 16px 0 8px; color: #2f6a22; }
.guide .grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tile { background: #fff; border: 3px solid #d8caa6; border-radius: 18px; padding: 8px; text-align: center; font-weight: 800; font-size: 15px; }
.tile svg { width: 100%; height: 110px; }
.tile .q { height: 110px; line-height: 110px; font-size: 64px; font-weight: 900; color: #d8caa6; }
.tile.locked { color: #999; }
.guide .top { display: flex; justify-content: space-between; align-items: center; }

.center { text-align: center; padding: 30px 40px; }
.center h1 { font-size: 46px; margin: 6px 0; color: #2f6a22; }
.center p { font-size: 21px; line-height: 1.4; }
.center .steps { text-align: left; display: inline-block; font-size: 20px; line-height: 1.6; margin: 6px 0 18px; }
.center .row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.center .creatures { display: flex; justify-content: center; gap: 6px; }
.center .creatures svg { width: 90px; height: 90px; }
.small { font-size: 14px !important; color: #666; }
