/* ══════════════════════════════════════════════════════════════
   v0.2 Game End — Dismissable Overlay
   All shared styles are in ../../shared/components/*.css
   This file contains ONLY game-end-specific styles.
══════════════════════════════════════════════════════════════ */

/* ── Full-bleed backdrop ── */
.game-end-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #050608 0%, #020304 100%);
  opacity: 0.9;
  z-index: 100;
  animation: backdrop-fade 0.8s ease-out both;
}

.game-end-content {
  position: fixed;
  inset: 0;
  z-index: 101;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.game-end-content > * {
  pointer-events: auto;
}

@keyframes backdrop-fade {
  from { opacity: 0; }
  to   { opacity: 0.9; }
}

/* ── Faction watermark ── */
.faction-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 300px;
  color: color-mix(in srgb, var(--faction-a) 3%, transparent);
  z-index: 100;
  pointer-events: none;
  line-height: 1;
  animation: watermark-in 1s ease-out 0.5s both, watermark-pulse 8s ease-in-out 1.5s infinite;
}

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

@keyframes watermark-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-50%, -50%) scale(1.02); }
}

/* ── Victory title ── */
.victory-title {
  font: 400 56px/1 'Anton', sans-serif;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: var(--victory-color, var(--faction-a));
  text-align: center;
  text-shadow: 0 0 40px var(--victory-glow, color-mix(in srgb, var(--faction-a) 50%, transparent));
  animation: title-in 0.6s ease-out 0.3s both, title-glow 3s ease-in-out 0.9s infinite alternate;
}


@keyframes title-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes title-glow {
  from { filter: brightness(1); }
  to   { filter: brightness(1.2); }
}

.victory-tagline {
  font: 500 10px/1 'Rajdhani', sans-serif;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--text-dis);
  text-align: center;
  margin-top: 8px;
  animation: title-in 0.6s ease-out 0.4s both;
}

/* ── Score pillars ── */
.score-pillars {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-top: 48px;
  animation: pillars-ready 0.1s linear 0.5s both;
}

@keyframes pillars-ready {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.score-pillar {
  width: 200px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.score-pillar--faction-a {
  animation: pillar-left 0.5s ease-out 0.5s both;
}

.score-pillar--faction-b {
  animation: pillar-right 0.5s ease-out 0.6s both;
}

@keyframes pillar-left {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pillar-right {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.pillar-faction-name {
  font: 600 9px/1 'Rajdhani', sans-serif;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.pillar-faction-name.side-a { color: var(--faction-a-dim); }
.pillar-faction-name.side-b { color: var(--faction-b-dim); }

.pillar-score {
  font: 400 64px/1 'Anton', sans-serif;
  letter-spacing: 2px;
}

.pillar-score.side-a { color: var(--faction-a); }
.pillar-score.side-b { color: var(--faction-b); }

.pillar-stat {
  font: 500 11px/1.6 'Rajdhani', sans-serif;
  letter-spacing: 0.5px;
}

.pillar-stat--sec  { color: var(--text-sec); }
.pillar-stat--muted { color: var(--text-muted); }

/* ── Center VS divider ── */
.pillar-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  padding-top: 24px;
  animation: title-in 0.5s ease-out 0.55s both;
}

.pillar-divider-line {
  width: 1px;
  height: 40px;
  background: var(--border);
}

.pillar-divider-vs {
  font: 400 12px/1 'Anton', sans-serif;
  letter-spacing: 3px;
  color: var(--text-muted);
  padding: 8px 0;
}

/* ── Round timeline ── */
.round-timeline {
  margin-top: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  position: relative;
}

.timeline-track {
  display: flex;
  align-items: center;
  position: relative;
}

.timeline-segment {
  width: 48px;
  height: 1px;
  background: var(--border);
}

.timeline-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: default;
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--faction-a-dim);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 400 7px/1 'Rajdhani', sans-serif;
  color: var(--text-muted);
  transition: all 0.2s;
  position: relative;
  z-index: 1;
}

.timeline-dot--filled {
  background: color-mix(in srgb, var(--faction-a) 15%, transparent);
  border-color: var(--faction-a);
}

.timeline-label {
  font: 500 8px/1 'Rajdhani', sans-serif;
  letter-spacing: 1px;
  color: var(--text-dis);
  margin-top: 6px;
}

.timeline-scores {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}

.ts-a {
  font: 400 11px/1 'Anton', sans-serif;
  color: var(--faction-a);
}

.ts-b {
  font: 400 11px/1 'Anton', sans-serif;
  color: var(--faction-b);
}

.ts-sep {
  font: 500 8px/1 'Rajdhani', sans-serif;
  color: var(--text-dis);
}

/* Timeline node staggered entrance */
.timeline-node:nth-child(1)  { animation: node-in 0.3s ease-out 0.8s both; }
.timeline-segment:nth-child(2) { animation: node-in 0.2s ease-out 0.85s both; }
.timeline-node:nth-child(3)  { animation: node-in 0.3s ease-out 0.9s both; }
.timeline-segment:nth-child(4) { animation: node-in 0.2s ease-out 0.95s both; }
.timeline-node:nth-child(5)  { animation: node-in 0.3s ease-out 1.0s both; }
.timeline-segment:nth-child(6) { animation: node-in 0.2s ease-out 1.05s both; }
.timeline-node:nth-child(7)  { animation: node-in 0.3s ease-out 1.1s both; }
.timeline-segment:nth-child(8) { animation: node-in 0.2s ease-out 1.15s both; }
.timeline-node:nth-child(9)  { animation: node-in 0.3s ease-out 1.2s both; }

@keyframes node-in {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Action buttons ── */
.victory-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 48px;
  animation: links-in 0.5s ease-out 1.2s both;
}

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

.victory-btn {
  font: 600 11px/1 'Rajdhani', sans-serif;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 12px 28px;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
}

.victory-btn.primary {
  border-color: var(--faction-a);
  color: #080c10;
  background: var(--faction-a);
}
.victory-btn.primary:hover {
  background: var(--faction-a);
  filter: brightness(1.15);
  box-shadow: 0 0 20px var(--faction-a-glow);
}

.victory-btn.secondary {
  border-color: var(--text-muted);
  color: var(--text-sec);
}
.victory-btn.secondary:hover {
  border-color: var(--faction-a-dim);
  color: var(--text-primary);
}

.victory-btn.disabled {
  border-color: var(--border);
  color: var(--text-dis);
  cursor: default;
  pointer-events: none;
}

/* ── Backlink (override for overlay z-index) ── */
.game-end-content .backlink {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 102;
  font: 500 10px/1 'Rajdhani', sans-serif;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-decoration: none;
}

.game-end-content .backlink:hover {
  color: var(--faction-a);
}

/* ── Dismiss / re-summon ── */
/* Use visibility+opacity, NOT display:none (which restarts all CSS animations) */
.overlay-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ── END GAME button pulse when overlay dismissed ── */
@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--faction-a) 40%, transparent); }
  50%      { box-shadow: 0 0 12px 4px color-mix(in srgb, var(--faction-a) 25%, transparent); }
}

.btn-cta.pulse {
  animation: btn-pulse 2s ease-in-out infinite;
  opacity: 1 !important;
  cursor: pointer;
  pointer-events: auto;
}

/* ── Dismiss hint ── */
.dismiss-hint {
  font: 500 9px/1 'Rajdhani', sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dis);
  margin-top: 32px;
  opacity: 0;
  animation: hint-in 0.4s ease-out 1.5s both;
}

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