@layer app {
/* ============================================================
   Recap screen (game finished — direct to recap)
   ============================================================ */
.recap-screen {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.recap-game-result {
  text-align: center;
  padding: 16px 0 8px;
}

.recap-result-date {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-flap);
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--page-sub);
  margin-bottom: 6px;
}

.recap-result-text {
  font-size: 24px;
  font-weight: 900;
  font-family: var(--font-flap);
  text-transform: uppercase;
  letter-spacing: 3px;
}

.recap-result-text.won { color: var(--green); }
.recap-result-text.lost { color: var(--red); }
.recap-result-text.tied { color: var(--stop-tied-text); }

.recap-player-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.recap-player-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.recap-player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cell-bg);
  border: 1px solid var(--cell-brd);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-flap);
  font-size: 13px;
  color: var(--page-text);
  flex-shrink: 0;
}

.recap-player-name {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  color: var(--page-text);
}

.recap-player-place {
  font-size: 22px;
  font-weight: 900;
  font-family: var(--font-flap);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.recap-player-place.won { color: var(--green); }
.recap-player-place::before { content: "— "; color: var(--page-sub); }

.recap-forfeit-reason {
  margin-top: 6px;
  font-size: 14px;
  color: var(--page-sub);
}

.recap-line-section {
  margin-top: 16px;
  text-align: left;
}

.recap-actions {
  margin-top: 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.recap-demo-remaining,
.recap-demo-heading {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--page-sub);
  margin: 0;
}

.rematch-pending,
.rematch-request {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--page-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.rematch-request {
  font-size: 18px;
}

.rematch-accepted {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
}

/* Recap video section */
.recap-video-section {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--row-bg);
  border: 1px solid var(--cell-brd);
  border-radius: 12px;
  padding: 16px;
}

.recap-video-wrapper {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 9 / 16;
  position: relative;
  border-radius: 8px;
  border: 1px solid var(--cell-brd);
  background: var(--page-bg);
  overflow: hidden;
}

.recap-video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--page-sub);
  z-index: 0;
}

.recap-video-player {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: transparent;
  object-fit: cover;
}

.recap-video-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.recap-share {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.recap-share-preview {
  margin: 0;
  padding: 14px 18px;
  background: var(--board-bg);
  border: 1px solid var(--row-brd);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  color: var(--page-text);
  white-space: pre;
  text-align: left;
  letter-spacing: 1px;
}

.recap-share-hint {
  margin: 0;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--page-sub);
}

/* Segmented toggle for dark/light */
.recap-video-toggle {
  display: flex;
  border-radius: var(--radius);
  border: 1px solid var(--cell-brd);
  overflow: hidden;
}

.recap-video-toggle-btn {
  padding: 0 14px;
  height: var(--cell-size);
  line-height: var(--cell-size);
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--page-sub);
  background: transparent;
  border: none;
  border-right: 1px solid var(--cell-brd);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.recap-video-toggle-btn:last-child {
  border-right: none;
}

.recap-video-toggle-btn.active {
  background: var(--orange);
  color: #fff;
}

.recap-video-toggle-btn:not(.active):hover {
  background: var(--row-hover);
}

.recap-video-toggle-btn:disabled {
  cursor: default;
  opacity: 0.6;
}

.recap-video-toggle-btn .waiting-dots {
  margin-right: 4px;
  position: relative;
  top: -1px;
}

/* Generating state with spinner */
.recap-video-generating {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--page-sub);
  padding: 16px 0;
}

.recap-progress-track {
  width: 60%;
  max-width: 160px;
  height: 4px;
  border-radius: 2px;
  background: var(--cell-brd);
  overflow: hidden;
}

.recap-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--orange);
  transition: width 0.4s ease;
  animation: recap-progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes recap-progress-indeterminate {
  0% { width: 0%; margin-left: 0%; }
  50% { width: 40%; margin-left: 30%; }
  100% { width: 0%; margin-left: 100%; }
}

@keyframes recap-progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}


/* Action row — side-by-side buttons */
.recap-actions-row {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.recap-actions-row .btn {
  flex: 1;
  max-width: 200px;
  text-align: center;
}

/* Back link — understated text link instead of a button */
.recap-back-link {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--page-sub);
  text-decoration: none;
  margin-top: 4px;
}

.recap-back-link:hover {
  color: var(--page-text);
  text-decoration: underline;
}

/* Grayed-out modifiers on takeover trains */
.mod-used {
  background: var(--row-bg) !important;
  border-color: var(--cell-brd) !important;
}
.mod-used .cell-mod-badge {
  opacity: 0.3;
  text-decoration: line-through;
}

.train-row.takeover {
  border-left: 3px solid var(--flap-dim);
  padding-left: 8px;
}

.takeover-play-line {
  display: inline;
  font-size: 11px;
  line-height: 1.4;
}

.takeover-info {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--flap-dim);
  line-height: 1;
  opacity: 0.6;
}


.opponent-trains-label {
  font-size: 9px;
  font-family: var(--font-body);
  color: var(--label-col);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 8px 0 4px;
  padding-left: 2px;
}

.train-row.opponent-row {
  cursor: default;
  padding-top: 4px;
}

}
