/* ═══════════════════════════════════════════════════════
   ANIME FARM MEADOW (NÔNG TRẠI ANIME MÙA ĐÔNG) CSS
   Ultra-smooth 60fps, responsive, mobile-first design
   ═══════════════════════════════════════════════════════ */

:root {
  --farm-bg-night: linear-gradient(180deg, #090d16 0%, #17153b 35%, #2e1065 65%, #064e3b 100%);
  --farm-bg-day: linear-gradient(180deg, #38bdf8 0%, #7dd3fc 35%, #bae6fd 60%, #10b981 100%);
  --bubble-bg: rgba(15, 23, 42, 0.88);
  --bubble-border: rgba(244, 114, 182, 0.35);
}

/* Farm Page Wrapper */
.anime-farm-page-wrap {
  width: 100%;
  padding-bottom: 24px;
}

/* Farm Hero Header */
.anime-farm-hero {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.18), rgba(168, 85, 247, 0.12));
  border: 1px solid rgba(244, 114, 182, 0.28);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.12);
}
.farm-hero-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
  flex-shrink: 0;
}
.farm-hero-info { flex: 1; min-width: 0; }
.farm-hero-title {
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(135deg, #fbcfe8, #f472b6, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.farm-hero-desc {
  font-size: 11px;
  color: #cbd5e1;
  margin-top: 2px;
  line-height: 1.35;
}

/* Farm Stage Container */
.anime-farm-stage {
  position: relative;
  width: 100%;
  height: 470px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--farm-bg-night);
  border: 1px solid rgba(244, 114, 182, 0.3);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), inset 0 0 40px rgba(236, 72, 153, 0.08);
  transition: background 0.8s ease, border-color 0.8s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}
.anime-farm-stage.day-mode {
  background: var(--farm-bg-day);
  border-color: rgba(56, 189, 248, 0.45);
}

/* Ambient Canvas */
.farm-canvas-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Scenery Layer */
.farm-scenery {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Sun / Moon */
.farm-celestial {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fef08a;
  box-shadow: 0 0 24px rgba(254, 240, 138, 0.8), 0 0 50px rgba(254, 240, 138, 0.3);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.day-mode .farm-celestial {
  background: #f59e0b;
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.9), 0 0 70px rgba(251, 191, 36, 0.5);
  transform: translateY(8px);
}

/* Rolling Hills */
.farm-hill-back {
  position: absolute;
  bottom: 180px;
  left: -10%;
  width: 120%;
  height: 140px;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, #1e3a29 0%, #064e3b 100%);
  opacity: 0.85;
  transition: background 0.8s ease;
}
.day-mode .farm-hill-back {
  background: linear-gradient(180deg, #34d399 0%, #059669 100%);
  opacity: 0.95;
}
.farm-hill-mid {
  position: absolute;
  bottom: 110px;
  right: -15%;
  width: 130%;
  height: 180px;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, #065f46 0%, #064e3b 100%);
  transition: background 0.8s ease;
}
.day-mode .farm-hill-mid {
  background: linear-gradient(180deg, #10b981 0%, #047857 100%);
}
.farm-hill-front {
  position: absolute;
  bottom: 0;
  left: -5%;
  width: 110%;
  height: 250px;
  border-radius: 40% 40% 0 0;
  background: linear-gradient(180deg, #047857 0%, #064e3b 50%, #022c22 100%);
  box-shadow: inset 0 4px 18px rgba(52, 211, 153, 0.3);
  transition: background 0.8s ease;
}
.day-mode .farm-hill-front {
  background: linear-gradient(180deg, #059669 0%, #047857 60%, #064e3b 100%);
  box-shadow: inset 0 4px 18px rgba(110, 231, 183, 0.5);
}

/* Windmill */
.farm-windmill {
  position: absolute;
  bottom: 240px;
  left: 28px;
  width: 32px;
  height: 52px;
  opacity: 0.88;
}
.windmill-roof {
  width: 0; height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 20px solid #831843;
}
.windmill-body {
  width: 24px;
  height: 32px;
  margin: 0 auto;
  background: #f1f5f9;
  border-radius: 2px;
  position: relative;
}
.windmill-door {
  position: absolute;
  bottom: 0;
  left: 7px;
  width: 10px;
  height: 12px;
  background: #334155;
  border-radius: 5px 5px 0 0;
}
.windmill-blades {
  position: absolute;
  top: 10px;
  left: 16px;
  width: 0;
  height: 0;
  animation: spinWindmillBlades 10s linear infinite;
}
@keyframes spinWindmillBlades {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.windmill-blade {
  position: absolute;
  top: -26px;
  left: -3px;
  width: 6px;
  height: 52px;
  background: rgba(254, 240, 138, 0.85);
  border-radius: 3px;
}
.windmill-blade:nth-child(2) {
  transform: rotate(90deg);
}

/* Fence */
.farm-fence {
  position: absolute;
  bottom: 230px;
  left: 90px;
  right: 20px;
  height: 16px;
  border-bottom: 2px solid rgba(251, 191, 36, 0.5);
  background: repeating-linear-gradient(90deg, transparent, transparent 18px, rgba(251, 191, 36, 0.6) 18px, rgba(251, 191, 36, 0.6) 21px);
  opacity: 0.65;
}

/* Top HUD Controls */
.farm-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  pointer-events: auto;
}
.farm-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(244, 114, 182, 0.3);
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  color: #fbcfe8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: liveDotPulse 1.8s infinite;
}
@keyframes liveDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}
.farm-hud-actions {
  display: flex;
  gap: 6px;
}
.farm-hud-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, background 0.2s ease;
}
.farm-hud-btn:active { transform: scale(0.9); }

/* Actors Layer */
.farm-actors-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: auto;
}

/* Individual Character Actor */
.farm-actor {
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 72px;
  transform-origin: bottom center;
  cursor: pointer;
  touch-action: manipulation;
  will-change: transform;
}
.farm-actor-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.actor-sprite-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: bottom center;
}

