:root {
  --ink: #f3ead6;
  --muted: #a9a294;
  --paper: #f1d27a;
  --cinnabar: #c0392b;
  --night: #0b1020;
  --panel: rgba(10, 13, 24, 0.72);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

#app canvas { display: block; }

[hidden] { display: none !important; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
.xpbar { position: absolute; top: 0; left: 0; right: 0; height: 8px; background: rgba(0, 0, 0, 0.5); }
#xpfill { height: 100%; width: 0; background: linear-gradient(90deg, #d8a640, #ffe08a); transition: width 0.15s; }
.hud-top {
  position: absolute; top: 16px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 18px; font-weight: 600; text-shadow: 0 2px 4px #000;
}
#timer { font-size: 22px; letter-spacing: 1px; }
.lvbox { display: flex; align-items: baseline; gap: 10px; }
#xptext { font-size: 14px; font-weight: 500; color: var(--paper); }
#bossbar { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); width: min(560px, 80vw); text-align: center; }
#bossbar .label { font-size: 15px; color: #d9b3ff; margin-bottom: 4px; text-shadow: 0 2px 4px #000; }
#bossbar .track { height: 12px; background: rgba(0, 0, 0, 0.6); border: 1px solid #5a2f80; }
#bossfill { height: 100%; width: 100%; background: #8e44ad; }
#toast {
  position: absolute; top: 30%; left: 0; right: 0; text-align: center;
  font-size: 40px; font-weight: 800; color: var(--paper); text-shadow: 0 3px 12px #000;
  opacity: 0;
}
#toast.show { animation: toast 2.2s ease-out; }
@keyframes toast {
  0% { opacity: 0; transform: scale(1.4); }
  12% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}
.hud-bottom {
  position: absolute; left: 16px; right: 16px; bottom: 16px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
}
.hp { position: relative; width: min(320px, 50vw); height: 22px; background: rgba(0, 0, 0, 0.6); border: 1px solid #5c1f1a; }
#hpfill { height: 100%; width: 100%; background: linear-gradient(90deg, #8e1f16, #d8483a); transition: width 0.1s; }
#hptext { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 600; text-shadow: 0 1px 2px #000; }
#loadout { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 50vw; pointer-events: auto; cursor: pointer; }
#loadout:hover .chip { border-color: var(--paper); }
.chip { padding: 3px 8px; font-size: 13px; background: var(--panel); border: 1px solid #555; border-radius: 3px; }
.chip.weapon { border-color: #b8902c; color: var(--paper); }

/* Overlays */
.overlay {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 16px; text-align: center;
  background: radial-gradient(circle at center, rgba(11, 16, 32, 0.55), rgba(5, 7, 14, 0.9));
}
/* Title sits left of the priest, who stands in the right third of the title shot. */
#title {
  align-items: flex-start; text-align: left;
  padding-left: max(16px, 9vw);
  background: linear-gradient(90deg, rgba(5, 7, 14, 0.9) 0%, rgba(5, 7, 14, 0.6) 38%, rgba(5, 7, 14, 0) 72%);
}
@media (max-width: 720px) {
  #title {
    align-items: center; text-align: center; padding-left: 16px;
    background: radial-gradient(circle at center, rgba(11, 16, 32, 0.55), rgba(5, 7, 14, 0.9));
  }
}
.overlay h1 { margin: 0; font-size: clamp(48px, 10vw, 88px); letter-spacing: 12px; color: var(--paper); font-family: "Songti SC", "Noto Serif SC", serif; text-shadow: 0 4px 24px rgba(255, 140, 60, 0.35); }
.overlay h2 { margin: 0; font-size: 34px; color: var(--paper); font-family: "Songti SC", "Noto Serif SC", serif; }
.sub { margin: 0; font-size: 18px; color: var(--ink); }
.keys, .hint { margin: 0; color: var(--muted); line-height: 1.7; }
.overlay button#startBtn, .overlay button#restartBtn, .overlay button#resumeBtn {
  margin-top: 12px; padding: 12px 32px; font-size: 18px; cursor: pointer;
  color: #2a1608; background: var(--paper); border: 2px solid var(--cinnabar); border-radius: 4px;
}

#cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.card {
  position: relative; width: 190px; min-height: 230px; padding: 34px 16px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer; text-align: center;
  color: #2a1608; background: var(--paper);
  border: 3px solid var(--cinnabar); border-radius: 4px;
  font-family: inherit; transition: transform 0.12s;
}
.card:hover { transform: translateY(-6px); }
.card strong { font-size: 26px; font-family: "Songti SC", "Noto Serif SC", serif; }
.card .desc { font-size: 15px; line-height: 1.5; }
.card .tag { font-size: 13px; color: var(--cinnabar); font-weight: 700; }
.card .key {
  position: absolute; top: 8px; left: 10px; width: 22px; height: 22px;
  display: grid; place-items: center; font-size: 13px; color: var(--paper); background: var(--cinnabar); border-radius: 50%;
}

/* Pause screen: the build so far and the order it was picked in. */
#build { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; width: min(920px, 100%); text-align: left; }
.build-col { flex: 1 1 340px; min-width: 0; padding: 12px 16px; background: var(--panel); border: 1px solid #3a3426; border-radius: 4px; }
.build-col h3 { margin: 0 0 6px; font-size: 15px; color: var(--paper); }
.build-row { display: grid; grid-template-columns: 4.5em 4.2em 1fr; gap: 10px; padding: 5px 0; font-size: 14px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.build-row .name { color: var(--paper); font-weight: 600; }
.build-row .meta { color: var(--muted); }
.build-row .desc { color: var(--ink); }
#buildLog { max-height: 46vh; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
#buildLog .build-row { grid-template-columns: 3em 3em 4.5em 1fr; }
.build-empty { margin: 6px 0; color: var(--muted); font-size: 14px; }
