/* Game over, the records panel, connection / graphics notices and the
   small indicator tags.
   Linked from index.html in a fixed order (the order is the cascade). */

#game-over {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(40, 0, 0, 0.35), rgba(5, 2, 2, 0.85));
}

.game-over-title {
  margin: 0;
  font-family: "Russo One", system-ui, sans-serif;
  font-size: 46px;
  font-weight: 400;
  color: #e8473a;
  text-shadow: 0 0 24px rgba(232, 71, 58, 0.4);
}

/* The run's stats in four cells, each flagged when it's a new best. */
.game-over-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 18px 0 24px;
}

/* The run's rewards under its stats: shards, titans, the weapon's
   mastery (its bar filling). */
.game-over-extras {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: -14px 0 22px;
}

.game-over-extras[hidden] {
  display: none;
}

.run-mastery-bar {
  display: block;
  width: 80%;
  height: 5px;
  margin-top: 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.run-mastery-bar b {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #6abeff, #ffc94d);
}

/* A NEW BEST stamped on once its number has counted up (hud.js). */
.new-best.stamp {
  animation: best-stamp 0.45s cubic-bezier(0.2, 1.8, 0.4, 1);
}

@keyframes best-stamp {
  0% { opacity: 0; transform: scale(3) rotate(-12deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* Where the run lands on the all-time board (gold when it moves up). */
.game-over-board {
  max-width: 420px;
  margin: -10px auto 20px;
  font: 600 14px/1.4 system-ui, "Segoe UI", sans-serif;
  color: var(--muted);
}

.game-over-board.best {
  color: var(--accent);
}

/* The build the run ended with: a chip per upgrade taken, with its level
   (gold when maxed). */
.game-over-build {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: -10px 0 22px;
  font: 600 12px/1.2 system-ui, "Segoe UI", sans-serif;
  color: var(--muted);
}

.game-over-build > span:first-child {
  width: 100%;
  margin-bottom: 2px;
  font: 400 12px/1.2 "Russo One", system-ui, sans-serif;
  letter-spacing: 1.5px;
}

.build-chip {
  padding: 4px 9px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.build-chip b {
  margin-left: 6px;
  color: var(--accent);
}

.build-chip.maxed {
  border-color: rgba(255, 201, 77, 0.55);
  box-shadow: 0 0 8px rgba(255, 201, 77, 0.25);
}

.run-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.run-stat strong {
  font-family: "Russo One", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
}

.run-stat span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.run-stat.best {
  border-color: var(--accent);
  background: rgba(255, 201, 77, 0.08);
}

.new-best {
  text-align: center;
  line-height: 1.25;
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
}

/* Records panel on the start screen. */
.records-bests {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.records-best {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.records-best strong {
  font-family: "Russo One", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
}

.records-best span,
.records-totals,
.records-empty {
  color: var(--muted);
  font-size: 12px;
}

.records-totals {
  margin: 10px 0 16px;
}

.records-empty {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.records-subtitle {
  margin: 0 0 6px;
  font-family: "Russo One", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--accent);
}

.records-runs {
  margin: 0;
  padding: 0 0 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.records-runs li {
  padding: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.records-runs li:first-child {
  border-top: none;
}

.records-run-name {
  display: block;
  overflow: hidden;
  font-weight: 600;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.records-run-detail {
  font-size: 12px;
}

/* The STARS board's count, and a profile's stars. */
.records-run-detail.stars-detail {
  font-weight: 700;
  color: var(--accent);
}

.profile-stars {
  margin: 0 0 10px;
  font: 400 20px/1.2 "Russo One", system-ui, sans-serif;
  letter-spacing: 1px;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(255, 201, 77, 0.35);
}

#play-again {
  width: 100%;
}

#mute-indicator {
  position: fixed;
  bottom: calc(var(--edge) + max(30px, var(--left-stack, 0px)));
  left: var(--edge);
  z-index: 20;
  padding: 4px 8px;
  font: 600 12px/1.2 system-ui, "Segoe UI", sans-serif;
  letter-spacing: 1px;
  color: #ffb4a8;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 6px;
  pointer-events: none;
}

/* Shown if the browser loses the WebGL context (the screen would go black). */
#gfx-notice,
/* Joining: the match left behind (the start screen's) is covered until
   the new one arrives, fading in only if that takes a moment. */
.joining {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0d12;
  animation: joining-in 0.15s ease-out 0.08s both;
  pointer-events: none;
}

.joining[hidden] {
  display: none;
}

.joining span {
  font: 400 22px/1 "Russo One", system-ui, sans-serif;
  letter-spacing: 2px;
  color: var(--muted);
}

@keyframes joining-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

#net-notice {
  position: fixed;
  left: 50%;
  top: 40%;
  z-index: 40;
  transform: translateX(-50%);
  padding: 18px 22px;
  text-align: center;
  font: 600 15px/1.4 system-ui, "Segoe UI", sans-serif;
  color: var(--text);
  background: #10131a;
  border: 1px solid var(--border);
  border-radius: 14px;
}

#gfx-notice[hidden],
#net-notice[hidden] {
  display: none;
}

#gfx-notice p,
#net-notice p {
  margin: 0 0 12px;
}

#autofire-indicator {
  position: fixed;
  bottom: calc(var(--edge) + max(30px, var(--left-stack, 0px)) + var(--badge-mute, 0px));
  left: var(--edge);
  z-index: 20;
  padding: 4px 8px;
  font: 600 12px/1.2 system-ui, "Segoe UI", sans-serif;
  letter-spacing: 1px;
  color: #ffd98a;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 6px;
  pointer-events: none;
}

/* All-time leaderboard, above the browser's own records. */
#hall-of-fame {
  margin-bottom: 24px;
}

#hall-of-fame .records-empty {
  margin-left: -22px;
  list-style: none;
}

/* The dungeon's map (dungeonMap.js): M in a dungeon, over the game, which
   goes on behind it. */
#dungeon-map {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  padding: 10px 12px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(10, 10, 12, 0.88);
  pointer-events: none;
  text-align: center;
}

#dungeon-map[hidden] {
  display: none;
}

#dungeon-map canvas {
  display: block;
  border-radius: 6px;
}

.dungeon-map-title {
  margin: 0 0 8px;
  font: 700 14px/1.2 "Russo One", system-ui, sans-serif;
  letter-spacing: 1px;
  color: #e8e2d0;
}

.dungeon-map-legend {
  margin: 8px 0 0;
  font: 600 11px/1.2 system-ui, "Segoe UI", sans-serif;
  color: #b8b2a2;
}

.dungeon-map-legend span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin: 0 4px 0 8px;
  border-radius: 2px;
  vertical-align: -1px;
}

.dungeon-map-legend .key-fighting::before { background: #9a3b34; }
.dungeon-map-legend .key-cleared::before { background: #3f6a3e; }
.dungeon-map-legend .key-explored::before { background: #4a4850; }
.dungeon-map-legend .key-treasure::before { background: #a8873a; }
.dungeon-map-legend .key-stairs::before { background: #d8d2c0; }
