/* ==========================================
   FLUFFY WANDERER v2 — style.css
   ========================================== */

:root {
  --bg-cream: #fdf6e3;
  --green1:   #8fc98a;
  --green2:   #5aaa55;
  --yellow1:  #f9e07a;
  --yellow2:  #f4c430;
  --text-main:#4a3f35;
  --text-sub: #7a6a5a;
  --shadow:   rgba(0,0,0,0.12);
  --radius:   18px;
  --panel-w:  340px;
  --hdr-h:    52px;
  --gauge-h:  28px;
  --ftr-h:    86px;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg-cream);
  color: var(--text-main);
  -webkit-tap-highlight-color: transparent;
}

/* SCREENS */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s;
}
.screen.active { opacity: 1; pointer-events: all; }

/* TITLE */
#screen-title {
  background: linear-gradient(160deg, #d4f1f9 0%, #e8f5e9 50%, #fff9e6 100%);
  align-items: center; justify-content: center;
  overflow: hidden;
}
.title-bg { position: absolute; inset: 0; pointer-events: none; }
.cloud {
  position: absolute; background: white;
  border-radius: 50px; opacity: 0.75;
  animation: driftCloud linear infinite;
}
.cloud::before, .cloud::after { content: ''; position: absolute; background: white; border-radius: 50%; }
.cloud1 { width:140px; height:40px; top:12%; left:-10%; animation-duration:28s; }
.cloud1::before { width:60px; height:60px; top:-28px; left:20px; }
.cloud1::after  { width:80px; height:50px; top:-20px; left:55px; }
.cloud2 { width:100px; height:30px; top:30%; left:-8%; animation-duration:22s; animation-delay:-10s; }
.cloud2::before { width:45px; height:45px; top:-22px; left:10px; }
.cloud2::after  { width:60px; height:38px; top:-15px; left:38px; }
.cloud3 { width:120px; height:35px; top:60%; left:-10%; animation-duration:35s; animation-delay:-18s; }
.cloud3::before { width:50px; height:50px; top:-25px; left:15px; }
.cloud3::after  { width:70px; height:44px; top:-18px; left:48px; }
@keyframes driftCloud {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(100vw + 200px)); }
}
.title-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  padding: 40px 24px; text-align: center;
}
.title-chick {
  font-size: clamp(80px, 20vw, 130px);
  animation: chickBob 2.2s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.15));
}
@keyframes chickBob {
  0%,100% { transform: translateY(0) rotate(-4deg); }
  50%     { transform: translateY(-16px) rotate(4deg); }
}
.title-name { font-size: clamp(28px, 7vw, 52px); font-weight: 800; color: var(--text-main); text-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.title-sub  { font-size: clamp(13px, 3.5vw, 18px); color: var(--text-sub); margin-top: -8px; }
.title-buttons { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 280px; margin-top: 10px; }
.title-footer  { font-size: 12px; color: var(--text-sub); margin-top: 12px; opacity: .8; }

/* BUTTONS */
.btn {
  display: block; width: 100%; padding: 15px 24px;
  border: none; border-radius: var(--radius);
  font-size: 16px; font-weight: 700; cursor: pointer;
  transition: transform .15s, box-shadow .15s, opacity .2s;
}
.btn:active   { transform: scale(0.96); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary  { background: linear-gradient(135deg,#f9e07a,#f4c430); color: #4a3f35; box-shadow: 0 4px 16px rgba(244,196,48,.45); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(244,196,48,.6); transform: translateY(-2px); }
.btn-secondary { background: white; color: var(--text-main); box-shadow: 0 2px 10px var(--shadow); border: 1.5px solid #e0d8c8; }
.btn-secondary:hover:not(:disabled) { background: #f9f5ec; }
.btn-danger    { background: linear-gradient(135deg,#ff8a80,#e53935); color: white; box-shadow: 0 4px 16px rgba(229,57,53,.35); }
.icon-btn {
  background: none; border: none; font-size: 18px; cursor: pointer;
  padding: 5px 6px; border-radius: 10px;
  transition: background .15s, transform .1s; line-height: 1;
}
.icon-btn:active { transform: scale(.88); }
.icon-btn:hover  { background: rgba(0,0,0,.07); }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: white; border-radius: var(--radius); padding: 28px 24px;
  max-width: 320px; width: 90%; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
  animation: popIn .2s ease-out;
}
@keyframes popIn { from{transform:scale(.85);opacity:0} to{transform:scale(1);opacity:1} }
.modal-box p { line-height: 1.6; color: var(--text-sub); margin-bottom: 20px; }
.modal-buttons { display: flex; gap: 10px; }
.modal-buttons .btn { flex: 1; padding: 12px; }

/* GAME HEADER */
.game-header {
  height: var(--hdr-h); display: flex; align-items: center;
  padding: 0 10px;
  background: rgba(255,255,255,.88); backdrop-filter: blur(10px);
  box-shadow: 0 1px 8px var(--shadow);
  position: relative; z-index: 10; flex-shrink: 0;
}
.header-left   { flex: 1; }
.header-center { flex: 0 0 auto; }
.header-right  { flex: 1; display: flex; justify-content: flex-end; gap: 0; }
.location-label { font-size: 14px; font-weight: 700; }
.time-display   { font-size: 12px; font-weight: 600; color: var(--text-sub); font-variant-numeric: tabular-nums; letter-spacing: 1px; }

/* EVOLVE GAUGE */
.evolve-bar-wrap {
  height: var(--gauge-h);
  background: rgba(255,255,255,.75); backdrop-filter: blur(6px);
  border-bottom: 1px solid #e8e0cc;
  flex-shrink: 0; z-index: 9; display: flex; align-items: center;
}
.evolve-bar-inner { width: 100%; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.evolve-label { font-size: 11px; font-weight: 700; color: var(--text-sub); white-space: nowrap; }
.evolve-track { flex: 1; height: 8px; background: #e8e0cc; border-radius: 99px; overflow: hidden; }
.evolve-fill  { height: 100%; width: 0%; background: linear-gradient(90deg,#f9e07a,#f4c430,#ffb300); border-radius: 99px; transition: width .6s ease; }
.evolve-time  { font-size: 11px; font-weight: 700; color: var(--text-main); white-space: nowrap; min-width: 34px; text-align: right; }

/* GAME SCENE */
.game-scene { flex: 1; position: relative; overflow: hidden; }
.scene-bg, .scene-middle { position: absolute; inset: 0; transition: background .8s; }

.scene-bg[data-loc="field"]  { background: linear-gradient(180deg,#c8eaf8 0%,#d4f1c8 55%,#a8d88a 100%); }
.scene-bg[data-loc="lake"]   { background: linear-gradient(180deg,#b3ddf2 0%,#89c4e1 45%,#5b9fc4 100%); }
.scene-bg[data-loc="forest"] { background: linear-gradient(180deg,#b8d4a8 0%,#7caa60 50%,#4a8040 100%); }
.scene-bg[data-loc="sunset"] { background: linear-gradient(180deg,#ffd08a 0%,#f4976c 40%,#c0494a 100%); }
.scene-bg[data-loc="night"]  { background: linear-gradient(180deg,#1a1a3e 0%,#2d2d5e 45%,#1a3a2a 100%); }

.scene-middle[data-loc="field"]  { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='60'%3E%3Cpath d='M0 40 Q10 30 20 40 Q30 50 40 40 Q50 30 60 40 Q70 50 80 40 Q90 30 100 40 L100 60 L0 60Z' fill='%238fc98a'/%3E%3C/svg%3E") repeat-x bottom/100px 60px; }
.scene-middle[data-loc="lake"]   { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='40'%3E%3Cellipse cx='50' cy='42' rx='60' ry='20' fill='%2378b8d4' opacity='.5'/%3E%3C/svg%3E") repeat-x bottom/120px 40px; }
.scene-middle[data-loc="forest"] { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='80'%3E%3Cpolygon points='30,0 55,60 5,60' fill='%234a8040'/%3E%3Crect x='25' y='60' width='10' height='20' fill='%23654321'/%3E%3C/svg%3E") repeat-x bottom/60px 80px; }
.scene-middle[data-loc="sunset"] { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='50'%3E%3Cpath d='M0 35 Q20 20 40 35 Q60 50 80 35 L80 50 L0 50Z' fill='%234a3000'/%3E%3C/svg%3E") repeat-x bottom/80px 50px; }
.scene-middle[data-loc="night"]  { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='50'%3E%3Cpath d='M0 35 Q20 20 40 35 Q60 50 80 35 L80 50 L0 50Z' fill='%23112211'/%3E%3C/svg%3E") repeat-x bottom/80px 50px; }

/* DEPTH STAGE */
.depth-stage { position: absolute; inset: 0; pointer-events: none; }
.chick-entity {
  position: absolute;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: all; cursor: pointer; user-select: none;
}
.chick-entity .chick-emoji { font-size: 1em; filter: drop-shadow(0 3px 6px rgba(0,0,0,.18)); line-height: 1; }
.chick-entity .chick-shadow-e { width: 1.2em; height: .35em; background: radial-gradient(ellipse,rgba(0,0,0,.22) 0%,transparent 70%); border-radius: 50%; margin-top: -.1em; }
.chick-entity.move-wander  .chick-emoji { animation: walkBob  .55s ease-in-out infinite alternate; }
.chick-entity.move-patrol  .chick-emoji { animation: marchBob .35s ease-in-out infinite alternate; }
.chick-entity.move-drift   .chick-emoji { animation: driftBob 1.2s ease-in-out infinite alternate; }
.chick-entity.move-circle  .chick-emoji { animation: spinBob  .5s ease-in-out infinite alternate; }
.chick-entity.move-figure8 .chick-emoji { animation: danceBob .4s ease-in-out infinite alternate; }
@keyframes walkBob  { from{transform:rotate(-5deg) translateY(0)}   to{transform:rotate(5deg) translateY(-4px)} }
@keyframes marchBob { from{transform:rotate(-8deg) translateY(0)}   to{transform:rotate(8deg) translateY(-6px)} }
@keyframes driftBob { from{transform:rotate(-2deg) translateY(0)}   to{transform:rotate(2deg) translateY(-3px)} }
@keyframes spinBob  { from{transform:rotate(-10deg) translateY(0)}  to{transform:rotate(10deg) translateY(-5px)} }
@keyframes danceBob { from{transform:rotate(-12deg) translateY(-2px)} to{transform:rotate(12deg) translateY(-8px)} }

/* SCENE ITEMS */
.scene-items { position: absolute; inset: 0; pointer-events: none; }
.scene-item {
  position: absolute; font-size: clamp(18px,5vw,30px);
  animation: floatItem 3s ease-in-out infinite;
  animation-delay: var(--delay,0s);
  cursor: pointer; pointer-events: all; user-select: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.15));
  transition: transform .2s;
}
.scene-item:active { transform: scale(1.4) !important; }
@keyframes floatItem { 0%,100%{transform:translateY(0) rotate(-3deg)} 50%{transform:translateY(-8px) rotate(3deg)} }

/* PARTICLES */
.particles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.particle {
  position: absolute; font-size: 14px;
  animation: particleFly var(--dur,4s) ease-in-out var(--delay2,0s) infinite;
  opacity: .7;
}
@keyframes particleFly {
  0%  { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
  20% { opacity: .8; }
  80% { opacity: .4; }
  100%{ transform: translateY(-70px) translateX(var(--dx,20px)) scale(.5); opacity: 0; }
}

/* GAME FOOTER */
.game-footer {
  height: var(--ftr-h); background: rgba(255,255,255,.9); backdrop-filter: blur(10px);
  box-shadow: 0 -1px 8px var(--shadow);
  display: flex; flex-direction: column;
  padding: 5px 10px 7px; gap: 5px;
  flex-shrink: 0; position: relative; z-index: 10;
}
.footer-row { display: flex; align-items: center; }
.location-tabs {
  display: flex; gap: 6px; overflow-x: auto; flex: 1;
  scrollbar-width: none; -ms-overflow-style: none; padding-bottom: 2px;
}
.location-tabs::-webkit-scrollbar { display: none; }
.loc-tab {
  flex-shrink: 0; padding: 6px 12px;
  border: 2px solid transparent; border-radius: 50px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: #f0ebe0; color: var(--text-sub);
  transition: all .2s; white-space: nowrap;
}
.loc-tab.active { background: var(--yellow1); border-color: var(--yellow2); color: var(--text-main); }
.loc-tab.locked { opacity: .35; cursor: not-allowed; filter: grayscale(.7); }
.loc-tab:not(.locked):hover { background: #e8e0c8; }
.footer-status { justify-content: space-between; }
.stat-pill { font-size: 12px; font-weight: 700; color: var(--text-sub); display: flex; align-items: center; gap: 3px; }
.stat-pill span { color: var(--text-main); }

/* PANELS */
.panel-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.22); backdrop-filter: blur(2px); }
.panel-backdrop.hidden { display: none; }
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(var(--panel-w), 92vw);
  background: var(--bg-cream); z-index: 60;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px var(--shadow);
  transform: translateX(0);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.side-panel.hidden { transform: translateX(110%); pointer-events: none; }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; font-size: 15px; font-weight: 700;
  border-bottom: 1px solid #e8e0cc; background: white; flex-shrink: 0;
}
.close-btn { background: none; border: none; font-size: 17px; cursor: pointer; color: var(--text-sub); padding: 4px 8px; border-radius: 8px; transition: background .15s; }
.close-btn:hover { background: #f0ebe0; }
.panel-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

/* SHOP */
.shop-section-title { font-size: 12px; font-weight: 800; color: var(--text-sub); text-transform: uppercase; letter-spacing: .8px; margin-top: 4px; }
.shop-item { background: white; border-radius: 14px; padding: 14px; box-shadow: 0 2px 8px var(--shadow); display: flex; align-items: center; gap: 12px; }
.shop-item-icon { font-size: 30px; flex-shrink: 0; }
.shop-item-info { flex: 1; }
.shop-item-name   { font-size: 14px; font-weight: 700; color: var(--text-main); }
.shop-item-desc   { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.shop-item-effect { font-size: 10px; color: var(--green2); font-weight: 700; margin-top: 2px; }
.shop-buy-btn {
  background: linear-gradient(135deg,#f9e07a,#f4c430);
  border: none; border-radius: 10px; padding: 8px 14px;
  font-size: 12px; font-weight: 800; cursor: pointer;
  color: var(--text-main); white-space: nowrap;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(244,196,48,.4);
}
.shop-buy-btn:hover    { transform: scale(1.04); box-shadow: 0 4px 12px rgba(244,196,48,.6); }
.shop-buy-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ANIMALS PANEL */
.chick-card { background: white; border-radius: 14px; padding: 14px; box-shadow: 0 2px 8px var(--shadow); display: flex; align-items: center; gap: 12px; cursor: pointer; transition: background .15s; }
.chick-card:hover { background: #fdf0c8; }
.chick-card.in-scene { background: #f0fce8; border: 1.5px solid #8fc98a; }
.chick-card-icon  { font-size: 32px; flex-shrink: 0; }
.chick-card-info  { flex: 1; min-width: 0; }
.chick-card-name  { font-size: 13px; font-weight: 700; }
.chick-card-trait { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.scene-toggle-btn { font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 20px; background: var(--yellow1); color: var(--text-main); flex-shrink: 0; }
.chick-card.in-scene .scene-toggle-btn { background: #d4edda; color: #2a7a3a; }
.chick-card-locked { background: #f5f0e8; border-radius: 14px; padding: 14px; box-shadow: 0 1px 4px var(--shadow); display: flex; align-items: center; gap: 12px; opacity: .55; }
.chick-lock-icon   { font-size: 28px; filter: grayscale(1); }
.chick-lock-info   { flex: 1; }
.chick-lock-name   { font-size: 13px; font-weight: 700; color: var(--text-sub); }
.chick-lock-hint   { font-size: 10px; color: var(--text-sub); margin-top: 2px; }

/* BGM SELECTOR */
.bgm-selector { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.bgm-btn { background: white; border: 1.5px solid #e0d8c8; border-radius: 10px; padding: 9px 14px; font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; color: var(--text-sub); transition: all .15s; }
.bgm-btn:hover { background: #fdf5e0; border-color: var(--yellow2); }
.bgm-btn.active { background: var(--yellow1); border-color: var(--yellow2); color: var(--text-main); font-weight: 800; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card  { background: white; border-radius: 14px; padding: 14px; box-shadow: 0 2px 8px var(--shadow); }
.stat-card h3 { font-size: 11px; color: var(--text-sub); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 24px; font-weight: 800; color: var(--text-main); }

/* COLLECT */
.collect-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.collect-item { background: white; border-radius: 14px; padding: 12px 6px; text-align: center; box-shadow: 0 2px 8px var(--shadow); font-size: 26px; position: relative; transition: transform .15s; }
.collect-item:active { transform: scale(.93); }
.collect-item.locked { filter: grayscale(1); opacity: .4; }
.collect-item .collect-label { font-size: 9px; color: var(--text-sub); margin-top: 5px; font-weight: 700; display: block; }
.collect-item .collect-count { position: absolute; top: 5px; right: 6px; font-size: 9px; font-weight: 800; color: var(--green2); background: #e8f8e0; padding: 1px 4px; border-radius: 20px; }

/* MENU */
.menu-item { display: block; width: 100%; padding: 14px 18px; background: white; border: none; border-radius: 14px; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; color: var(--text-main); box-shadow: 0 2px 8px var(--shadow); transition: background .15s, transform .1s; }
.menu-item:hover  { background: #f9f5ec; }
.menu-item:active { transform: scale(.97); }
.menu-item.danger { color: #c62828; }
.menu-item.danger:hover { background: #ffebee; }

/* TOAST */
.toast {
  position: fixed; bottom: calc(var(--ftr-h) + 10px); left: 50%;
  transform: translateX(-50%);
  background: rgba(60,50,40,.88); color: white;
  font-size: 13px; font-weight: 700;
  padding: 9px 20px; border-radius: 50px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  z-index: 300; pointer-events: none; white-space: nowrap;
  transition: opacity .4s, transform .4s;
}
.toast.hidden { opacity: 0; transform: translateX(-50%) translateY(12px); }
.toast.show   { opacity: 1; transform: translateX(-50%) translateY(0); }

/* COIN POP */
@keyframes coinPop { 0%{transform:translateY(0) scale(1);opacity:1} 100%{transform:translateY(-60px) scale(.4);opacity:0} }
.coin-pop { position: absolute; font-size: 18px; pointer-events: none; animation: coinPop .8s ease-out forwards; z-index: 100; font-weight: 800; color: #f4c430; text-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* PULSE */
@keyframes pulseRing { 0%{box-shadow:0 0 0 0 rgba(244,196,48,.7)} 70%{box-shadow:0 0 0 14px rgba(244,196,48,0)} 100%{box-shadow:0 0 0 0 rgba(244,196,48,0)} }
.pulse { animation: pulseRing 1.2s ease-out 2; }

/* GLOBAL HIDDEN */
.hidden { display: none !important; }

/* RESPONSIVE */
@media (max-width: 380px) {
  :root { --ftr-h: 80px; --gauge-h: 24px; }
  .icon-btn { font-size: 16px; padding: 4px 5px; }
  .loc-tab  { padding: 5px 9px; font-size: 11px; }
}
@media (min-width: 768px) {
  :root { --panel-w: 380px; }
  .title-buttons { flex-direction: row; max-width: 360px; }
}
@media (min-width: 1024px) {
  :root { --hdr-h: 56px; }
  .game-scene { cursor: pointer; }
}
