﻿:root {
  --bg-top: #8ecf7b;
  --bg-bottom: #4f9543;
  --hud-bg: rgba(24, 44, 15, 0.72);
  --hud-text: #efffe8;
  --stick-base: rgba(240, 240, 240, 0.18);
  --stick-knob: rgba(252, 252, 252, 0.72);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  font-family: "Press Start 2P", "DotGothic16", monospace;
}

.app {
  position: fixed;
  inset: 0;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: fixed;
  top: 16px;
  left: 16px;
  color: var(--hud-text);
  background: var(--hud-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  padding: 10px 12px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.22) inset;
}

.zone-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.hint {
  font-size: 10px;
  opacity: 0.95;
  margin-top: 8px;
}

.life-wrap {
  margin-top: 10px;
}

.life-bar {
  width: 150px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  background: rgba(0, 0, 0, 0.35);
}

.life-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #c13d2f, #f3774e);
}

.life-text {
  margin-top: 6px;
  font-size: 10px;
}

.controls {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

.controls-right {
  right: 18px;
}

.controls-left {
  left: 18px;
}

.joystick-base {
  width: 132px;
  height: 132px;
  border-radius: 8px;
  background: var(--stick-base);
  border: 2px solid rgba(255, 255, 255, 0.42);
  position: relative;
}

.joystick-knob {
  width: 58px;
  height: 58px;
  border-radius: 6px;
  background: var(--stick-knob);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.22) inset;
}

.action-button {
  width: 88px;
  height: 88px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(173, 48, 38, 0.85);
  color: #fff8f0;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.24) inset;
}

.action-button:active {
  transform: scale(0.96);
}

.bag-button {
  position: fixed;
  top: 16px;
  right: 16px;
  min-width: 92px;
  height: 44px;
  padding: 0 10px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.56);
  background: rgba(31, 55, 21, 0.82);
  color: #f2ffe8;
  font-family: inherit;
  font-size: 12px;
}

.craft-button {
  position: fixed;
  top: 66px;
  right: 16px;
  min-width: 92px;
  height: 38px;
  padding: 0 10px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.56);
  background: rgba(56, 43, 18, 0.88);
  color: #fff5dc;
  font-family: inherit;
  font-size: 10px;
}

.screen {
  position: fixed;
  inset: 0;
  padding: 16px;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.screen-card {
  width: min(460px, 100%);
  max-height: 84vh;
  overflow: auto;
  padding: 14px;
  color: var(--hud-text);
  background: rgba(21, 33, 15, 0.96);
  border: 2px solid rgba(255, 255, 255, 0.34);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3) inset;
}

.screen-title {
  font-size: 13px;
  margin-bottom: 8px;
}

.item-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-top: 8px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.bag-title {
  font-size: 12px;
}

.bag-item {
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.4;
}

.craft-status {
  min-height: 14px;
}

.bag-close {
  margin-top: 10px;
  width: 100%;
  height: 32px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.48);
  background: rgba(62, 87, 50, 0.9);
  color: #f2ffe8;
  font-family: inherit;
  font-size: 10px;
}

.bag-close:disabled {
  opacity: 0.5;
}

.hidden {
  display: none;
}

.banner-wrap {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  width: min(86vw, 440px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.banner {
  background: rgba(18, 26, 44, 0.9);
  color: #f5f8ff;
  border: 2px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.28) inset;
  padding: 10px 12px;
  font-size: 10px;
}

@media (max-width: 520px) {
  .item-grid {
    grid-template-columns: 1fr;
  }
}
