* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green-deep: #1a3d2b;
  --green-mid: #2d6a4f;
  --green-light: #52b788;
  --green-pale: #95d5b2;
  --bamboo: #8fbc5a;
  --bamboo-dark: #5a7a35;
  --earth: #8b6a3e;
  --earth-light: #c9a96e;
  --paper: #f5f0e8;
  --panda-white: #f0ede8;
  --panda-black: #1a1a1a;
  --lantern-glow: rgba(255, 200, 80, 0.6);
}

html, body { width: 100%; height: 100%; overflow: hidden; font-family: 'Nunito', sans-serif; }

#scene { position: fixed; inset: 0; overflow: hidden; }

#sky {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #050d09 0%, #0d2418 30%, #1a3d2b 60%, #2d6a4f 85%, #3a7a5a 100%);
}

#stars { position: absolute; inset: 0; pointer-events: none; }

.parallax-layer { position: absolute; bottom: 0; will-change: transform; pointer-events: none; }

#world { position: absolute; bottom: 0; left: 0; width: 3200px; height: 30vh; will-change: transform; }

#ground {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(180deg, #4a7c59 0%, #3d6b4a 20%, #2d5239 50%, #1e3828 100%);
}
#ground::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 10px;
  background: repeating-linear-gradient(90deg, #5d9c6e 0px, #5d9c6e 12px, #4a7c59 12px, #4a7c59 30px, #6aad7a 30px, #6aad7a 42px, #4a7c59 42px, #4a7c59 60px);
  opacity: 0.6;
}

