/* ===================== CW END SCREEN — LAYOUT & STYLES ===================== */

/* End-screen: centrowanie i rozmiar jak board */
.cw-end-root,
.cw-end-wrap {
  display: grid;
  place-items: center;          /* center.center */
  min-height: 0;
}

.cw-end-stage {
  position: relative;
  width: var(--cw-board-w, auto);
  height: var(--cw-board-h, auto);
  margin: 0 auto;               /* poziomy center */
}

.cw-end-board {
  display: block;
  width: var(--cw-board-w, auto);
  height: var(--cw-board-h, auto);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;          /* nie rozciągaj, zachowaj proporcje */
  object-position: center center;
  image-rendering: auto;
}

/* MA BYĆ (dopasowane do klas z JS) */
.cw-end-wrap.cw-end-buttons-layout-row .cw-end-actions { flex-direction: row;  justify-content: center; }
.cw-btn { -webkit-tap-highlight-color: transparent; min-height: 40px; }


/* cw-end-flat.css — płaski wygląd ekranu końca gry */
.cw-end--flat {
  --cw-accent: #d4b07a;
  --cw-text: #222;
  --cw-muted: #666;
  --cw-end-overlay-opacity: 0.15; /* nadpisywane z JS */
  --cw-end-font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
/* Teksty/panel na end-screen (proste, responsywne) */
.cw-end-title {
  font-family: var(--cw-end-font-family, system-ui, -apple-system, Segoe UI, Roboto, sans-serif);
  font-weight: 800;
  font-size: clamp(18px, 4vw, 28px);
  margin: 8px 0 4px 0;
  text-align: center;
  color: var(--cw-text, #222);
}
.cw-end-big-result {
  font-weight: 800;
  font-size: clamp(36px, 14vw, 96px);
  line-height: 1;
  opacity: .2;
  margin: 4px 0 8px 0;
  text-align: center;
}
.cw-end-who {
  font-weight: 700;
  font-size: clamp(16px, 3.5vw, 24px);
  text-align: center;
  color: var(--cw-text, #222);
  margin-bottom: 8px;
}
.cw-end-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.cw-end--flat .cw-title {
  font-family: var(--cw-end-font-family);
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin: 8px 0 16px 0;
  color: var(--cw-text);
}

.cw-end--flat .cw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.cw-end--flat .cw-img {
  border: none;
  box-shadow: none;
}

/* ACTIONS: baza przycisków */
.cw-end-actions { display: flex; gap: 12px; margin-top: 16px; }

/* przycisk */
.cw-btn {
  appearance: none;
  display: inline-block;
  padding: 10px 16px;
  font-family: var(--cw-end-font-family);
  font-weight: 600;
  text-decoration: none;
  line-height: 1;
  border: 0;
  border-radius: 14px;
  color: #333;
  background: #fff;
  box-shadow: 0 15px 45px rgba(0,0,0,.06), inset 0 0 0 1px rgba(0,0,0,.06);
  transition: transform .12s ease, box-shadow .12s ease;
}
.cw-btn:hover { transform: translateY(-1px); box-shadow: 0 18px 55px rgba(0,0,0,.08), inset 0 0 0 1px rgba(0,0,0,.1); }
.cw-btn:active { transform: translateY(0); }

/* LAYOUT przycisków — zgodny z klasami dodawanymi w JS */
.cw-end-wrap.cw-end-buttons-layout-row    .cw-end-actions { flex-direction: row;  justify-content: center; }
.cw-end-wrap.cw-end-buttons-layout-col    .cw-end-actions { flex-direction: column; align-items: center; }
.cw-end-wrap.cw-end-buttons-layout-spread .cw-end-actions { justify-content: space-between; }

/* STYLE przycisków (warianty) */
.cw-end-wrap.cw-end-buttons-pill   .cw-btn { border-radius: 999px; }
.cw-end-wrap.cw-end-buttons-square .cw-btn { border-radius: 8px; }
.cw-end-wrap.cw-end-buttons-ghost  .cw-btn { background: transparent; box-shadow: none; border: 1px solid rgba(0,0,0,.12); }
.cw-end-wrap.cw-end-buttons-flat   .cw-btn { background: #f7f7f7; box-shadow: none; }

/* Delikatny glow (włączany klasą cw-end-glow z JS) */
.cw-end-wrap.cw-end-glow .cw-title { text-shadow: 0 1px 0 rgba(0,0,0,.04); }
.cw-end-wrap.cw-end-glow .cw-btn   { box-shadow: 0 15px 45px rgba(255,153,0,.18), inset 0 0 0 1px rgba(0,0,0,.06); }

/* Responsywka */
@media (max-width: 780px) {
  .cw-end--flat .cw-grid { grid-template-columns: 1fr; }
}

/* overlay: TYLKO gdy JS doda klasę .cw-end-overlay-on */
.cw-end-wrap::before {
  display: none;
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
.cw-end-wrap.cw-end-overlay-on::before {
  display: block;
  background: rgb(0 0 0 / var(--cw-end-overlay-opacity));
}

/* Tryb pozycjonowania absolutnego z kokpitu (pos.x / pos.y) */
.cw-end-actions.cw-actions-absolute {
  position: relative;   /* referencja dla absolutów */
  display: block;       /* wyłącz flex, pozwól absolute działać */
  width: 100%;
  min-height: 48px;     /* żeby box miał wysokość, gdy przycisk w środku */
}

/* overlay do body jest klikalny (na wszelki wypadek) */
.cw-end-fixed { pointer-events: auto; }
.cw-end-fixed .cw-btn { pointer-events: auto; }

/* Host centrowany + anty-styl z motywu dla IMG */
#cw-end-board {
  display: grid;
  place-items: center;
  margin: 0 auto;
}
#cw-end-board img.cw-end-board {
  position: static !important;   /* wyłącz legacy absolute */
  left: auto !important;
  top: auto !important;
  display: block;
  margin: 0 auto;
  max-width: none !important;    /* zbij motywowe max-width:100% */
  width: auto;                   /* JS ustawi px */
  height: auto;                  /* JS ustawi px */
  object-fit: contain;
  object-position: center center;
}

#cw-end-extra,
#cw-end-screen .cw-end-extra{
  background: transparent !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: none !important;
}




/* ========================================================================== */