/* Floating Speech Bubble */
.actor-bubble {
  position: absolute;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bubble-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--bubble-border);
  border-radius: 12px;
  padding: 4px 8px;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  text-align: center;
  animation: floatActorBubble 2.4s ease-in-out infinite alternate;
  transition: border-color 0.3s ease;
  z-index: 200;
}
.actor-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px 5px 0 5px;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.9) transparent transparent transparent;
}
.bubble-buyer {
  font-size: 10px;
  font-weight: 700;
  color: #fbcfe8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1.2;
}
.bubble-item {
  font-size: 9.5px;
  font-weight: 600;
  color: #38bdf8;
  line-height: 1.2;
  margin-top: 1px;
  letter-spacing: -0.1px;
}
@keyframes floatActorBubble {
  0% { transform: translateX(-50%) translateY(0); }
  100% { transform: translateX(-50%) translateY(-3.5px); }
}

/* Animations: Walk & Idle */
.farm-actor.is-walking .chibi-svg {
  animation: farmWalkWaddle 0.42s ease-in-out infinite alternate;
}
.farm-actor.is-idle .chibi-svg {
  animation: farmIdleBob 2.2s ease-in-out infinite alternate;
}
.farm-actor.is-jumping .chibi-svg {
  animation: farmJumpExcited 0.65s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1;
}
@keyframes farmWalkWaddle {
  0% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-3px) rotate(0deg); }
  100% { transform: translateY(0) rotate(3deg); }
}
@keyframes farmIdleBob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}
@keyframes farmJumpExcited {
  0% { transform: scale(1) translateY(0); }
  40% { transform: scale(1.2) translateY(-22px); }
  70% { transform: scale(0.95) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}

/* Hair & tail physics inside SVG */
.chibi-hair-l { animation: chibiSwayL 2s ease-in-out infinite alternate; transform-origin: 17px 32px; }
.chibi-hair-r { animation: chibiSwayR 2s ease-in-out infinite alternate; transform-origin: 53px 32px; }
@keyframes chibiSwayL { 0% { transform: rotate(0deg); } 100% { transform: rotate(-5deg); } }
@keyframes chibiSwayR { 0% { transform: rotate(0deg); } 100% { transform: rotate(5deg); } }
.chibi-tail { animation: chibiTailWag 1.2s ease-in-out infinite alternate; transform-origin: 48px 62px; }
@keyframes chibiTailWag { 0% { transform: rotate(0deg); } 100% { transform: rotate(8deg); } }

/* Emote Burst Particle */
.emote-pop {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  animation: emoteFlyOut 1.1s ease-out forwards;
  pointer-events: none;
  z-index: 500;
}
@keyframes emoteFlyOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.5); }
  25% { opacity: 1; transform: translateX(-50%) translateY(-14px) scale(1.3); }
  80% { opacity: 0.9; transform: translateX(-50%) translateY(-28px) scale(1.1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(0.8); }
}

/* Tap Hint Toast */
.farm-tap-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
  pointer-events: none;
  z-index: 500;
}

/* Detail Modal Sheet & Backdrop */
.farm-modal-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0f172a;
  border-top: 1px solid rgba(244, 114, 182, 0.35);
  border-radius: 24px 24px 0 0;
  padding: 20px 18px 30px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
  z-index: 2000;
  transform: translateY(105%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.farm-modal-sheet.show {
  transform: translateY(0);
}
.farm-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.farm-modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.farm-modal-handle {
  width: 38px;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.farm-modal-actor-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.farm-modal-actor-avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(168,85,247,0.2));
  border: 1px solid rgba(244,114,182,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.farm-modal-actor-info { flex: 1; min-width: 0; }
.farm-modal-actor-name { font-size: 15px; font-weight: 800; color: #fbcfe8; }
.farm-modal-actor-speech { font-size: 11.5px; color: #cbd5e1; margin-top: 3px; font-style: italic; line-height: 1.35; }

.farm-modal-order-box {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.farm-order-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
}
.farm-order-field-label { color: #94a3b8; }
.farm-order-field-val { font-weight: 700; color: #f8fafc; }

.farm-modal-buy-btn {
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(236, 72, 153, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.farm-modal-buy-btn:active { transform: scale(0.98); opacity: 0.9; }

/* Recent Orders List beneath Farm */
.farm-feed-section {
  margin-top: 18px;
}
.farm-feed-title {
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.farm-feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.farm-feed-item {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.farm-feed-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.farm-feed-ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.farm-feed-buyer { font-size: 12px; font-weight: 700; color: #f1f5f9; }
.farm-feed-tag { font-size: 10.5px; color: #38bdf8; margin-top: 2px; }
.farm-feed-right { text-align: right; }
.farm-feed-price { font-size: 12px; font-weight: 700; color: #34d399; }
.farm-feed-time { font-size: 10px; color: #94a3b8; margin-top: 2px; }
