/*
 * Evidence Rush styles. Colours come only from --er-* role variables, which
 * evidence-rush.js maps to the page's brand tokens from CONFIG.colors.
 * Every block has a fixed size so the game never shifts the page layout.
 */

.er-frame {
  position: relative;
  display: grid;
  grid-template-rows: 4.5rem minmax(0, 1fr) 4.75rem;
  height: 28rem;
  overflow: hidden;
  border: 1px solid var(--er-lane);
  border-radius: 1.25rem;
  background: var(--er-surface);
  box-shadow: 0 1.5rem 4rem color-mix(in srgb, var(--er-ink) 8%, transparent);
  color: var(--er-ink);
  text-align: left;
  visibility: hidden;
  contain: layout paint;
  -webkit-tap-highlight-color: transparent;
}

.er.is-ready .er-frame {
  visibility: visible;
}

@media (min-width: 40rem) {
  .er-frame {
    height: 31rem;
  }
}

.er-keys {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .er-keys {
    display: block;
  }
}

/* HUD */

.er-hud {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--er-lane);
}

.er-meter {
  flex: 1;
  min-width: 0;
}

.er-meter-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 650;
}

.er-level {
  color: var(--er-accent);
  font-size: 1rem;
  font-weight: 750;
}

.er-meter-track {
  position: relative;
  height: 0.625rem;
  margin-top: 0.375rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--er-meter-track);
}

.er-meter-fill {
  position: absolute;
  inset: 0;
  background: var(--er-meter-fill);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s ease-out;
}

.er-meter-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--er-surface);
}

.er-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
  min-width: 6rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.er-stats strong {
  border-radius: 0.25rem;
  font-size: 1rem;
  transition: background-color 0.3s ease-out, color 0.3s ease-out, box-shadow 0.3s ease-out;
}

/* Brief inversion when points are deducted; box-shadow pads it without moving the text. */
.er-stats strong.is-penalty {
  background: var(--er-ink);
  box-shadow: 0 0 0 0.25rem var(--er-ink);
  color: var(--er-ink-on-fill);
  transition: none;
}

/* Playfield */

.er-stage {
  position: relative;
  min-height: 0;
}

.er-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.er-canvas:focus {
  outline: none;
}

.er-canvas:focus-visible {
  outline: 3px solid var(--er-accent);
  outline-offset: -3px;
}

/* Evidence tray */

.er-tray {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.625rem 0.75rem 0.75rem;
  border-top: 1px solid var(--er-lane);
}

.er-evidence {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.25rem;
  border: 2px solid var(--er-ink);
  border-radius: 0.75rem;
  background: var(--er-surface);
  color: var(--er-ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.1;
  cursor: pointer;
  touch-action: manipulation;
}

.er-evidence[data-available="false"] {
  visibility: hidden;
}

.er-evidence[aria-pressed="true"] {
  border-color: var(--er-accent);
  background: var(--er-accent);
  color: var(--er-ink-on-fill);
  box-shadow: 0 0 0 2px var(--er-surface), 0 0 0 4px var(--er-accent);
}

.er-evidence:focus-visible,
.er-btn:focus-visible {
  outline: 3px solid var(--er-accent);
  outline-offset: 3px;
}

.er-key {
  display: none;
  position: absolute;
  top: 0.2rem;
  right: 0.4rem;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 650;
}

@media (hover: hover) and (pointer: fine) {
  .er-key {
    display: block;
  }
}

.er-icon,
.er-glyph {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.er-icon {
  fill: var(--er-icon-fill);
  stroke: var(--er-icon-stroke);
}

.er-icon--decoy {
  fill: var(--er-decoy-badge);
  stroke: none;
}

.er-icon--decoy .er-decoy-mark {
  fill: none;
  stroke: var(--er-decoy-icon);
  stroke-width: 2;
}

.er-evidence[aria-pressed="true"] .er-icon {
  fill: var(--er-ink-on-fill);
  stroke: var(--er-ink-on-fill);
}

.er-glyph {
  fill: none;
  stroke: var(--er-ink);
}

/* Overlays: start, round title, pause and end */

.er-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem;
  overflow-y: auto;
  background: var(--er-surface);
  text-align: center;
}

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

.er-overlay h3 {
  margin: 0;
  color: var(--er-accent);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.er-overlay p {
  max-width: 30rem;
  margin: 0;
  color: var(--er-ink);
  font-size: 0.95rem;
  line-height: 1.5;
}

.er-overlay .er-kicker {
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.er-overlay .er-note {
  font-size: 0.8rem;
}

.er-legend,
.er-notes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  font-weight: 650;
}

.er-legend li,
.er-notes li {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.er-notes {
  flex-direction: column;
  align-items: flex-start;
  font-weight: 400;
  text-align: left;
}

.er-btn {
  min-height: 2.75rem;
  padding: 0.625rem 1.125rem;
  border: 2px solid var(--er-accent);
  border-radius: 999px;
  background: var(--er-surface);
  color: var(--er-accent);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.er-btn--primary {
  background: var(--er-accent);
  color: var(--er-ink-on-fill);
}

.er-statement-slot {
  width: 100%;
  max-width: 34rem;
}

.er-statement {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  border: 1px solid var(--er-lane);
  border-radius: 0.75rem;
}

.er-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.er-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .er-meter-fill,
  .er-stats strong {
    transition: none;
  }
}
