:root {
  color-scheme: dark;
  --bg: #07110d;
  --ink: #f4f0df;
  --muted: rgba(244, 240, 223, 0.68);
  --line: rgba(244, 240, 223, 0.16);
  --glass: rgba(9, 21, 17, 0.72);
  --amber: #e1b45a;
  --mint: #7fd5b4;
  --danger: #ef6a4f;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}

button {
  font: inherit;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(13, 29, 22, 0.34), rgba(1, 5, 4, 0.92)),
    #07110d;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.marker-guide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.marker-guide-shadow,
.marker-guide-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.marker-guide-shadow {
  stroke: rgba(0, 0, 0, 0.92);
  stroke-width: 5;
  stroke-dasharray: 1 9;
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.95));
}

.marker-guide-line {
  stroke: #33f4ff;
  stroke-width: 2;
  stroke-dasharray: 1 9;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.95));
}

.marker-label {
  position: absolute;
  left: calc(50% + 86px);
  top: calc(50% - 164px);
  z-index: 8;
  width: min(330px, calc(100vw - 120px));
  display: grid;
  gap: 3px;
  pointer-events: none;
  color: #33f4ff;
  text-shadow:
    0 0 2px #000,
    0 0 5px #000,
    0 0 9px #000;
}

.marker-label strong,
.marker-label span,
.marker-label small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marker-label strong {
  font-size: 20px;
  font-weight: 700;
}

.marker-label span,
.marker-label small {
  font-size: 20px;
  font-weight: 500;
}

.marker-label small {
  opacity: 0.9;
}

.marker-label.boss {
  color: #fff;
}

.marker-label.conquered {
  color: #ff3b32;
}

.hidden {
  display: none !important;
}

.unsupported-webgl {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(7, 17, 13, 0.94), rgba(0, 0, 0, 0.96)),
    #07110d;
}

.unsupported-panel {
  width: min(420px, calc(100vw - 36px));
  padding: 20px;
  border: 1px solid rgba(244, 240, 223, 0.18);
  border-radius: 8px;
  background: rgba(7, 17, 13, 0.92);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

.unsupported-panel strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.unsupported-panel p {
  margin: 0;
  color: var(--muted);
}

.level-panel {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  top: max(18px, env(safe-area-inset-top));
  width: min(420px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 27, 23, 0.92), rgba(6, 11, 10, 0.88));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(225, 180, 90, 0.52);
  color: var(--amber);
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(225, 180, 90, 0.1);
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.02em;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.level-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.level-button {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid rgba(244, 240, 223, 0.18);
  border-radius: 8px;
  background: rgba(244, 240, 223, 0.055);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.record-button {
  min-width: 72px;
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid rgba(86, 255, 229, 0.28);
  border-radius: 8px;
  background: rgba(5, 28, 26, 0.64);
  color: #b9fff3;
  cursor: pointer;
}

.level-button:hover,
.level-button:focus-visible {
  outline: none;
  border-color: rgba(127, 213, 180, 0.7);
  background: rgba(127, 213, 180, 0.12);
}

.level-button small {
  color: var(--muted);
}

.hud {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.hud button,
.hud-center {
  pointer-events: auto;
}

.hud-center {
  min-width: 0;
  justify-self: center;
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 8, 7, 0.62);
  backdrop-filter: blur(14px);
  text-align: center;
}

#levelName {
  color: var(--muted);
  font-size: 12px;
}

#hotspotName {
  max-width: min(58vw, 520px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.icon-button,
.text-button,
.modal button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 8, 7, 0.66);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.icon-button {
  width: 44px;
  font-size: 24px;
}

.text-button,
.modal button {
  padding: 0 14px;
  font-weight: 700;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 30px);
  padding: 10px 13px;
  border: 1px solid rgba(225, 180, 90, 0.34);
  border-radius: 8px;
  background: rgba(8, 11, 8, 0.7);
  color: rgba(244, 240, 223, 0.84);
  backdrop-filter: blur(12px);
  font-size: 13px;
  text-align: center;
}

.mini-map {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  width: 132px;
  height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: #000;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
  pointer-events: none;
}

.modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  width: min(390px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 17, 13, 0.95);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
}

.modal-panel p {
  margin: 0 0 16px;
  color: var(--ink);
}

.records-modal {
  position: fixed;
  z-index: 40;
  pointer-events: auto;
}

.records-panel {
  width: min(460px, calc(100vw - 34px));
  max-height: min(72vh, 620px);
  overflow: auto;
  padding: 20px 20px 18px;
  border-color: rgba(86, 255, 229, 0.32);
  background: rgba(4, 14, 13, 0.94);
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
}

.records-panel h2 {
  margin: 0 46px 16px 0;
  color: #56ffe5;
  font-size: 18px;
  line-height: 1.25;
}

.records-content section {
  margin-top: 14px;
}

.records-content b {
  display: block;
  margin-bottom: 7px;
  color: #fff;
}

.records-content ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.records-content li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
}

.records-content small,
.records-content p {
  margin: 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 20;
  width: min(420px, calc(100vw - 32px));
  max-height: min(58vh, 520px);
  overflow: auto;
  transform: translate(-50%, calc(-50% + 14px)) scale(0.98);
  opacity: 0;
  padding: 14px 16px;
  border: 1px solid rgba(86, 255, 229, 0.28);
  border-radius: 8px;
  background: rgba(4, 14, 13, 0.84);
  color: var(--ink);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.toast strong {
  color: #56ffe5;
}

.boss-toast {
  width: min(520px, calc(100vw - 34px));
  padding: 20px 22px;
  border-color: rgba(255, 244, 184, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 244, 184, 0.18), rgba(86, 255, 229, 0.12)),
    rgba(3, 12, 12, 0.92);
  box-shadow:
    0 0 34px rgba(255, 244, 184, 0.24),
    0 28px 82px rgba(0, 0, 0, 0.58);
  color: #fff7d0;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.boss-toast strong {
  display: block;
  margin-top: 8px;
  color: #ffffff;
  font-size: 24px;
  line-height: 1.25;
  text-shadow: 0 0 18px rgba(86, 255, 229, 0.58);
}

.toast section {
  margin-top: 12px;
}

.toast b {
  display: block;
  margin-bottom: 6px;
  color: #fff;
}

.toast ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}

.toast li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.toast small,
.toast p {
  color: var(--muted);
}

@media (max-width: 640px) {
  .marker-label {
    left: calc(50% + 38px);
    top: calc(50% - 182px);
    width: min(250px, calc(100vw - 70px));
  }

  .level-panel {
    inset: auto 12px 12px;
    width: auto;
    max-height: min(72vh, 560px);
  }

  .hud {
    grid-template-columns: 42px 1fr 42px;
  }

  .mini-map {
    width: 98px;
    height: 98px;
    top: max(12px, env(safe-area-inset-top));
  }

  #hotspotName {
    max-width: 48vw;
    font-size: 13px;
  }
}
