/* WordRails finished-game screen.

   Everything here is scoped to .post-game (plus the game-content wrapper) so
   the live play screen is untouched. The wrapper is display: contents while
   live, so its children keep the existing flex/grid placement; the finished
   screen instead lays itself out and spans both columns in short landscape. */

.game > .game-content { display: contents; }
.game-page:has(.post-game) .site-main { max-width: 1000px; }
.game:has(.post-game) { width: min(100%, 960px); }

.post-game {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- result banner ------------------------------------------------------- */

.post-game__banner {
  display: grid;
  grid-template-columns: auto minmax(0, auto);
  justify-content: center;
  align-items: center;
  column-gap: 1.2rem;
  row-gap: .15rem;
  padding: 1.05rem 1.2rem 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid #b3dcc7;
  background: linear-gradient(#eaf8f1, #d9efe4);
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #b3dcc7;
  text-align: center;
  color: #17574a;
}

.post-game__emblem {
  grid-column: 1;
  grid-row: 1 / 4;
  font-size: 3.4rem;
  line-height: 1;
  color: #2f7d68;
}

/* A win earns the gold trophy; the other outcomes keep a calm teal mark. */
.post-game__banner--win .post-game__emblem { color: var(--gold); }

.post-game__banner-title {
  grid-column: 2;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 850;
  line-height: 1.15;
}

.post-game__banner-sub {
  grid-column: 2;
  font-size: 1.05rem;
  font-weight: 700;
  color: #2f6d5d;
}

.post-game__banner-reason {
  grid-column: 2;
  font-size: 0.92rem;
  color: #4c7d70;
}

/* --- score cards --------------------------------------------------------- */

.post-game__scores {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.post-game__card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .15rem .75rem;
  min-width: 0;
  padding: 0.85rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  text-align: left;
}

.post-game__card--winner { background: #dcefe3; border-color: #92c6aa; }
.post-game__card--challenger { background: #f5e8e2; border-color: #e0b4a6; }

.post-game__avatar {
  display: grid;
  place-items: center;
  grid-row: 1 / 3;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: #fffdf6;
  font-size: 1.4rem;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

.post-game__card-name {
  min-width: 0;
  font-size: 1rem;
  font-weight: 750;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.post-game__card-score {
  grid-column: 2;
  font-size: 2.5rem;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.post-game__card--winner .post-game__card-score { color: #17574a; }
.post-game__card--challenger .post-game__card-score { color: #a2543f; }

/* --- board + highlights -------------------------------------------------- */

.post-game__body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.post-game__board { min-width: 0; }

/* The live board is placed into grid cells by the landscape media query; inside
   the finished screen it is an ordinary block, so drop that inherited
   placement and the play-screen bottom margin. */
.post-game .board-region {
  grid-area: auto;
  width: 100%;
  min-width: 0;
  margin: 0;
}

.post-game__highlights {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1rem 1.1rem 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.post-game__highlights-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink-soft);
  margin-bottom: 0.7rem;
}

.post-game__stats {
  display: grid;
  flex: 1;
  align-content: space-between;
  gap: 0.7rem;
  margin: 0;
}

.post-game__stat { display: grid; gap: 0.05rem; min-width: 0; }

.post-game__stat dt {
  font-size: 1rem;
  font-weight: 750;
  color: var(--ink-soft);
}

.post-game__stat dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.post-game__stat-value {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

.post-game__stat-note {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* --- actions ------------------------------------------------------------- */

.post-game__actions {
  display: grid;
  gap: 0.6rem;
}

.post-game__actions .game-rematch, .post-game__actions .game-rematch form { width: 100%; }

.post-game__actions .game-rematch__button {
  width: 100%;
  min-height: 52px;
  background: var(--plum);
  border-color: var(--plum-deep);
  color: #fff;
  font-size: 1.2rem;
}

.post-game__actions .game-rematch__button:hover:not(:disabled) { background: var(--plum-deep); }

.post-game__secondaries {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.post-game__secondary {
  width: 100%;
  min-height: 44px;
  gap: 0.45rem;
  text-align: center;
}

.post-game__secondary .fa-solid { color: var(--plum); }

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 700px) {
  .post-game__body { grid-template-columns: minmax(0, 1fr); }
  .post-game__card-score { font-size: 1.7rem; }
  .post-game__banner-title { font-size: 1.8rem; }
  .post-game__banner { padding: .85rem .6rem; column-gap: .65rem; }
  .post-game__emblem { font-size: 2.6rem; }
  .post-game__avatar { width: 2.25rem; height: 2.25rem; font-size: 1.2rem; }
  .post-game__card { gap: .15rem .4rem; }
}

@media (max-width: 380px) {
  .post-game__secondaries { grid-template-columns: minmax(0, 1fr); }
  .post-game__scores { gap: 0.5rem; }
  .post-game__card { padding: 0.7rem 0.45rem; }
  .post-game__card-name { font-size: 0.92rem; }
}

.post-game .board-tools { display: none; }
.post-game .board-scroll { width: 100%; }
.post-game #game-chat { margin: 0; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: #f3edde; }
.post-game #game-chat .game-chat__note { margin: 0; }
.post-game__avatar svg { width: 80%; height: 80%; }

.post-game__stat + .post-game__stat { border-top: 1px solid var(--line); padding-top: .7rem; }