/* ── STATIONS ─────────────────────────────────────────────────── */
.station { position: absolute; bottom: 100%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.station-wrapper { position: relative; display: flex; flex-direction: column; align-items: center; }

.lantern {
  width: 14px; height: 20px;
  background: radial-gradient(ellipse, #ffe066 30%, #ffab00 70%, #cc7700 100%);
  border-radius: 50% 50% 45% 45%; border: 1px solid #996600;
  opacity: 0.35; transition: opacity 0.4s, box-shadow 0.4s;
  margin-bottom: 4px; box-shadow: 0 0 6px 2px rgba(255,180,50,0.2);
}
.lantern::after { content: ''; display: block; width: 1px; height: 6px; background: #996600; margin: 0 auto; }

.station-hint {
  position: absolute; top: -34px; left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(10,25,15,0.92); color: var(--green-pale);
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 10px;
  border: 1px solid var(--green-light); white-space: nowrap;
  opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
.station.near .lantern { opacity: 1; box-shadow: 0 0 18px 7px var(--lantern-glow), 0 0 35px 14px rgba(255,180,50,0.25); }
.station.near .station-hint { opacity: 1; transform: translateX(-50%) translateY(0); }

.station-poles { display: flex; gap: 18px; align-items: flex-end; position: relative; }
.station-pole {
  width: 11px; height: 75px;
  background: linear-gradient(90deg, var(--bamboo-dark) 0%, var(--bamboo) 45%, var(--bamboo-dark) 100%);
  border-radius: 5px; position: relative;
}
.station-pole::before, .station-pole::after { content: ''; position: absolute; left: 0; right: 0; height: 3px; background: var(--bamboo-dark); border-radius: 2px; }
.station-pole::before { top: 22%; }
.station-pole::after  { top: 55%; }

.station-board {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%); z-index: 1;
  background: linear-gradient(135deg, #c9a96e 0%, #b8935a 50%, #a07840 100%);
  border: 2px solid #7a5a2a; border-radius: 4px; padding: 7px 14px;
  min-width: 85px; text-align: center; font-weight: 800; font-size: 12px; color: #3a2000;
  text-shadow: 0 1px 0 rgba(255,255,255,0.25);
  box-shadow: inset 0 2px 3px rgba(255,255,255,0.15), inset 0 -2px 3px rgba(0,0,0,0.25), 2px 2px 0 rgba(0,0,0,0.3);
  white-space: nowrap;
}

/* ── PANDA ────────────────────────────────────────────────────── */
#panda { position: fixed; bottom: 30vh; transform: translateX(-50%); width: 60px; height: 82px; z-index: 10; transition: left 0s; }
#panda.facing-left { transform: translateX(-50%) scaleX(-1); }
#panda.walking  { animation: panda-bob 0.3s ease-in-out infinite; }
#panda.crouching { transform: translateX(-50%) scaleY(0.65); transform-origin: bottom center; }
#panda.facing-left.crouching { transform: translateX(-50%) scaleX(-1) scaleY(0.65); transform-origin: bottom center; }
@keyframes panda-bob { 0%, 100% { bottom: 30vh; } 50% { bottom: calc(30vh + 5px); } }

.panda-body {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 48px; height: 50px; background: var(--panda-white);
  border-radius: 50% 50% 44% 44%;
  box-shadow: inset -4px -5px 0 rgba(0,0,0,0.05), 0 3px 8px rgba(0,0,0,0.28);
}
.panda-arm { position: absolute; width: 15px; height: 26px; background: var(--panda-black); border-radius: 7px 7px 9px 9px; bottom: 16px; transform-origin: top center; }
.panda-arm.left  { left: -7px;  transform: rotate(-8deg); }
.panda-arm.right { right: -7px; transform: rotate(8deg); }
#panda.walking .panda-arm.left  { animation: arm-l 0.3s infinite; }
#panda.walking .panda-arm.right { animation: arm-r 0.3s infinite; }
@keyframes arm-l { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(18deg); } }
@keyframes arm-r { 0%,100% { transform: rotate(12deg); } 50% { transform: rotate(-18deg); } }

.panda-leg { position: absolute; width: 14px; height: 18px; background: var(--panda-black); border-radius: 0 0 7px 7px; bottom: -9px; transform-origin: top center; }
.panda-leg.left  { left: 9px; }
.panda-leg.right { right: 9px; }
#panda.walking .panda-leg.left  { animation: leg-l 0.3s infinite; }
#panda.walking .panda-leg.right { animation: leg-r 0.3s infinite; }
@keyframes leg-l { 0%,100% { transform: rotate(-18deg); } 50% { transform: rotate(18deg); } }
@keyframes leg-r { 0%,100% { transform: rotate(18deg); } 50% { transform: rotate(-18deg); } }

.panda-tail { position: absolute; width: 12px; height: 11px; background: var(--panda-white); border-radius: 50%; bottom: 12px; right: -7px; box-shadow: inset -2px -2px 0 rgba(0,0,0,0.08); }
.panda-head { position: absolute; bottom: 38px; left: 50%; transform: translateX(-50%); width: 44px; height: 42px; background: var(--panda-white); border-radius: 50% 50% 47% 47%; box-shadow: inset -3px -4px 0 rgba(0,0,0,0.04), 0 2px 6px rgba(0,0,0,0.2); z-index: 2; }
.panda-ear { position: absolute; width: 15px; height: 15px; background: var(--panda-black); border-radius: 50%; top: -7px; }
.panda-ear.left  { left: 3px; }
.panda-ear.right { right: 3px; }
.panda-eye-patch { position: absolute; width: 15px; height: 13px; background: var(--panda-black); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; top: 13px; }
.panda-eye-patch.left  { left: 3px;  transform: rotate(-8deg); }
.panda-eye-patch.right { right: 3px; transform: rotate(8deg); }
.panda-eye { position: absolute; width: 7px; height: 8px; background: white; border-radius: 50%; top: 3px; left: 50%; transform: translateX(-50%); }
.panda-eye::after { content: ''; position: absolute; width: 4px; height: 5px; background: #111; border-radius: 50%; top: 2px; left: 50%; transform: translateX(-50%); }
.panda-eye::before { content: ''; position: absolute; width: 2px; height: 2px; background: white; border-radius: 50%; top: 2px; left: 4px; z-index: 1; }
.panda-nose { position: absolute; width: 8px; height: 5px; background: var(--panda-black); border-radius: 50%; bottom: 11px; left: 50%; transform: translateX(-50%); }
.panda-cheek { position: absolute; width: 9px; height: 5px; background: rgba(255,150,140,0.38); border-radius: 50%; bottom: 13px; }
.panda-cheek.left  { left: 3px; }
.panda-cheek.right { right: 3px; }

/* ── FALLING LEAVES ───────────────────────────────────────────── */
.leaf { position: fixed; pointer-events: none; z-index: 3; opacity: 0; animation: leaf-fall linear infinite; }
.leaf-shape { width: 11px; height: 5px; background: #4a9a5c; border-radius: 50% 0 50% 0; transform: rotate(45deg); }
.leaf-shape.light { background: #68bf7c; }
.leaf-shape.dark  { background: #2d6a3f; }
@keyframes leaf-fall { 0% { transform: translateY(-20px) translateX(0) rotate(0deg); opacity: 0; } 8% { opacity: 0.7; } 92% { opacity: 0.4; } 100% { transform: translateY(102vh) translateX(50px) rotate(400deg); opacity: 0; } }

/* ── MODAL ────────────────────────────────────────────────────── */
#modal-overlay { position: fixed; inset: 0; background: rgba(5,15,10,0.82); backdrop-filter: blur(5px); z-index: 100; display: flex; align-items: flex-end; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
#modal-overlay.open { opacity: 1; pointer-events: all; }
#modal { background: var(--paper); width: min(700px, 96vw); max-height: 82vh; border-radius: 18px 18px 0 0; border: 2px solid var(--bamboo); border-bottom: none; overflow-y: auto; transform: translateY(100%); transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1); position: relative; padding: 32px 32px 44px; scrollbar-width: thin; scrollbar-color: var(--green-mid) transparent; }
#modal::-webkit-scrollbar { width: 5px; }
#modal::-webkit-scrollbar-thumb { background: var(--green-mid); border-radius: 3px; }
#modal-overlay.open #modal { transform: translateY(0); }
#modal::before { content: ''; display: block; width: 40px; height: 4px; background: #c8c0b0; border-radius: 2px; margin: -16px auto 24px; }
#modal-close { position: sticky; top: 0; float: right; width: 32px; height: 32px; background: var(--green-deep); color: var(--green-pale); border: none; border-radius: 50%; cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center; transition: background 0.2s, transform 0.25s; z-index: 5; margin-left: 8px; }
#modal-close:hover { background: var(--green-mid); transform: rotate(90deg); }
#modal-title { font-weight: 900; font-size: 26px; color: var(--green-deep); margin-bottom: 18px; display: flex; align-items: center; gap: 10px; clear: both; }
#modal-title::before { content: ''; display: block; width: 5px; height: 30px; background: var(--bamboo); border-radius: 3px; flex-shrink: 0; }
#modal-body { color: #2e2e2e; line-height: 1.75; font-size: 15px; }
.skill-pill { display: inline-block; background: var(--green-deep); color: var(--green-pale); padding: 5px 15px; border-radius: 20px; font-size: 13px; font-weight: 700; margin: 3px; border: 1px solid var(--green-mid); }
.skills-grid { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; margin-top: 14px; }
.project-card { background: white; border: 2px solid #e0d8c8; border-radius: 10px; padding: 18px; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.project-card:hover { border-color: var(--bamboo); transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,0.08); }
.project-card-icon { font-size: 26px; margin-bottom: 8px; }
.project-card h3 { font-size: 14px; font-weight: 800; color: var(--green-deep); margin-bottom: 5px; }
.project-card p  { font-size: 13px; color: #777; line-height: 1.5; }
.contact-link { display: flex; align-items: center; gap: 12px; padding: 13px 18px; background: white; border: 2px solid #e0d8c8; border-radius: 10px; margin-bottom: 10px; text-decoration: none; color: var(--green-deep); font-weight: 700; font-size: 15px; transition: border-color 0.2s, transform 0.2s; }
.contact-link:hover { border-color: var(--bamboo); transform: translateX(5px); }
.contact-icon { font-size: 22px; width: 34px; text-align: center; }

/* ── WORLD SWITCH BUTTON ──────────────────────────────────────── */
#world-switch {
  position: fixed;
  top: 14px;
  right: 16px;
  background: rgba(10, 25, 15, 0.88);
  color: var(--bamboo);
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--bamboo-dark);
  backdrop-filter: blur(4px);
  text-decoration: none;
  z-index: 20;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
#world-switch:hover {
  background: rgba(30, 60, 35, 0.95);
  border-color: var(--bamboo);
  color: var(--green-pale);
}

/* ── HINT BAR ─────────────────────────────────────────────────── */
#hint-bar { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(10,25,15,0.88); color: var(--green-pale); font-size: 12px; font-weight: 600; padding: 7px 18px; border-radius: 20px; border: 1px solid rgba(100,180,120,0.3); backdrop-filter: blur(4px); pointer-events: none; z-index: 20; white-space: nowrap; }

/* ── MOBILE CONTROLS ──────────────────────────────────────────── */
#mobile-controls { position: fixed; bottom: 0; left: 0; right: 0; display: none; z-index: 50; padding: 10px 16px 18px; pointer-events: none; }
#mobile-controls button { pointer-events: all; width: 54px; height: 54px; background: rgba(20,50,30,0.88); border: 2px solid var(--green-light); border-radius: 12px; color: var(--green-pale); font-size: 22px; cursor: pointer; backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; transition: background 0.12s, transform 0.08s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; }
#mobile-controls button:active { background: rgba(50,100,65,0.95); transform: scale(0.92); }
#controls-row { display: flex; justify-content: center; gap: 10px; align-items: flex-end; }
#btn-jump     { border-color: var(--green-light) !important; }
#btn-interact { border-color: var(--bamboo) !important; }
@media (max-width: 768px), (pointer: coarse) { #mobile-controls { display: block; } #hint-bar { font-size: 11px; padding: 6px 14px; } }

/* ── INTRO ────────────────────────────────────────────────────── */
#intro { position: fixed; inset: 0; background: #0d2418; z-index: 200; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; transition: opacity 0.7s; }
#intro.fade-out { opacity: 0; pointer-events: none; }
.intro-panda { font-size: 62px; animation: intro-bounce 1.1s ease-in-out infinite; }
.intro-title  { font-weight: 900; font-size: 30px; color: var(--green-pale); }
.intro-sub    { font-size: 14px; color: var(--bamboo); text-align: center; padding: 0 20px; }
.intro-hint   { font-size: 12px; color: #4a8a5e; margin-top: 4px; }
.switch-3d    { font-size: 12px; color: #3a7a55; margin-top: 8px; text-decoration: none; border-bottom: 1px solid #3a7a55; padding-bottom: 1px; transition: color 0.2s; }
.switch-3d:hover { color: var(--green-pale); border-color: var(--green-pale); }
@keyframes intro-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
