/* Button states, the game-over / death screen buttons, the pause menu
   and its settings, keycaps (kbd).
   Linked from index.html in a fixed order (the order is the cascade). */

.secondary-button:hover {
  background: rgba(255, 201, 77, 0.16);
}

.secondary-button:active {
  transform: scale(0.97);
}

#game-over .play-button,
#game-over .secondary-button {
  width: 100%;
}

#game-over .secondary-button {
  margin-top: 10px;
}

/* Waiting to revive: a small panel low on the screen, so the match
   stays visible (and clickable around it). */
#death-screen {
  position: fixed;
  left: 50%;
  bottom: 18%;
  z-index: 10;
  transform: translateX(-50%);
  width: 300px;
  max-width: calc(100% - 32px);
  padding: 20px 22px 18px;
}

#death-screen .game-over-title {
  font-size: 34px;
}

#revive-status {
  margin: 6px 0 16px;
  font-family: "Russo One", system-ui, sans-serif;
  font-size: 18px;
  color: var(--muted);
}

#death-screen .play-button,
#death-screen .secondary-button {
  width: 100%;
}

#death-screen .secondary-button {
  margin-top: 10px;
}

#revive-button:disabled {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
  cursor: default;
  transform: none;
}

/* Its key (Space, or R). */
#revive-button kbd {
  margin-left: 6px;
  padding: 0 5px;
  font-size: 10px;
  letter-spacing: 1px;
  vertical-align: middle;
  color: inherit;
}

.touch #revive-button kbd {
  display: none;
}

#revive-button.ready {
  animation: revive-ready 1s ease-in-out infinite alternate;
}

@keyframes revive-ready {
  from { box-shadow: 0 0 0 rgba(255, 201, 77, 0); }
  to { box-shadow: 0 0 22px rgba(255, 201, 77, 0.55); }
}

/* Dying in the Arena: a panel low on the screen (the killer stays in view
   above it), the recap and the life's stats in rows of small cells. */
#arena-death {
  position: fixed;
  left: 50%;
  bottom: 12%;
  z-index: 10;
  transform: translateX(-50%);
  width: 420px;
  max-width: calc(100% - 32px);
  padding: 18px 22px 18px;
  box-sizing: border-box;
}

#arena-death .game-over-title {
  font-size: 30px;
  overflow-wrap: anywhere;
}

.arena-death-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 12px 0 0;
}

.arena-death-row.recap {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.arena-death-row:last-of-type {
  margin-bottom: 16px;
}

.arena-death-cell strong {
  display: block;
  font: 400 17px/1.2 "Russo One", system-ui, sans-serif;
  color: var(--text);
  overflow-wrap: anywhere;
}

.arena-death-row.recap .arena-death-cell strong {
  font-size: 14px;
}

.arena-death-cell.close strong {
  color: var(--accent);
}

.arena-death-cell span {
  display: block;
  margin-top: 2px;
  font: 600 11px/1.2 system-ui, "Segoe UI", sans-serif;
  color: var(--muted);
}

#arena-death .play-button,
#arena-death .secondary-button {
  width: 100%;
}

#arena-death .secondary-button {
  margin-top: 10px;
}

#respawn-button {
  animation: revive-ready 1s ease-in-out infinite alternate;
}

#respawn-button kbd {
  margin-left: 6px;
  padding: 0 5px;
  font-size: 10px;
  letter-spacing: 1px;
  vertical-align: middle;
  color: inherit;
}

.touch #respawn-button kbd {
  display: none;
}

@media (max-width: 480px) {
  .arena-death-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* The Arena's kill feed: top right, beside the minimap, newest on top. */
.kill-feed {
  position: fixed;
  top: calc(var(--edge) + 56px);
  right: calc(var(--edge) + 180px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  max-width: min(340px, calc(100vw - 230px));
  pointer-events: none;
  user-select: none;
  font: 600 12px/1.3 system-ui, "Segoe UI", sans-serif;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.kill-feed[hidden] {
  display: none;
}

.kill-feed-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  animation: kill-feed-in 0.2s ease-out;
  transition: opacity 0.4s;
}

.kill-feed-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.kill-feed-line .kill-feed-cause {
  color: var(--muted);
  font-weight: 600;
}

.kill-feed-weapon {
  flex: none;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--muted);
  text-transform: uppercase;
}

.kill-feed-line.yours {
  border-color: rgba(255, 201, 77, 0.6);
}

.kill-feed-line.yours strong:first-child {
  color: var(--accent);
}

.kill-feed-line.you-died {
  border-color: rgba(232, 71, 58, 0.6);
}

.kill-feed-line.you-died strong:last-child {
  color: #e8473a;
}

.kill-feed-line.leaving {
  opacity: 0;
}

@keyframes kill-feed-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 830px) {
  .kill-feed {
    top: 48px;
    right: 124px;
    max-width: calc(100vw - 140px);
    font-size: 11px;
  }
}

