/* ==========================================================================
   GIPF replay widget
   ========================================================================== */

.retro-match-replay--gipf .retro-match-replay__board-host {
  container-type: inline-size;
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  margin-inline: auto;
  overflow: hidden;
  --gipf-board-rotation: -30deg;
  --gipf-label-counter-rotation: 30deg;
  background: radial-gradient(circle at 50% 45%, #497bb8 0%, #2b6fb8 45%, #2659b3 100%);
  --gipf-piece-size: 7.5cqw;
}

.retro-match-replay--gipf .retro-match-replay__grid,
.retro-match-replay--gipf .retro-match-replay__cells,
.retro-match-replay--gipf .retro-match-replay__axis-labels {
  position: absolute;
  inset: 0;
  transform: rotate(var(--gipf-board-rotation));
  transform-origin: 50% 50%;
  z-index: 1;
}

.retro-match-replay--gipf .retro-match-replay__grid {
  pointer-events: none;
}

.retro-match-replay--gipf .retro-match-replay__grid line {
  stroke: rgba(35, 28, 20, 0.5);
  stroke-width: 0.35;
}

.retro-match-replay--gipf .retro-match-replay__playable-area {
  fill: #d5daee;
}

.retro-match-replay--gipf .retro-match-replay__node {
  fill: rgba(52, 39, 24, 0.18);
}

.retro-match-replay--gipf .retro-match-replay__node--outer {
  fill: #22190f;
}

.retro-match-replay--gipf .retro-match-replay__axis-label {
  position: absolute;
  width: 0;
  height: 0;
  transform: rotate(var(--gipf-label-counter-rotation));
  pointer-events: none;
}

.retro-match-replay--gipf .retro-match-replay__axis-label-text {
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--retro-sans);
  font-size: clamp(0.34rem, 1.05cqw, 0.58rem);
  line-height: 1;
  letter-spacing: 0.01em;
  color: rgba(34, 25, 15, 0.72);
  white-space: nowrap;
}

.retro-match-replay--gipf .retro-match-replay__axis-label--outer .retro-match-replay__axis-label-text {
  color: #22190f;
  font-weight: 700;
  font-size: 1.2rem;
}

.retro-match-replay--gipf .retro-match-replay__axis-label--top .retro-match-replay__axis-label-text {
  transform: translate(-50%, calc(-100% - 1rem));
}

.retro-match-replay--gipf .retro-match-replay__axis-label--bottom .retro-match-replay__axis-label-text {
  transform: translate(-50%, 1rem);
}

.retro-match-replay--gipf .retro-match-replay__cell {
  position: absolute;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
}

