/* ============================================================
   Kancha Go -- Watch replay: a saved online match played back on the same board
   the live game draws (src/replay.js). CSS only, no new art: the scoreboard is the
   real match screen's (.pcard/.setbox/.lead from styles.css, via .live-matchbar in
   live.css) and the controls are plain shapes with inline icons -- placeholders
   until painted buttons exist (see docs/ASSETS.md, "Watch replay").
   ============================================================ */

#replay {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow-y: auto;
  padding-bottom: 16px;
  color: #fff;
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    linear-gradient(rgba(9, 16, 34, 0.8), rgba(5, 10, 24, 0.95)),
    url("assets/home-bg.jpg") center top / cover no-repeat,
    #071634;
}
/* the scoreboard cards use the same colour swap the game screen does when you are the green side */
#replay[data-you="green"] {
  --you: var(--green);
  --opp: var(--blue);
  --you-rgb: var(--green-rgb);
  --opp-rgb: var(--blue-rgb);
}

.replay__top {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto;
  padding: max(12px, var(--safe-area-inset-top, env(safe-area-inset-top))) 14px 0;
}
.replay__title {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #ffe8a8;
  text-shadow: 0 2px 0 #6a3d08, 0 3px 8px rgba(0, 0, 0, 0.5);
}
.replay__spacer { flex: none; width: 38px; }

.replay__caption {
  min-height: 1.3em;
  max-width: 432px;
  margin: 8px auto 0;
  padding: 0 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold, #ffcf3f);
}
/* a square stage like the match screen's, so scoreboard, board and controls fit one phone screen */
.replay-stage {
  width: min(92vw, 400px, calc(100dvh - 350px)); /* the 350 leaves room for everything under the board, timeline included */
  aspect-ratio: 1;
  margin-top: 6px;
}

/* ---- the timeline: a native range slider (drag, tap and arrow keys for free), in the blue neon look of the painted buttons ----
   --f (0 to 1) is set by replay.js; the ticks mark where each set starts. 12 px is half the thumb, so the ticks and the filled part
   line up with the middle of the thumb at both ends. */
.replay__timeline {
  position: relative;
  width: min(92vw, 400px);
  height: 28px;
  margin: 6px auto 0;
}
.replay__seek {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.replay__seek:focus { outline: none; }
.replay__seek:focus-visible { outline: 2px solid #9fe0ff; outline-offset: 2px; border-radius: 999px; }
.replay__seek::-webkit-slider-runnable-track {
  height: 12px;
  box-sizing: border-box;
  border: 2px solid #2fc3ff;
  border-radius: 999px;
  background: linear-gradient(90deg, #35b8ff 0, #1c6bff calc(12px + (100% - 24px) * var(--f, 0)), #06205f calc(12px + (100% - 24px) * var(--f, 0)));
  box-shadow: 0 0 8px rgba(47, 195, 255, 0.55), inset 0 2px 3px rgba(0, 0, 0, 0.45);
}
.replay__seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -6px;
  box-sizing: border-box;
  border: 3px solid #2fc3ff;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8fd0ff 0, #1f7dff 38%, #062a7a 100%);
  box-shadow: 0 0 8px rgba(47, 195, 255, 0.85), 0 2px 4px rgba(0, 0, 0, 0.55);
}
.replay__seek:active::-webkit-slider-thumb { transform: scale(1.12); }
.replay__seek::-moz-range-track {
  height: 12px;
  box-sizing: border-box;
  border: 2px solid #2fc3ff;
  border-radius: 999px;
  background: #06205f;
}
.replay__seek::-moz-range-progress { height: 8px; border-radius: 999px; background: #1c6bff; }
.replay__seek::-moz-range-thumb {
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  border: 3px solid #2fc3ff;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8fd0ff 0, #1f7dff 38%, #062a7a 100%);
}
.replay__ticks { position: absolute; left: 12px; right: 12px; top: 0; bottom: 0; z-index: 3; pointer-events: none; }
.replay__ticks i {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 14px;
  margin-left: -1.5px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
}

.replay__bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 9px auto 0;
}
/* the user's painted buttons (assets/rp-*.webp): the pictures ARE the buttons, so nothing is drawn behind them. The big gold one
   is play / pause / watch again; the blue ones are previous, next and the speed (0.5x, 1x, 1.5x, 2x, 3x). */
.rp-btn {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rp-btn img { display: block; width: 100%; height: auto; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45)); }
.rp-btn:active:not(:disabled) { transform: scale(0.94); }
.rp-btn:disabled { opacity: 0.4; cursor: default; }
.rp-btn--side { width: 46px; }
.rp-btn--play { width: 62px; }
.rp-btn--speed { width: 44px; }

.replay__progress {
  max-width: 432px;
  margin: 10px auto 0;
  padding: 0 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #9ab0cf);
}
