:root {
  color-scheme: dark;
  --bg: #05070d;
  --ink: #edf7ff;
  --muted: #9cb0c3;
  --gold: #f6d36b;
  --cyan: #8eeaff;
  --red: #ff5370;
  --panel: rgba(7, 12, 22, 0.72);
  --line: rgba(160, 235, 255, 0.72);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 46%, #101827 0%, #060913 48%, #02040a 100%);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
}

#app {
  position: relative;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  z-index: 2;
  padding: 14px 16px;
  border: 1px solid rgba(142, 234, 255, 0.18);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 0 28px rgba(75, 190, 255, 0.08);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.top-left {
  top: 18px;
  left: 18px;
  max-width: min(460px, calc(100vw - 36px));
}

.top-right {
  top: 18px;
  right: 18px;
  min-width: 174px;
  text-align: right;
}

.brand {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--cyan);
}

.chapter {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 750;
}

.goal,
#modeLabel,
#resourceLabel,
#battleStats {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dialog {
  position: absolute;
  left: 50%;
  bottom: 84px;
  z-index: 4;
  width: min(680px, calc(100vw - 36px));
  transform: translateX(-50%);
  padding: 22px 24px;
  border: 1px solid rgba(246, 211, 107, 0.28);
  border-radius: 8px;
  background: rgba(5, 7, 13, 0.86);
  box-shadow:
    0 0 42px rgba(246, 211, 107, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
}

.dialog-kind {
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.16em;
}

.dialog h1 {
  margin: 8px 0 8px;
  font-size: 25px;
  line-height: 1.2;
}

.dialog p {
  margin: 0;
  color: #d6e6f2;
  font-size: 15px;
  line-height: 1.7;
}

.dialog button {
  margin-top: 18px;
  min-width: 84px;
  height: 36px;
  border: 1px solid rgba(142, 234, 255, 0.35);
  border-radius: 8px;
  background: rgba(142, 234, 255, 0.1);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.battle-panel {
  position: absolute;
  left: 50%;
  top: 18px;
  z-index: 3;
  min-width: 250px;
  transform: translateX(-50%);
  padding: 14px 18px;
  border: 1px solid rgba(255, 83, 112, 0.24);
  border-radius: 8px;
  background: rgba(18, 7, 12, 0.72);
  text-align: center;
  backdrop-filter: blur(14px);
}

#battleTitle {
  color: #ffd8df;
  font-weight: 760;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 2;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  transform: translateX(-50%);
  color: rgba(237, 247, 255, 0.74);
  font-size: 12px;
  pointer-events: none;
}

.hint span {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.26);
}

.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .top-right {
    display: none;
  }

  .top-left {
    right: 18px;
  }

  .chapter {
    font-size: 17px;
  }

  .dialog {
    bottom: 74px;
    padding: 18px;
  }
}
