/* OCP-00513: projected stat changes (winner overlay; summary.html cards reuse these in OCP-00514). */
.eog-block {
  --eog-good: var(--brand-lime, #a6e600);
  --eog-bad: #ff5a5f;
  --eog-track: #2b2b2b;
  --eog-white: #f5f5f2;
  margin: 0 0 1rem;
  text-align: left;
}

.eog-heading {
  display: grid;
  gap: 0.1rem;
  margin: 0 0 0.7rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--surface-border, rgba(245, 245, 242, 0.14));
  text-align: center;
}

.eog-title {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.eog-subtitle {
  color: var(--muted, #bdbdb8);
  font-size: 0.82rem;
  font-weight: 700;
}

.eog-row {
  margin: 0 0 0.7rem;
}

.eog-row-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0 0 0.25rem;
}

.eog-label {
  font-size: 0.95rem;
  font-weight: 800;
}

.eog-value {
  font-size: 1.15rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.eog-change {
  min-width: 4.8rem;
  color: var(--muted, #bdbdb8);
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.eog-change[data-tone="good"] {
  color: var(--eog-good);
}

.eog-change[data-tone="bad"] {
  color: var(--eog-bad);
}

.eog-track {
  position: relative;
  height: 1rem;
  overflow: hidden;
  background: var(--eog-track);
  border-radius: 999px;
}

.eog-white,
.eog-delta {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
}

.eog-white {
  left: 0;
  z-index: 1;
  background: var(--eog-white);
}

.eog-delta {
  width: 0;
  opacity: 1;
  background: var(--eog-good);
}

.eog-row[data-tone="bad"] .eog-delta {
  background: var(--eog-bad);
}

/* Start states */
.eog-row[data-motion="none"] .eog-white {
  width: calc(var(--upd) * 1%);
}

.eog-row[data-motion="none"] .eog-delta {
  display: none;
}

.eog-row[data-motion="up"] .eog-white {
  width: calc(var(--prev) * 1%);
}

.eog-row[data-motion="up"] .eog-delta {
  left: calc(var(--prev) * 1%);
}

.eog-row[data-motion="down"] .eog-white {
  width: calc(var(--prev) * 1%);
}

.eog-row[data-motion="down"] .eog-delta {
  left: calc(var(--upd) * 1%);
  width: calc((var(--prev) - var(--upd)) * 1%);
}

/* Increase: a coloured segment grows from the old end, then the white bar extends over it. */
.eog-block.is-playing .eog-row[data-motion="up"] .eog-delta {
  width: calc((var(--upd) - var(--prev)) * 1%);
  transition: width 0.6s ease;
}

.eog-block.is-playing .eog-row[data-motion="up"] .eog-white {
  width: calc(var(--upd) * 1%);
  transition: width 0.5s ease 0.6s;
}

/* Decrease: the white bar retracts to show the lost part, which then fades away. */
.eog-block.is-playing .eog-row[data-motion="down"] .eog-white {
  width: calc(var(--upd) * 1%);
  transition: width 0.6s ease;
}

.eog-block.is-playing .eog-row[data-motion="down"] .eog-delta {
  opacity: 0;
  transition: opacity 0.5s ease 0.9s;
}

/* Shown at once: re-renders of a game that has already played, and reduced motion. */
.eog-block.is-done .eog-white,
.eog-block.is-done .eog-delta {
  transition: none !important;
}

.eog-block.is-done .eog-row[data-motion="up"] .eog-delta {
  width: 0;
}

@media (prefers-reduced-motion: reduce) {
  .eog-white,
  .eog-delta {
    transition: none !important;
  }
}

/* Winner overlay: a darker, blurred backdrop keeps attention on the result. It sits in front of
   the game header and the footer button rail (z-index 10) and behind any dialog opened from it. */
.win-overlay {
  z-index: 11;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* The card is taller with stats in it: scroll rather than push Finish game off a short screen. */
.win-card {
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-height: 560px) {
  .win-card .win-avatar {
    width: 4.5rem;
    height: 4.5rem;
    margin: 0.2rem auto 0.4rem;
    font-size: 1.2rem;
  }

  .win-card h2 {
    margin: 0.2rem 0 0.5rem;
    font-size: clamp(1.6rem, 6vw, 2.4rem);
  }

  .eog-heading {
    margin-bottom: 0.4rem;
    padding-top: 0.5rem;
  }

  .eog-row {
    margin-bottom: 0.45rem;
  }
}

body.winner-open .confirm-overlay,
body.winner-open .dialog-overlay {
  z-index: 12;
}

.win-card .win-stats {
  margin: 0 0 0.9rem;
}

/* Loading placeholder: same shape as the real rows, so nothing jumps when the numbers arrive. */
.eog-skel {
  display: block;
  background: rgba(245, 245, 242, 0.12);
  border-radius: 999px;
  animation: eog-skel-pulse 1.2s ease-in-out infinite;
}

.eog-skel-title {
  width: 11rem;
  height: 1.05rem;
  margin: 0 auto;
}

.eog-skel-subtitle {
  width: 7rem;
  height: 0.8rem;
  margin: 0.25rem auto 0;
}

.eog-skel-label {
  width: 7.5rem;
  height: 0.95rem;
}

.eog-skel-value {
  width: 4.2rem;
  height: 1.15rem;
}

.eog-skel-track {
  height: 1rem;
}

@keyframes eog-skel-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .eog-skel {
    animation: none;
    opacity: 0.7;
  }
}

.win-card .win-stats[hidden] {
  display: none;
}

.win-card h2 {
  margin-bottom: 0.7rem;
}

/* ---- summary.html: every player's card (OCP-00514) ---- */
.eog-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.eog-overlay[hidden] {
  display: none;
}

.eog-summary {
  width: min(72rem, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
  background: var(--panel-strong, #1b1b1b);
  border: 3px solid var(--brand-lime, #a6e600);
  border-radius: 10px;
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.5);
}

.eog-summary-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1rem;
}

.eog-summary-head .eog-avatar {
  width: 4.6rem;
  height: 4.6rem;
  font-size: 1.5rem;
}

.eog-summary-eyebrow {
  margin: 0;
  color: var(--brand-lime, #a6e600);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.eog-summary-headline {
  margin: 0.1rem 0 0;
  font-size: clamp(1.8rem, 4.2vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
}

.eog-wins {
  color: var(--brand-lime, #a6e600);
}

.eog-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16.5rem, 1fr));
  gap: 0.9rem;
}

.eog-card {
  padding: 0.9rem 1rem 0.3rem;
  background: rgba(245, 245, 242, 0.04);
  border: 1px solid rgba(245, 245, 242, 0.14);
  border-radius: 8px;
}

.eog-card.is-winner {
  border-color: rgba(166, 230, 0, 0.65);
}

.eog-card-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.2rem;
}

.eog-card-name {
  flex: 1;
  min-width: 0;
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.eog-winner-badge {
  padding: 0.2rem 0.8rem;
  background: var(--brand-lime, #a6e600);
  border-radius: 999px;
  color: #050505;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eog-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.8rem;
  height: 2.8rem;
  overflow: hidden;
  background: #2b2b2b;
  border: 2px solid rgba(245, 245, 242, 0.85);
  border-radius: 999px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
}

.eog-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eog-summary-footer {
  margin: 1rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(245, 245, 242, 0.14);
  text-align: center;
}

.eog-summary-note,
.eog-summary-status {
  margin: 0;
  color: var(--muted, #bdbdb8);
  font-size: 0.9rem;
}

.eog-summary-status {
  margin-top: 0.35rem;
  color: var(--brand-white, #f5f5f2);
  font-weight: 800;
}

.eog-dot {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.5rem;
  background: var(--brand-lime, #a6e600);
  border-radius: 999px;
  animation: eog-dot-pulse 1.4s ease-in-out infinite;
}

.eog-dot.is-confirmed {
  animation: none;
}

@keyframes eog-dot-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .eog-dot {
    animation: none;
  }
}

@media (max-width: 40rem) {
  .eog-summary {
    padding: 0.9rem;
  }

  .eog-summary-head .eog-avatar {
    width: 3.4rem;
    height: 3.4rem;
  }
}
