/* Presentation refinements for the existing after-hours pixel parlor. */

/* Card text carries the draw; the card's familiar frame and action remain. */
#card-modal #card-reveal .cr-name {
  font-size: clamp(32px, 4.2vw, 44px);
  line-height: 1.2;
  padding: 8px 10px;
}
@media (min-width: 2200px) {
  #card-modal #card-reveal .cr-name { font-size: 52px; }
}
#card-modal #card-reveal .cr-body { min-height: 0; }
#card-modal #card-reveal .cr-name { overflow-y: auto; overscroll-behavior: contain; }

/* The roll lands above the turn controls, in the board's open upper field. */
#view-game .dice-roll-total {
  top: 30%;
  font-size: clamp(108px, 20cqw, 280px);
  color: #a9e8ac;
  text-shadow: 0 5px 0 rgb(4 10 12 / 92%);
  -webkit-text-stroke: 1px #d3f3d4;
}
#view-game .dice-roll-total::before { content: ""; position: absolute; inset: -.14em -.2em; border: 2px solid #a9e8ac; opacity: 0; pointer-events: none; }
#view-game .dice-roll-total.is-visible::before { animation: dice-total-impact 650ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes dice-total-impact { 0% { opacity: 0; transform: scale(.72); } 20% { opacity: .85; transform: scale(1); } 100% { opacity: 0; transform: scale(1.3); } }
#view-game .dice-roll-total.is-visible { animation: dice-total-review 3000ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes dice-total-review {
  0% { opacity: 0; transform: translate(-50%, -38%) scale(.82); }
  8% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  14%, 88% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(1.025); }
}
@media (prefers-reduced-motion: reduce) {
  #view-game .dice-roll-total.is-visible { animation: none; opacity: 1; transform: translate(-50%, -50%); }
  #view-game .dice-roll-total::before { display: none; }
}

/* The one-shot ribbon lands the actual title before the persistent event detail. */
#view-game .global-event-ribbon {
  top: 16px;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 8px;
  width: min(980px, calc(100% - 28px));
  min-height: 132px;
  padding: 14px 22px;
  background: var(--surface-board-center);
  border: 1px solid var(--red-bright);
  box-shadow: 0 8px 22px rgb(0 0 0 / 45%);
}
#view-game .global-event-ribbon-label,
#view-game .global-event-ribbon-cue { font-size: 11px; text-align: center; }
#view-game .global-event-ribbon-title {
  width: 100%;
  max-height: none;
  font-size: clamp(32px, 4vw, 62px);
  line-height: 1.05;
  text-align: center;
  color: var(--red-bright);
  text-shadow: 0 3px 0 rgb(4 10 12 / 92%);
  text-transform: uppercase;
  white-space: normal;
  overflow-wrap: anywhere;
}
#view-game .global-event-ribbon.is-visible { animation-duration: 360ms; }

/* Warning details use more of the board center while staying clear of the HUD. */
#view-game .global-event-banner[data-phase="warning"] {
  width: min(980px, calc(100% - 32px));
  gap: 12px;
  padding: 16px clamp(16px, 2vw, 28px);
  border-top-width: 3px;
}
#view-game #global-event-banner[data-phase="warning"] #global-event-title {
  font-size: clamp(30px, 2.2vw, 48px);
  line-height: 1.15;
}
#view-game #global-event-banner[data-phase="warning"] #global-event-copy { font-size: clamp(15px, 1.1vw, 20px); line-height: 1.5; }
#view-game #global-event-banner[data-phase="warning"] #global-event-effects .global-event-effect { font-size: clamp(12px, .8vw, 15px); }
@media (max-height: 760px) and (max-width: 1399px) {
  #view-game .global-event-banner[data-phase="warning"] {
    max-height: 170px;
    overflow-y: auto;
    gap: 6px;
    padding: 8px 12px;
  }
  #view-game #global-event-banner[data-phase="warning"] #global-event-title { font-size: 22px; }
  #view-game #global-event-banner[data-phase="warning"] #global-event-copy { font-size: 14px; }
  #view-game #global-event-banner[data-phase="warning"] #global-event-effects .global-event-effect { font-size: 11px; }
  #view-game #global-event-banner[data-phase="warning"]:focus-visible { outline: 2px solid var(--theme-focus); outline-offset: 2px; }
}

/* Results use a true centered headline and consistent, full-width standings. */
#gameover-modal .choice-card { width: min(460px, calc(100vw - 32px)); max-width: 460px; }
#gameover-modal .bank-body { width: 100%; min-height: min(420px, calc(100dvh - 48px)); display: flex; flex-direction: column; }
#gameover-modal .bank-head { width: 100%; padding-inline: 0; text-align: center; }
#gameover-modal .bank-head > div { width: 100%; min-width: 0; }
#gameover-modal .go-name { display: block; width: 100%; text-align: center; overflow-wrap: anywhere; text-wrap: balance; }
#gameover-modal .go-summary { width: 100%; }
#gameover-modal .go-score-heading { text-align: right; margin: 14px 0 6px; }
#gameover-modal .go-score-details { margin-top: 12px; border-top: 1px solid var(--line-subtle); }
#gameover-modal .go-score-details > summary { padding-block: 10px; color: var(--gold-300); font: 11px/1.4 var(--font-pixel); cursor: pointer; }
#gameover-modal .go-score-details .go-score-heading { margin: 0 0 10px; text-align: left; }
#gameover-modal .go-final-scores { display: grid; gap: 8px; margin: 0; padding-bottom: 10px; }
#gameover-modal .go-final-scores > div { display: flex; justify-content: space-between; gap: 12px; }
#gameover-modal .go-final-scores dd { margin: 0; }
#gameover-modal #go-rematch-note { margin: 0; text-align: center; line-height: 1.4; }
#gameover-modal #go-rematch-note:empty { display: none; }
#gameover-modal .go-player { display: grid; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
#gameover-modal #go-end-reason { margin: 10px 0 0; font-size: 14px; }
#gameover-modal .go-actions { margin-top: auto; padding-top: 16px; }
#gameover-modal .go-summary-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  width: 100%;
  min-height: 56px;
  border-radius: 0;
  box-shadow: none;
}
#gameover-modal .go-summary-row > :nth-child(n + 3) { justify-self: end; white-space: nowrap; }
#gameover-modal .go-summary-row.is-winner { border-color: var(--gold-400); }
@media (max-width: 520px) {
  #gameover-modal .choice-card { width: min(100%, calc(100vw - 24px)); }
  #gameover-modal .go-summary-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  #gameover-modal .go-summary-row > :nth-child(3) { grid-column: 3; justify-self: end; }
}
