@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;600&display=swap");

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: radial-gradient(circle at 20% 10%, #2a7b92, #0b0f20 55%, #05060e);
  font-family: "Chakra Petch", "Trebuchet MS", sans-serif;
}

body.locked #renderCanvas {
  cursor: none;
}

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

#ui {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(7, 10, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  color: #e6f0ff;
  backdrop-filter: blur(8px);
}

#ui .title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#ui .stat {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(230, 240, 255, 0.85);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#ui .stat span {
  color: #7ff2d0;
  font-weight: 600;
}

#ui .hint {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(230, 240, 255, 0.75);
}

.home-screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 12%, rgba(137, 220, 255, 0.5), rgba(5, 9, 20, 0.96));
  color: #e6f0ff;
  overflow: hidden;
}

.home-screen::before,
.home-screen::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(0px);
  opacity: 0.5;
}

.home-screen::before {
  background: radial-gradient(circle at 30% 30%, rgba(100, 210, 255, 0.45), rgba(50, 90, 150, 0));
  top: -120px;
  left: -140px;
}

.home-screen::after {
  background: radial-gradient(circle at 60% 40%, rgba(120, 255, 180, 0.4), rgba(50, 120, 90, 0));
  bottom: -160px;
  right: -120px;
}

.home-card {
  position: relative;
  z-index: 1;
  width: min(520px, 88vw);
  padding: 30px;
  border-radius: 20px;
  background: rgba(6, 12, 25, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
  backdrop-filter: blur(10px);
}

.home-eyebrow {
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 10px;
}

.home-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.home-subtitle {
  font-size: 14px;
  color: rgba(230, 240, 255, 0.7);
  margin-bottom: 22px;
}

.home-actions {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.home-button {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(111, 199, 216, 0.12);
  color: #e6f0ff;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.home-button.primary {
  background: linear-gradient(135deg, rgba(104, 230, 255, 0.75), rgba(75, 140, 255, 0.7));
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 24px rgba(50, 120, 200, 0.35);
}

.home-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}

.home-foot {
  font-size: 12px;
  color: rgba(230, 240, 255, 0.6);
}

.health-hud {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 2;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(7, 10, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  color: #e6f0ff;
  backdrop-filter: blur(8px);
  display: grid;
  gap: 10px;
  min-width: 200px;
}

.health-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.health-row.dead {
  opacity: 0.55;
}

.health-label {
  min-width: 36px;
  color: rgba(230, 240, 255, 0.75);
}

.health-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.health-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width 0.12s ease;
}

.health-fill.health-player {
  background: linear-gradient(90deg, #7fe7ff, #4a9dff);
}

.health-fill.health-npc {
  background: linear-gradient(90deg, #ffb26b, #ff6b6b);
}

.health-fill.health-friendly {
  background: linear-gradient(90deg, #6bffcc, #34d28a);
}

.health-text {
  min-width: 32px;
  text-align: right;
  color: rgba(230, 240, 255, 0.8);
}

.health-row.full .health-label {
  color: rgba(180, 255, 220, 0.9);
}

.enemy-countdown {
  position: absolute;
  z-index: 2;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(7, 10, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  color: #e6f0ff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.enemy-countdown.corner {
  top: 18px;
  right: 18px;
  font-size: 11px;
}

.enemy-countdown.center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.loading-screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 15%, rgba(82, 180, 220, 0.35), rgba(5, 7, 18, 0.9));
  color: #e6f0ff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.loading-card {
  padding: 20px 24px;
  border-radius: 16px;
  background: rgba(6, 12, 25, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.loading-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.loading-subtitle {
  font-size: 12px;
  color: rgba(230, 240, 255, 0.7);
}

.panel {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: min(320px, 86vw);
  max-height: 80vh;
  padding: 16px;
  border-radius: 16px;
  background: rgba(6, 12, 25, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  color: #e6f0ff;
  backdrop-filter: blur(10px);
  overflow-y: auto;
}

.inventory-panel {
  position: absolute;
  top: 110px;
  right: 18px;
  z-index: 2;
  width: min(260px, 82vw);
  max-height: 70vh;
  padding: 16px;
  border-radius: 16px;
  background: rgba(6, 12, 25, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  color: #e6f0ff;
  backdrop-filter: blur(10px);
  overflow-y: auto;
}

.inventory-list {
  display: grid;
  gap: 8px;
}

.inventory-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(111, 199, 216, 0.14);
  color: #e6f0ff;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.inventory-item:hover {
  transform: translateY(-1px);
  background: rgba(111, 199, 216, 0.24);
}

.inventory-item.selected {
  border-color: rgba(127, 242, 208, 0.8);
  box-shadow: 0 0 0 1px rgba(127, 242, 208, 0.4);
}

.inventory-item.empty {
  opacity: 0.5;
}

.inventory-count {
  color: #7ff2d0;
  font-weight: 600;
}

.inventory-hint {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(230, 240, 255, 0.6);
  line-height: 1.3;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.panel-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
}

.panel-row-button {
  grid-template-columns: 1fr;
}

.panel-row button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(111, 199, 216, 0.2);
  color: #e6f0ff;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.panel-row button:hover {
  background: rgba(111, 199, 216, 0.32);
}

.panel-note {
  margin-top: 6px;
  font-size: 11px;
  color: rgba(230, 240, 255, 0.6);
  line-height: 1.3;
}

.panel-row label {
  grid-column: 1 / -1;
  color: rgba(230, 240, 255, 0.78);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.panel-row input[type="range"] {
  width: 100%;
  accent-color: #6bc7d8;
}

.panel-row span {
  font-size: 12px;
  color: rgba(230, 240, 255, 0.75);
  min-width: 44px;
  text-align: right;
}

.panel-section + .panel-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.section-title {
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(230, 240, 255, 0.6);
}

.panel-footer {
  font-size: 12px;
  color: rgba(230, 240, 255, 0.55);
}

.hidden {
  display: none;
}

@media (max-width: 600px) {
  #ui {
    top: 12px;
    left: 12px;
    padding: 10px 12px;
  }

  .health-hud {
    left: 12px;
    bottom: 12px;
    padding: 8px 10px;
    min-width: 180px;
  }

  .panel {
    top: auto;
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .inventory-panel {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
  }

  .enemy-countdown.corner {
    top: 12px;
    right: 12px;
    font-size: 10px;
  }

  .enemy-countdown.center {
    font-size: 16px;
  }

  #ui .title {
    font-size: 14px;
  }

  #ui .hint {
    font-size: 12px;
  }
}
