﻿:root {
  --bg: #0b1b14;
  --panel: rgba(10, 30, 22, 0.82);
  --accent: #f6c453;
  --accent-2: #9fe3c0;
  --danger: #ff6b6b;
  --text: #f4f1e6;
  --muted: #c5b9a2;
}

* {
  box-sizing: border-box;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: var(--text);
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #04110a;
  overscroll-behavior: none;
  overflow: hidden;
  touch-action: none;
}

#app {
  position: relative;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: radial-gradient(circle at top, #1e5038 0%, #0b1b14 55%, #060e0a 100%);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.hud-left .title {
  font-size: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.hud-left .subtitle {
  font-size: 12px;
  color: var(--muted);
}

.hud-left .time-display {
  margin-top: 8px;
  font-size: 14px;
  color: var(--accent);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-block;
}

.hud-right {
  min-width: 220px;
  background: var(--panel);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.level {
  font-size: 14px;
  margin-bottom: 8px;
}

.exp {
  margin-bottom: 10px;
}

.exp-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.exp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6be08f, #a7f2c2);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.exp-text {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.stats {
  display: grid;
  gap: 8px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(6, 16, 12, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-ring {
  --pct: 100%;
  --color: var(--accent);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: conic-gradient(var(--color) var(--pct), rgba(255, 255, 255, 0.14) 0);
  position: relative;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 6px));
}

.stat-inner {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: rgba(8, 20, 15, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.3px;
}

.stat-value {
  font-size: 12px;
  font-weight: bold;
}

.stat.hunger {
  --color: #f6c453;
}

.stat.thirst {
  --color: #6fd6ff;
}

.stat.boredom {
  --color: #d18bff;
}

.stat.fatigue {
  --color: #8ee08e;
}

.audio-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 5;
}

.audio-toggle:hover {
  background: rgba(10, 30, 22, 0.95);
  transform: scale(1.05);
}

.audio-toggle.muted {
  opacity: 0.5;
}


#toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
}

#exp-pop {
  position: absolute;
  left: 50%;
  transform: translate(-50%, 10px);
  bottom: 56px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(10, 40, 20, 0.8);
  color: #aef7bf;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

#exp-pop.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#minimap {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 11px;
  opacity: 0.9;
}

#minimap .label {
  display: flex;
  align-items: center;
  gap: 6px;
}

#minimap .label::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6bd67e;
  display: inline-block;
}

#minimap .label.open::before {
  background: #e1a95f;
}

#help {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 280px;
}

#help .chip {
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
}

#menu {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
  background: rgba(4, 12, 9, 0.78);
  padding: 24px;
  z-index: 10;
}

#menu h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent);
}

#menu p {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.6;
}

#menu button {
  border: none;
  background: var(--accent);
  color: #2b1a05;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: bold;
  cursor: pointer;
}

#menu .note {
  font-size: 12px;
  color: var(--muted);
}

#mobile-controls {
  position: absolute;
  inset: auto 0 0 0;
  display: none;
  justify-content: space-between;
  padding: 18px;
  pointer-events: none;
  touch-action: none;
}

.joystick {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  pointer-events: auto;
  touch-action: none;
}

.stick {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.buttons {
  display: grid;
  gap: 10px;
  pointer-events: auto;
  touch-action: none;
}

.buttons button {
  border: none;
  background: rgba(246, 196, 83, 0.9);
  color: #2b1a05;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 12px;
  min-width: 110px;
}

.buttons button.hidden {
  display: none;
}

.buttons button.dim {
  opacity: 0.45;
  filter: saturate(0.6);
}

.buttons.hidden {
  display: none;
}

@media (max-width: 900px) {
  #mobile-controls {
    display: flex;
  }

  #help {
    display: none;
  }

  #hud {
    flex-direction: column;
    align-items: flex-start;
  }

  .hud-right {
    width: auto;
    min-width: auto;
    padding: 8px 12px;
  }

  .stats {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 0;
  }

  .stat {
    flex: 0 0 auto;
    min-width: auto;
    padding: 0;
    background: transparent;
    border: none;
  }

  /* Hide text labels on mobile */
  .stat-info {
    display: none;
  }

  .stat-ring {
    width: 36px;
    height: 36px;
  }

  .stat-inner {
    inset: 4px;
    font-size: 13px;
  }
}