/* Outer entry hit targets — only interactive in explore mode */
.retro-match-replay--gipf .retro-match-replay__cell--outer {
  width: var(--gipf-piece-size);
  height: var(--gipf-piece-size);
  pointer-events: none;
  border-radius: 50%;
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell--outer.is-legal-entry,
.retro-match-replay--gipf.is-exploring .retro-match-replay__cell--outer.is-selected {
  pointer-events: auto;
  cursor: pointer;
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell.is-legal-dest {
  cursor: pointer;
}

/* Hit target for zero-size playable cells */
.retro-match-replay--gipf.is-exploring .retro-match-replay__cell.is-legal-dest::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: var(--gipf-piece-size);
  height: var(--gipf-piece-size);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: auto;
  z-index: 4;
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell.is-legal-dest::after,
.retro-match-replay--gipf.is-exploring .retro-match-replay__cell--outer.is-legal-entry::after,
.retro-match-replay--gipf.is-exploring .retro-match-replay__cell--outer.is-selected::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: var(--gipf-piece-size);
  height: var(--gipf-piece-size);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 3;
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell--outer.is-legal-entry::after,
.retro-match-replay--gipf.is-exploring .retro-match-replay__cell--outer.is-selected::after {
  transform: none;
}
.retro-match-replay--gipf.is-exploring .retro-match-replay__cell--outer.is-legal-entry::after {
  background: rgba(255, 236, 140, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 220, 80, 0.9);
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell--outer.is-selected::after {
  background: rgba(255, 210, 60, 0.75);
  box-shadow: 0 0 0 3px rgba(255, 190, 20, 1);
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell.is-legal-dest::after {
  background: rgba(120, 230, 160, 0.45);
  box-shadow: 0 0 0 2px rgba(60, 190, 110, 0.95);
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell.is-forced {
  cursor: pointer;
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell.is-forced::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: var(--gipf-piece-size);
  height: var(--gipf-piece-size);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: auto;
  z-index: 4;
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell.is-forced::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: var(--gipf-piece-size);
  height: var(--gipf-piece-size);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 3;
  background: rgba(255, 170, 80, 0.35);
  box-shadow: 0 0 0 2px rgba(230, 130, 40, 0.9);
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell.is-must-remove::after {
  background: rgba(230, 90, 70, 0.45);
  box-shadow: 0 0 0 2px rgba(200, 50, 40, 0.95);
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell.is-gipf-keep::after {
  background: rgba(120, 180, 255, 0.35);
  box-shadow: 0 0 0 2px rgba(70, 140, 230, 0.95);
}

.retro-match-replay--gipf.is-exploring .retro-match-replay__cell.is-gipf-remove::after {
  background: rgba(230, 90, 70, 0.5);
  box-shadow: 0 0 0 2px rgba(200, 50, 40, 0.95);
}

.retro-match-replay--gipf .retro-match-replay__piece {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--gipf-piece-size);
  height: var(--gipf-piece-size);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  border: 2px solid #1a1a1a;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.24) inset,
    0 0.18rem 0.45rem rgba(27, 18, 9, 0.22);
}

.retro-match-replay--gipf .retro-match-replay__piece--w {
  background: linear-gradient(180deg, #fffdfa 0%, #e9dcc3 100%);
}

.retro-match-replay--gipf .retro-match-replay__piece--b {
  background: linear-gradient(180deg, #47423d 0%, #181716 100%);
  border-color: #d9d1c7;
}

.retro-match-replay--gipf .retro-match-replay__piece--gipf::before
{
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  box-sizing: border-box;
}

.retro-match-replay--gipf .retro-match-replay__piece--gipf::before {
  width: 65%;
  height: 65%;
  border: 0.35rem solid currentColor;
}

.retro-match-replay--gipf .retro-match-replay__piece--w.retro-match-replay__piece--gipf {
  color: #9d7b43;
}

.retro-match-replay--gipf .retro-match-replay__piece--b.retro-match-replay__piece--gipf {
  color: #cdc3b8;
}

.retro-match-replay--gipf .retro-match-replay__reserve,
.retro-match-replay--gipf .retro-match-replay__captured {
  position: absolute;
  z-index: 2;
  width: var(--gipf-piece-size);
  height: var(--gipf-piece-size);
  pointer-events: auto;
  cursor: help;
}

.retro-match-replay--gipf .retro-match-replay__reserve--b {
  top: 3.5%;
  left: 3.5%;
}

.retro-match-replay--gipf .retro-match-replay__captured--w {
  top: calc(3.5% + var(--gipf-piece-size) + 1.4%);
  left: 3.5%;
}

.retro-match-replay--gipf .retro-match-replay__reserve--w {
  right: 3.5%;
  bottom: 3.5%;
}

.retro-match-replay--gipf .retro-match-replay__captured--b {
  right: 3.5%;
  bottom: calc(3.5% + var(--gipf-piece-size) + 1.4%);
}

.retro-match-replay--gipf .retro-match-replay__piece--stock {
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.retro-match-replay--gipf .retro-match-replay__piece--faded {
  opacity: 0.42;
}

.retro-match-replay--gipf .retro-match-replay__stock-count {
  font-family: var(--retro-sans);
  font-weight: 700;
  font-size: 3.1cqw;
  line-height: 1;
}

.retro-match-replay--gipf .retro-match-replay__piece--w .retro-match-replay__stock-count {
  color: #1c1712;
}

.retro-match-replay--gipf .retro-match-replay__piece--b .retro-match-replay__stock-count {
  color: #f3ece2;
}

@media (max-width: 720px) {
  .retro-match-replay--gipf .retro-match-replay__axis-label-text {
    font-size: 0.42rem;
  }
  .retro-match-replay--gipf .retro-match-replay__axis-label--outer .retro-match-replay__axis-label-text {
    font-size: 0.8rem;
  }
  .retro-match-replay--gipf .retro-match-replay__axis-label--top .retro-match-replay__axis-label-text {
    transform: translate(-50%, calc(-100% - 0.7rem));
  }
  
  .retro-match-replay--gipf .retro-match-replay__axis-label--bottom .retro-match-replay__axis-label-text {
    transform: translate(-50%, 0.7rem);
  }
  
  .retro-match-replay--gipf .retro-match-replay__piece--gipf::before {
    border: 0.2rem solid currentColor;
  }
  
}

@media print {
  .retro-match-replay--gipf .retro-match-replay__board-host {
    max-width: min(100%, 520px);
    margin-inline: auto;
  }
}