/* The hit marker: an ✕ of four short strokes round the cursor, flashing
   white for a hit, bigger and red for a kill. */
.hit-marker {
  position: fixed;
  z-index: 6;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  pointer-events: none;
  opacity: 0;
}

.hit-marker::before,
.hit-marker::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(currentColor, currentColor) center / 3px 100% no-repeat;
  -webkit-mask: linear-gradient(#000 0 35%, transparent 35% 65%, #000 65%);
  mask: linear-gradient(#000 0 35%, transparent 35% 65%, #000 65%);
  transform: rotate(45deg);
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9));
}

.hit-marker::after {
  transform: rotate(-45deg);
}

.hit-marker {
  color: #fff;
}

.hit-marker.kill {
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  color: #ff4a3a;
}

.hit-marker.play {
  animation: hit-marker 0.22s ease-out;
}

.hit-marker.kill.play {
  animation-duration: 0.45s;
}

@keyframes hit-marker {
  from { opacity: 1; transform: scale(1.25); }
  to { opacity: 0; transform: scale(1); }
}

/* Pause menu: the frozen game shows dimmed behind it. */
#pause-menu {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: radial-gradient(ellipse at center, rgba(5, 6, 10, 0.45), rgba(5, 6, 10, 0.85));
}

.pause-title {
  margin: 0 0 6px;
  font-family: "Russo One", system-ui, sans-serif;
  font-size: 40px;
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--text);
}

/* The game isn't paused behind the menu. */
/* Under Give up and Quit: what leaving a run costs (gameServer.js
   startCooldown). */
.leave-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.pause-note {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
}

#pause-menu .play-button,
#pause-menu .secondary-button {
  width: 100%;
}

.settings {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 22px 0;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

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

.setting {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.setting > span {
  flex: 1;
}

.setting input[type="range"] {
  width: 120px;
  accent-color: var(--accent);
  cursor: pointer;
}

.setting output {
  width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* On/off switch made from a checkbox. */
.switch {
  appearance: none;
  position: relative;
  width: 40px;
  height: 22px;
  margin: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.15s;
}

.switch:checked {
  background: var(--accent);
}

.switch:checked::after {
  background: #1a1205;
  transform: translateX(18px);
}

.switch:focus-visible,
.setting input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The settings opened from the start screen (pauseMenu.js moves the
   pause menu's .settings into the slot): the dialog has its own title. */
.bestiary-panel.settings-panel {
  width: 420px;
}

.settings-slot {
  padding: 0 24px 20px;
  overflow-y: auto;
}

.settings-slot .settings {
  margin: 0;
  padding-top: 4px;
  border-top: none;
  border-bottom: none;
}

.settings-slot .settings-title {
  display: none;
}

/* The start screen's Settings link, with a little gear. */
.settings-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.gear-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
}

.pause-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

/* "◀ Watching Name ▶" on the death screen: who the camera follows. */
.spectate-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: -4px 0 12px;
  font-size: 14px;
  color: var(--muted);
}

.spectate-line[hidden] {
  display: none;
}

.spectate-line strong {
  color: var(--text);
}

.spectate-switch {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 12px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.spectate-switch:hover,
.spectate-switch:focus-visible {
  background: rgba(255, 201, 77, 0.16);
}

/* "Buy this?" before shards are spent (confirmDialog.js): over every
   other popup. */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 6, 10, 0.7);
}

.confirm-box {
  width: min(380px, 100%);
  box-sizing: border-box;
  padding: 22px 24px 20px;
  text-align: center;
  color: var(--text);
  background: rgb(16, 19, 26);
  border: 1px solid rgba(255, 201, 77, 0.45);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}

.confirm-title {
  margin: 0 0 10px;
  font: 400 22px/1.2 "Russo One", system-ui, sans-serif;
  letter-spacing: 1px;
  color: var(--accent);
}

.confirm-item {
  margin: 0 0 6px;
  font: 700 18px/1.3 system-ui, "Segoe UI", sans-serif;
}

.confirm-cost {
  margin: 0 0 18px;
  font: 500 13px/1.4 system-ui, "Segoe UI", sans-serif;
  color: var(--muted);
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.confirm-actions button {
  min-width: 120px;
  margin: 0;
}

.confirm-buy {
  padding: 12px 16px;
  font-size: 16px;
}
