/* Capture Mode screens. The board, the veil, and Exit Capture. */
#capture-leave {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 154, 74, 0.95);
  border-radius: 16px;
  background: rgba(48, 16, 6, 0.94);
  color: #ffd8b0;
  cursor: pointer;
  pointer-events: auto;
}

#capture-leave i {
  font-style: normal;
  font-size: 18px;
  line-height: 1;
}

#capture-leave span {
  font: 700 11px "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#capture-leave[hidden] { display: none; }

#capture-veil {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(28, 10, 2, 0.62), transparent 16%, transparent 82%, rgba(18, 6, 2, 0.7)),
    radial-gradient(ellipse at center, transparent 30%, rgba(64, 28, 6, 0.18) 58%, rgba(32, 10, 2, 0.72) 100%);
  -webkit-mask-image: url("../backdrop/frame-hole.png?v=1");
  mask-image: url("../backdrop/frame-hole.png?v=1");
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

#capture-veil[hidden] { display: none; }

#capture-board {
  position: fixed;
  z-index: 33;
  left: calc(8px + var(--frame-x) + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  width: min(300px, calc(100vw - 84px - var(--frame-x) - env(safe-area-inset-left)));
  padding: 12px 12px 10px;
  border: 1px solid rgba(255, 176, 74, 0.55);
  border-left: 3px solid #ffb04a;
  border-radius: 12px;
  background: rgba(18, 10, 6, 0.78);
  color: #f6efe4;
  font: 12px/1.35 "IBM Plex Mono", ui-monospace, monospace;
  pointer-events: auto;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

#capture-board[hidden] { display: none; }

.capture-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.capture-kicker {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffc14a;
  font-size: 10px;
}

#capture-taker {
  margin: 8px 0 0;
  font: 700 22px/1.1 Sora, sans-serif;
  color: #ffd18a;
}

#capture-name {
  margin: 2px 0 0;
  font: 600 15px/1.2 Sora, sans-serif;
  color: #fff;
}

#capture-line,
#capture-meta {
  margin: 4px 0 0;
  color: rgba(246, 239, 228, 0.82);
}

.capture-meter {
  position: relative;
  height: 22px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 196, 120, 0.35);
  overflow: hidden;
}

.capture-meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  position: relative;
  transition: width 0.35s linear;
}

.capture-meter i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.42) 45%, transparent 70%);
  transform: translateX(-100%);
  animation: capture-sheen 1.8s linear infinite;
}

.capture-meter b {
  position: absolute;
  right: 8px;
  top: 0;
  font: 700 12px/22px "IBM Plex Mono", ui-monospace, monospace;
  color: #fff8ee;
  text-shadow: 0 1px 2px #000;
}

@keyframes capture-sheen {
  to { transform: translateX(220%); }
}

#capture-board.capture-won .capture-head {
  animation: capture-head-won 0.6s ease-out 2;
}

#capture-board.capture-contested .capture-meter {
  animation: capture-bar-flicker 0.18s steps(1) 3;
}

@keyframes capture-head-won {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.06); filter: brightness(1.8); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes capture-bar-flicker {
  0% { border-color: #ff3b30; box-shadow: 0 0 10px rgba(255, 59, 48, 0.8); }
  50% { border-color: rgba(255, 196, 120, 0.35); box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  .capture-meter i { transition: none; }
  .capture-meter i::after { animation: none; }
  #capture-board.capture-won .capture-head,
  #capture-board.capture-contested .capture-meter { animation: none; }
}

.capture-clock {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

#capture-status[data-status="contested"] { color: #ffb0a0; }
#capture-status[data-status="taking"] { color: #ffd18a; }

.capture-ships {
  margin: 8px 0 0;
  color: #ffc14a;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#capture-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  overflow: auto;
  min-height: 0;
}

.capture-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid rgba(255, 196, 120, 0.18);
  border-radius: 8px;
  background: rgba(32, 16, 6, 0.45);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.capture-row.on {
  border-color: rgba(255, 193, 74, 0.85);
  color: #fff4e0;
}

.capture-kind {
  flex: 0 0 auto;
  min-width: 52px;
  color: rgba(255, 214, 160, 0.62);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.capture-body {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capture-tag {
  padding: 2px 8px;
  border: 1px solid rgba(255, 193, 74, 0.8);
  border-radius: 999px;
  background: rgba(42, 16, 4, 0.82);
  color: #ffd7a4;
  font: 700 11px "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

#capture-board,
#capture-name,
#capture-line,
#capture-meta,
.capture-clock {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

@media (max-width: 520px) {
  #capture-board {
    width: min(250px, calc(100vw - 72px - env(safe-area-inset-left)));
    font-size: 11px;
  }

  #capture-name { font-size: 14px; }
  #capture-taker { font-size: 18px; }
}

/* Planet hold readout on the ship sheet. */
.capture-read { margin: 8px 0 0; flex: 0 0 auto; }
.capture-read[hidden] { display: none; }
.capture-read p {
  margin: 0 0 6px;
  color: #e7eef6;
  font-size: 13px;
  line-height: 1.35;
}
.capture-read-bar {
  position: relative;
  height: 22px;
  border: 1px solid rgba(232, 238, 246, 0.62);
  border-radius: 3px;
  background: rgba(6, 10, 16, 0.82);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.capture-read-bar i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  opacity: 0.92;
}
.capture-read-bar b {
  position: relative;
  z-index: 1;
  display: block;
  padding-right: 8px;
  font: 700 11px/22px "IBM Plex Mono", monospace;
  letter-spacing: 0.04em;
  text-align: right;
  color: #f4f8fc;
  text-shadow: 0 1px 2px #000;
}

.capture-hit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-sizing: border-box;
  padding: 0 8px 0 0;
  border: 1px solid rgba(232, 238, 246, 0.62);
  border-radius: 3px;
  background: rgba(6, 10, 16, 0.82);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 8px 16px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  color: #f4f8fc;
  font: 700 11px/1 "IBM Plex Mono", monospace;
  letter-spacing: 0.04em;
  cursor: pointer;
  pointer-events: auto;
}
.capture-hit i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  opacity: 0.92;
}
.capture-hit b {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px #000;
}
