/* ===================================================================
   HARVEST ISLE 3D: FARM SIMULATOR — STYLESHEET
   Cozy, warm Harvest Moon / Stardew Valley aesthetic
   =================================================================== */

:root {
  --primary-green: #2d6a4f;
  --light-green: #52b788;
  --soil-brown: #582f0e;
  --gold-accent: #f9c74f;
  --gold-glow: rgba(249, 199, 79, 0.45);
  --wood-dark: #2b1810;
  --wood-border: #7f4f24;
  --bg-panel: rgba(20, 32, 22, 0.88);
  --border-panel: rgba(82, 183, 136, 0.35);
  --text-main: #f0fdf4;
  --text-muted: #a7c4bc;
  --font-title: 'Fredoka', 'Outfit', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1b382b;
  color: var(--text-main);
  font-family: var(--font-body);
  touch-action: none;
}

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

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

/* ── HUD OVERLAY LAYER ── */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
}

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

/* ── TOP STATS BAR ── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.farm-badge {
  background: var(--bg-panel);
  border: 1.5px solid var(--border-panel);
  border-radius: 9999px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--light-green);
  box-shadow: 0 0 8px var(--light-green);
}

.stats-cluster {
  display: flex;
  gap: 8px;
  align-items: center;
}

.stat-chip {
  background: var(--bg-panel);
  border: 1.5px solid var(--border-panel);
  border-radius: 9999px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.stat-chip.gold {
  color: var(--gold-accent);
  border-color: rgba(249, 199, 79, 0.5);
}

.stat-chip.time {
  color: #70d6ff;
  border-color: rgba(112, 214, 255, 0.4);
}

.stat-chip.day {
  color: #99e2b4;
  border-color: rgba(153, 226, 180, 0.4);
}

.hud-actions {
  display: flex;
  gap: 8px;
}

.btn-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--bg-panel);
  border: 1.5px solid var(--border-panel);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(12px);
}

.btn-icon-circle:hover {
  background: rgba(82, 183, 136, 0.3);
  border-color: var(--light-green);
  transform: translateY(-2px);
}

/* ── ACTIVE QUEST CARD (TOP LEFT) ── */
.quest-panel {
  position: absolute;
  top: 58px;
  left: 14px;
  width: 260px;
  background: var(--bg-panel);
  border: 1.5px solid var(--border-panel);
  border-radius: 16px;
  padding: 12px 14px;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.quest-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  color: var(--gold-accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.quest-title {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

.quest-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.35;
}

.quest-reward {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gold-accent);
  font-weight: bold;
}

.quest-progress-bar {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  margin-top: 8px;
  overflow: hidden;
}

.quest-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #52b788, #f9c74f);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* ── TOOLBELT / ACTION BAR (BOTTOM CENTER) ── */
.bottom-dock {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 20;
}

/* Seed Selector Sub-Dock */
.seed-selector-dock {
  display: flex;
  gap: 6px;
  background: rgba(15, 26, 17, 0.95);
  border: 1.5px solid var(--gold-accent);
  border-radius: 14px;
  padding: 6px 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  transition: opacity 0.2s, transform 0.2s;
}

.seed-selector-dock.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  display: none;
}

.btn-seed-choice {
  background: rgba(45, 106, 79, 0.4);
  border: 1px solid rgba(82, 183, 136, 0.4);
  border-radius: 10px;
  padding: 6px 10px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-seed-choice.active {
  background: var(--gold-accent);
  color: #1b382b;
  border-color: #fff;
  font-weight: bold;
}

.btn-seed-choice:hover {
  transform: scale(1.05);
}

/* Main 4-Slot Toolbelt */
.toolbelt {
  display: flex;
  gap: 8px;
  background: var(--bg-panel);
  border: 2px solid var(--border-panel);
  border-radius: 20px;
  padding: 8px 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.tool-slot {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: rgba(30, 50, 35, 0.7);
  border: 2px solid rgba(82, 183, 136, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-slot .tool-icon {
  font-size: 22px;
  line-height: 1;
}

.tool-slot .tool-key {
  position: absolute;
  top: 3px;
  left: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
}

.tool-slot .tool-count {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  color: var(--gold-accent);
}

.tool-slot:hover {
  background: rgba(82, 183, 136, 0.25);
  border-color: var(--light-green);
  transform: translateY(-2px);
}

.tool-slot.active {
  background: linear-gradient(135deg, rgba(82, 183, 136, 0.4), rgba(249, 199, 79, 0.2));
  border-color: var(--gold-accent);
  box-shadow: 0 0 15px var(--gold-glow);
  transform: scale(1.06);
}

/* Action Prompt Badge */
.action-prompt-pill {
  background: rgba(15, 26, 17, 0.9);
  border: 1px solid var(--light-green);
  border-radius: 9999px;
  padding: 4px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--light-green);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.action-prompt-pill kbd {
  background: var(--light-green);
  color: #1b382b;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 900;
}

/* ── MOBILE TOUCH CONTROLS ── */
.mobile-touch-panel {
  display: none;
  position: absolute;
  bottom: 16px;
  width: 100%;
  left: 0;
  padding: 0 16px;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 25;
}

@media (max-width: 768px), (pointer: coarse) {
  .mobile-touch-panel {
    display: flex;
  }
  .bottom-dock {
    bottom: 84px;
  }
  .quest-panel {
    width: 210px;
    top: 50px;
  }
  .tool-slot {
    width: 44px;
    height: 44px;
  }
  .tool-slot .tool-icon {
    font-size: 18px;
  }
}

.dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 42px);
  gap: 4px;
  pointer-events: auto;
}

.btn-dpad {
  background: rgba(15, 26, 17, 0.88);
  border: 1px solid var(--border-panel);
  color: var(--light-green);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  touch-action: none;
}

.btn-dpad:active {
  background: var(--light-green);
  color: #1b382b;
}

.mobile-action-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.btn-round-action {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(82, 183, 136, 0.25);
  border: 2px solid var(--light-green);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.btn-round-action.harvest {
  border-color: var(--gold-accent);
  color: var(--gold-accent);
}

.btn-round-action:active {
  background: var(--light-green);
  color: #1b382b;
}

/* ── MODALS (LEADERBOARD & SHIPPING BIN) ── */
.modal-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 15, 8, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, #1b382b 0%, #0d2017 100%);
  border: 2px solid var(--light-green);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(82, 183, 136, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 14px;
}

.leaderboard-table th {
  text-align: left;
  padding: 7px 8px;
  color: var(--light-green);
  border-bottom: 1px solid rgba(82, 183, 136, 0.2);
  font-size: 10.5px;
}

.leaderboard-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-table tr.top-1 {
  color: var(--gold-accent);
  font-weight: bold;
}

.btn-standard {
  background: linear-gradient(135deg, #52b788, #2d6a4f);
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-standard:hover {
  transform: scale(1.03);
}

/* Floating Points / Notifications */
.floating-toast {
  position: absolute;
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 800;
  color: var(--gold-accent);
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.8), 0 0 20px var(--gold-accent);
  pointer-events: none;
  z-index: 50;
  animation: floatUp 1.2s ease-out forwards;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -100px) scale(1.3); }
}
