
:root {
  --night: #10182b;
  --panel: rgba(28, 42, 66, 0.94);
  --ice: #bdeaff;
  --blue: #62b9ed;
  --gold: #ffc16b;
  --muted: #9aacc5;
  --border: rgba(180, 220, 255, 0.22);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  color: #eef6ff;
  background:
    radial-gradient(ellipse at 50% 0%, #35496c 0%, transparent 55%),
    linear-gradient(180deg, #17243d, #0b1020 80%);
  font-family: Arial, sans-serif;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
}

#app {
  width: 100%;
  max-width: 680px;
  margin: auto;
  padding: 14px 14px 100px;
}

#loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--ice);
}

.topbar,
.character-panel,
.world-section {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  margin-bottom: 12px;
}

.game-logo {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--ice);
}

.subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #334967;
  font-size: 20px;
}

.character-panel {
  padding: 14px;
  margin-bottom: 12px;
}

.character-name {
  display: flex;
  justify-content: space-between;
  font-size: 17px;
  font-weight: bold;
  margin-bottom: 13px;
}

.character-name span:last-child {
  color: var(--gold);
}

.bar-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin: 9px 0 5px;
}

.bar {
  height: 9px;
  background: #10182b;
  border-radius: 20px;
  overflow: hidden;
}

.hp-fill,
.mana-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width 0.3s;
}

.hp-fill {
  background: linear-gradient(90deg, #e64e62, #ff8b83);
}

.mana-fill {
  background: linear-gradient(90deg, #388eea, #85d7ff);
}

.resources {
  display: flex;
  justify-content: space-around;
  margin-top: 14px;
  font-size: 14px;
}

.resources span:nth-child(1) {
  color: var(--gold);
}

.resources span:nth-child(2) {
  color: #b99aff;
}

.resources span:nth-child(3) {
  color: var(--ice);
}

.world-section {
  padding: 12px;
}

.world-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

h2 {
  margin: 0 0 5px;
  font-size: 18px;
}

.world-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.small-button {
  padding: 9px 12px;
  border-radius: 10px;
  background: #344e70;
  border: 1px solid var(--border);
  font-size: 12px;
}

#game-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 520px;
  overflow: hidden;
  border: 2px solid #7189a9;
  border-radius: 12px;
  background: #182c3b;
  box-shadow: inset 0 0 30px #07111d;
}

#game {
  width: 100%;
  height: 100%;
}

#game canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.weather-label {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(12, 25, 44, 0.8);
  color: var(--ice);
  font-size: 11px;
  pointer-events: none;
}

#gameMessage {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  text-align: center;
  color: var(--gold);
  font-size: 13px;
  text-shadow: 0 2px 5px #000;
  pointer-events: none;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dpad button {
  width: 42px;
  height: 38px;
  border-radius: 10px;
  background: #344c6c;
  border: 1px solid var(--border);
  font-size: 18px;
  touch-action: none;
}

.dpad div {
  display: flex;
  gap: 4px;
}

.warm-button {
  padding: 13px 16px;
  border-radius: 12px;
  color: #3a2514;
  background: linear-gradient(135deg, #ffd18a, #e99b4c);
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(226, 148, 70, 0.2);
}

.hint {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  margin: 12px 0 0;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 680px;
  display: flex;
  justify-content: space-around;
  padding: 10px 5px calc(10px + env(safe-area-inset-bottom));
  background: rgba(12, 20, 36, 0.97);
  border-top: 1px solid var(--border);
  z-index: 10;
}

.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
}

.bottom-nav button span {
  font-size: 10px;
}

.bottom-nav button.active {
  color: var(--gold);
}

#secondaryScreen {
  margin-top: 14px;
  min-height: 250px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
}

#secondaryContent {
  margin-top: 15px;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 380px) {
  #app {
    padding-left: 9px;
    padding-right: 9px;
  }

  .game-logo {
    font-size: 15px;
  }

  .warm-button {
    padding: 11px;
    font-size: 12px;
  }
}
