@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --bg-primary: #85c255;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-dark-card: rgba(30, 41, 59, 0.96);
  --color-gold: #f59e0b;
  --color-gold-dark: #d97706;
  --color-milk: #38bdf8;
  --color-feed: #eab308;
  --color-green: #22c55e;
  --color-red: #ef4444;
  --color-text-main: #1e293b;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.18);
  --font-heading: 'Fredoka', cursive, sans-serif;
  --font-body: 'Nunito', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  background-color: #2b3a24;
  font-family: var(--font-body);
  color: var(--color-text-main);
  overflow: hidden;
}

#app-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #73b343;
  display: flex;
  flex-direction: column;
}

#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#ui-root {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none; /* Phaser canvas altına tıklamayı geçirmek için */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.interactive-ui {
  pointer-events: auto;
}

/* ================= HUD ================= */
.hud-bar {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  margin: 10px 12px;
  padding: 10px 14px;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  border: 2px solid rgba(255, 255, 255, 0.8);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
}

.hud-icon {
  font-size: 20px;
  line-height: 1;
}

.hud-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.hud-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.hud-value {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-main);
}

.hud-bar-progress {
  width: 100%;
  height: 5px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 3px;
}

.hud-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.fill-feed {
  background: var(--color-feed);
}

.fill-milk {
  background: var(--color-milk);
}

.fill-gold {
  background: var(--color-gold);
}

.hud-booster-btn {
  grid-column: span 2;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
  transition: transform 0.1s active;
}

.hud-booster-btn:active {
  transform: scale(0.97);
}

/* ================= Bottom Navigation ================= */
.bottom-nav {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  margin: 10px 14px 14px 14px;
  padding: 8px 12px;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  border: 2px solid rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.nav-tab-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 16px;
  transition: all 0.2s ease;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.nav-tab-btn.active {
  background: #e0f2fe;
  color: #0284c7;
  transform: translateY(-2px);
}

.nav-tab-icon {
  font-size: 22px;
}

/* ================= Panel Modal ================= */
.panel-overlay {
  pointer-events: auto;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  animation: fadeIn 0.2s ease;
}

.panel-container {
  background: #ffffff;
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  height: 82%;
  max-height: 82%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-close-btn {
  background: #f1f5f9;
  border: none;
  font-size: 18px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-text-muted);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ================= Market Cards & Chart ================= */
.market-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.market-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.market-price-badge {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-gold-dark);
  background: #fef3c7;
  padding: 4px 10px;
  border-radius: 10px;
}

.market-action-row {
  display: flex;
  gap: 8px;
}

.market-btn {
  flex: 1;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.market-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  box-shadow: none;
}

.chart-container {
  background: #1e293b;
  border-radius: 16px;
  padding: 14px;
  color: white;
}

.chart-title {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 8px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  height: 90px;
  gap: 3px;
  padding-top: 10px;
}

.chart-bar-item {
  flex: 1;
  background: #38bdf8;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
  min-height: 4px;
  transition: height 0.3s ease;
  position: relative;
}

.chart-bar-item.current {
  background: #f59e0b;
}

/* ================= Upgrades List ================= */
.upgrade-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upgrade-info {
  flex: 1;
}

.upgrade-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-main);
}

.upgrade-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.upgrade-badge {
  display: inline-block;
  background: #e2e8f0;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 4px;
}

.upgrade-action-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.upgrade-action-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  box-shadow: none;
}

/* ================= Toast Notification ================= */
.toast-container {
  pointer-events: auto;
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ================= Quick Farm Actions Bar ================= */
.farm-quick-actions {
  pointer-events: auto;
  display: flex;
  gap: 8px;
  margin: 0 14px;
  justify-content: center;
}

.quick-action-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(6px);
  padding: 6px 12px;
  border-radius: 14px;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s active;
}

.quick-action-btn:active {
  transform: scale(0.95);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translate(-50%, -10px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}
