:root {
  color-scheme: dark;
  --bg: #110f0d;
  --panel: rgba(29, 22, 17, 0.9);
  --panel-strong: #241b15;
  --panel-soft: rgba(65, 48, 33, 0.72);
  --text: #f2f6fb;
  --muted: #cad2db;
  --brass: #d4a85f;
  --copper: #b46e43;
  --ember: #ef7d44;
  --steam: #9cc8d5;
  --line: rgba(246, 214, 160, 0.14);
  --success: #78d39b;
  --danger: #ea7a74;
  --shadow: rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Atkinson Hyperlegible", "Segoe UI", "Trebuchet MS", "Verdana", sans-serif;
  font-size: 17px;
  color: var(--text);
  /* background:
    radial-gradient(circle at 50% 0%, rgba(180, 193, 203, 0.16), transparent 28%),
    radial-gradient(circle at 18% 18%, rgba(235, 241, 246, 0.11), transparent 18%),
    radial-gradient(circle at 84% 16%, rgba(224, 229, 234, 0.08), transparent 20%),
    radial-gradient(circle at 50% 52%, rgba(104, 114, 123, 0.18), transparent 26%),
    linear-gradient(180deg, #14181d 0%, #0f1317 42%, #090c0f 100%); */
}

.skip-link {
  position: absolute;
  left: 14px;
  top: -48px;
  z-index: 40;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, #e6b463 0%, #a45e2c 100%);
  color: #2a160c;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.34);
  transition: top 130ms ease;
}

.skip-link:focus-visible {
  top: 10px;
  outline: 2px solid rgba(210, 233, 248, 0.95);
  outline-offset: 2px;
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 15% 24%, rgba(222, 228, 234, 0.18), transparent 0 18%, rgba(222, 228, 234, 0.06) 18% 22%, transparent 22% 100%),
    radial-gradient(circle at 82% 20%, rgba(222, 228, 234, 0.15), transparent 0 16%, rgba(222, 228, 234, 0.05) 16% 20%, transparent 20% 100%),
    radial-gradient(circle at 50% 30%, rgba(222, 228, 234, 0.08), transparent 0 12%, rgba(222, 228, 234, 0.03) 12% 16%, transparent 16% 100%),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at center, transparent 0 58%, rgba(0, 0, 0, 0.3) 100%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 56px 56px, 56px 56px, cover;
  opacity: 0.52;
  filter: blur(0.3px);
}

.app-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 30px;
  position: relative;
}

.hero {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.eyebrow,
.section-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--steam);
  font-size: 0.72rem;
}

h1,
h2 {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(2.0rem, 4vw, 3.6rem);
  line-height: 0.95;
  color: #fff2d6;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

h2 {
  font-size: 1.45rem;
}

.puzzle-status {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.yesterday-solution {
  margin: 4px 0 0;
  color: #f2f6fb;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.subtitle {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.psa-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}

.psa-banner[hidden] {
  display: none;
}

.psa-banner-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.psa-banner-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--steam);
  font-size: 0.68rem;
}

.psa-banner-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.psa-banner-title {
  color: var(--brass);
  font-weight: 700;
  font-size: 0.98rem;
  text-decoration: none;
}

.psa-banner-title:hover {
  text-decoration: underline;
}

.psa-banner-summary {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.psa-banner-dismiss {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.psa-banner-dismiss:hover {
  color: var(--text);
  border-color: var(--brass);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.7fr) minmax(0, 1.3fr);
  gap: 20px;
}

.board-card,
.panel-card {
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(47, 56, 64, 0.92), rgba(18, 22, 27, 0.97)),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.04), transparent 45%);
  box-shadow:
    0 24px 80px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.board-card {
  padding: 18px;
}

.board-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
}

.board-tools {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 6px;
}

.board-tool-buttons {
  display: flex;
  gap: 8px;
}

.stats {
  display: flex;
  gap: 14px;
}

.stats div {
  min-width: 86px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(62, 72, 82, 0.94), rgba(31, 37, 44, 0.94));
  border: 1px solid rgba(205, 216, 226, 0.24);
  text-align: center;
}

.stats span {
  display: block;
  color: #e6edf4;
  font-size: 1.65rem;
  line-height: 1;
  font-weight: 700;
}

.stats small {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.board-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 14px;
  position: relative;
}

.board-wrap::before,
.board-wrap::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  pointer-events: none;
  opacity: 0.42;
  background: url("assets/gear-ornament.svg") center / contain no-repeat;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35));
}

.board-wrap::before {
  left: 8px;
  top: -8px;
}

.board-wrap::after {
  right: 8px;
  bottom: -4px;
  transform: rotate(17deg);
}

/* Hidden easter-egg anchor: puffs of steam rise from here, centered on the
   gear ornament above (::after is a 160x160 box at right:8px/bottom:-4px,
   so its center sits at right:88px/bottom:76px) when triggered. A real
   element rather than a pseudo-element specifically so JS can
   append/remove puff children from it. */
.steam-vent-anchor {
  position: absolute;
  right: 88px;
  bottom: 76px;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.steam-puff {
  position: absolute;
  left: 0;
  top: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%,
      rgba(255, 255, 255, 0.9),
      rgba(210, 218, 224, 0.55) 45%,
      rgba(180, 190, 198, 0.15) 75%,
      transparent 100%);
  opacity: 0;
  animation: steam-puff-rise 1.6s ease-out forwards;
  pointer-events: none;
}

@keyframes steam-puff-rise {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
  }

  15% {
    opacity: 0.9;
    transform: translate(calc(var(--puff-drift-x, 10px) * 0.2), -14px) scale(0.9);
  }

  55% {
    opacity: 0.75;
  }

  100% {
    opacity: 0;
    transform: translate(var(--puff-drift-x, 10px), -92px) scale(1.9);
  }
}

body.reduce-motion .steam-puff {
  animation: none;
  opacity: 0;
}

.board-frame {
  width: min(100%, 680px);
  aspect-ratio: 1;
  position: relative;
  border-radius: 38px;
  container-type: inline-size;
  background:
    radial-gradient(circle at center, rgba(232, 239, 245, 0.08), transparent 42%),
    linear-gradient(145deg, rgba(72, 81, 90, 0.94), rgba(19, 24, 29, 0.99));
  border: 1px solid rgba(255, 226, 167, 0.18);
  box-shadow:
    inset 0 0 0 8px rgba(10, 8, 7, 0.6),
    inset 0 0 40px rgba(0, 0, 0, 0.25),
    0 20px 50px rgba(0, 0, 0, 0.45);
}

.board {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.board-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

.board-pipe-shell,
.board-pipe-core,
.board-pipe-highlight {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.board-pipe-shell {
  stroke: rgba(48, 56, 63, 0.96);
  stroke-width: 10;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.38));
}

.board-pipe-core {
  stroke: rgba(141, 153, 164, 0.96);
  stroke-width: 7;
  filter: drop-shadow(0 0 5px rgba(198, 211, 221, 0.2));
}

.board-pipe-highlight {
  stroke: rgba(228, 235, 241, 0.74);
  stroke-width: 2;
  stroke-dasharray: 18 26;
  filter: drop-shadow(0 0 2px rgba(245, 248, 250, 0.24));
}

.board-pipe-joint-shell {
  fill: rgba(41, 48, 54, 0.96);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.board-pipe-joint-core {
  fill: rgba(160, 170, 179, 0.98);
  stroke: rgba(221, 229, 235, 0.62);
  stroke-width: 1.1;
}

.board-pipe-valve-lines {
  fill: none;
  stroke: rgba(37, 44, 50, 0.9);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.board-pipe-valve-core {
  fill: rgba(205, 214, 221, 0.92);
  stroke: rgba(80, 88, 96, 0.56);
  stroke-width: 0.8;
}

.board-pipe-arrow {
  fill: rgba(220, 228, 234, 0.84);
  filter: drop-shadow(0 0 2px rgba(244, 247, 250, 0.28));
}

.board-pipe-live {
  animation: pipe-live-pulse 1s ease-in-out infinite;
}

.board-pipe-arrow-live {
  transform-box: fill-box;
  transform-origin: center;
  animation: pipe-arrow-pulse 900ms ease-in-out infinite;
}

@keyframes pipe-live-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 5px rgba(198, 211, 221, 0.22));
    opacity: 1;
  }

  50% {
    filter: drop-shadow(0 0 8px rgba(233, 240, 245, 0.45));
    opacity: 0.92;
  }
}

@keyframes pipe-arrow-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.82;
  }

  50% {
    transform: scale(1.18);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .board-pipe-live,
  .board-pipe-arrow-live {
    animation: none;
  }
}

body.reduce-motion .board-pipe-live,
body.reduce-motion .board-pipe-arrow-live {
  animation: none;
}

body.reduce-motion .tile-letter,
body.reduce-motion button {
  transition: none;
}

body.reduce-motion .tile-letter.invalid-flash {
  animation: none;
}

.side {
  position: absolute;
  display: flex;
  gap: 12px;
}

.side-top,
.side-bottom {
  left: 50%;
  transform: translateX(-50%);
}

.side-top {
  top: 32px;
}

.side-bottom {
  bottom: 32px;
}

.side-left,
.side-right {
  top: 50%;
  flex-direction: column;
  transform: translateY(-50%);
}

.side-left {
  left: 32px;
}

.side-right {
  right: 32px;
}

.side-left .tile,
.side-right .tile {
  display: flex;
  align-items: center;
}

.side-left .tile {
  flex-direction: row-reverse;
}

.side-right .tile {
  flex-direction: row;
}

.tile {
  position: relative;
  width: 102px;
  height: 84px;
}

.tile-letter {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 232, 192, 0.32);
  border-radius: 20px;
  background: url("assets/tank-silver.svg") center / cover no-repeat;
  color: #1c1713;
  font-family: inherit;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  box-shadow:
    0 12px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(45, 26, 16, 0.5);
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.tile-letter.used {
  background: url("assets/tank-patina.svg") center / cover no-repeat;
  color: #10211c;
  border-color: rgba(186, 235, 212, 0.62);
  border-style: dashed;
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 0 0 2px rgba(156, 200, 181, 0.32);
}

.tile-letter.active-letter {
  border-color: rgba(255, 239, 189, 0.88);
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 0 0 3px rgba(233, 193, 114, 0.42),
    0 0 18px rgba(239, 125, 68, 0.18);
  filter: brightness(1.06);
}

.tile-letter.invalid-flash {
  border-color: rgba(244, 122, 116, 0.95);
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 0 0 999px rgba(148, 33, 33, 0.22),
    0 0 0 3px rgba(241, 112, 106, 0.4),
    0 0 16px rgba(183, 42, 42, 0.32);
  animation: invalid-tank-flash 360ms ease-out;
}

@keyframes invalid-tank-flash {
  0% {
    transform: translateY(0);
    filter: brightness(1.12) saturate(1.1);
  }

  55% {
    transform: translateY(-1px);
    filter: brightness(1.18) saturate(1.15);
  }

  100% {
    transform: translateY(0);
    filter: brightness(1.02) saturate(1.02);
  }
}

.tile-letter.used::after {
  content: "\2713";
  position: absolute;
  top: 6px;
  right: 8px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(229, 246, 239, 0.65);
  background: rgba(18, 58, 45, 0.55);
  font-size: 0.8rem;
  font-weight: 800;
  color: rgba(229, 246, 239, 0.9);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.tile-letter.used::before {
  content: "";
  position: absolute;
  left: 9px;
  bottom: 8px;
  width: 28px;
  height: 8px;
  border-radius: 999px;
  background: repeating-linear-gradient(
    135deg,
    rgba(221, 245, 235, 0.96) 0 3px,
    rgba(58, 100, 86, 0.95) 3px 6px
  );
  box-shadow:
    0 0 0 1px rgba(212, 240, 229, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.tile-letter:hover,
button:hover {
  outline: none;
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.tile-letter:focus-visible,
button:focus-visible,
.board-input:focus-visible,
.help-close:focus-visible {
  outline: 2px solid rgba(210, 233, 248, 0.95);
  outline-offset: 2px;
  filter: brightness(1.08);
}

.tile-letter:active,
button:active {
  transform: translateY(1px) scale(0.98);
}

.tile-usage-badge,
.token-multiplier {
  position: absolute;
  border-radius: 999px;
  border: 1px solid rgba(255, 237, 204, 0.28);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 24%),
    linear-gradient(180deg, #d9b067 0%, #9a5b32 100%);
  color: #2d160d;
  font-weight: 700;
  place-items: center;
  box-shadow:
    0 8px 12px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.token-multiplier {
  display: grid;
}

/* Decorative reuse-count badge, not a control — hidden until a letter has
   actually been used 2+ times (accepted words plus the word in progress). */
.tile-usage-badge {
  display: none;
  right: -7px;
  bottom: -7px;
  width: 26px;
  height: 26px;
  font-size: 0.62rem;
  opacity: 0.82;
  pointer-events: none;
}

.tile-usage-badge.tile-usage-badge-visible {
  display: grid;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.puzzle-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.puzzle-nav-arrow {
  width: 42px;
  min-width: 42px;
  padding: 12px 0;
  font-weight: 700;
  font-size: 1rem;
}

.today-puzzle-btn {
  padding: 12px 14px;
  font-size: 0.9rem;
  white-space: nowrap;
}

#submitBtn {
  margin-left: auto;
}

button {
  border: 0;
  border-radius: 16px;
  font: inherit;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.primary,
.secondary {
  padding: 14px 18px;
  color: var(--text);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.24);
}

.primary {
  background: linear-gradient(180deg, #e6b463 0%, #a45e2c 100%);
  color: #2a160c;
  font-weight: 700;
}

.secondary {
  background: linear-gradient(180deg, #413126 0%, #2c2119 100%);
  border: 1px solid rgba(255, 226, 167, 0.12);
}

.help-btn {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.84rem;
  color: var(--steam);
  background: linear-gradient(180deg, rgba(53, 40, 30, 0.95), rgba(28, 21, 16, 0.96));
  border: 1px solid rgba(156, 200, 213, 0.3);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.24);
}

.panel {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
}

.panel-art-wrap {
  position: relative;
  min-height: 120px;
}

.panel-art {
  position: relative;
  min-height: 0;
  height: 100%;
  pointer-events: none;
}

/* Sibling of .panel-art (not nested inside it) on purpose -- .panel-art's
   own innerHTML is fully replaced whenever the pipe-bearing easter egg
   (re)initializes, which would silently wipe this out if it lived inside
   that same container. */
.campaign-card {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 168px;
  padding: 10px 30px 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(36, 27, 21, 0.94), rgba(20, 15, 11, 0.97));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  text-decoration: none;
}

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

.campaign-card-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--steam);
  font-size: 0.62rem;
}

.campaign-card-headline {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}

.campaign-card-cta {
  color: var(--brass);
  font-size: 0.74rem;
  font-weight: 700;
}

.campaign-card:hover .campaign-card-headline {
  text-decoration: underline;
}

.campaign-card-dismiss {
  position: absolute;
  top: 4px;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}

.campaign-card-dismiss:hover {
  color: var(--text);
}

/* The pipe-manifold artwork is fetched and injected inline (rather than a
   CSS background-image) specifically so the easter-egg ball bearing can
   travel along its actual path data in the same coordinate space —
   guaranteeing alignment instead of trying to replicate background-size
   math in a separate overlay. */
.panel-art svg {
  display: block;
  width: min(85%, 320px);
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

.panel-art .pipe-manifold-art {
  opacity: 0.22;
}

.panel-art-ball-bearing {
  opacity: 0;
}

.panel-card {
  padding: 18px;
}

.word-card {
  padding-left: 10px;
  padding-right: 10px;
}

.current-word {
  min-height: 78px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  padding: 10px 8px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(19, 15, 12, 0.88), rgba(36, 27, 21, 0.72));
  border: 1px solid rgba(255, 226, 167, 0.12);
  margin: 12px 0 10px;
}

.current-word.empty {
  color: rgba(243, 230, 200, 0.55);
}

.token {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 44px;
  padding: 10px 7px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(227, 232, 236, 0.98), rgba(138, 149, 159, 0.96));
  color: #1d2329;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.token-repeat-second {
  border: 1px solid rgba(118, 134, 146, 0.45);
}

.token-multiplier {
  right: -5px;
  bottom: -5px;
  width: 16px;
  height: 16px;
  font-size: 0.5rem;
  letter-spacing: 0;
  opacity: 0.9;
  pointer-events: none;
}

.message {
  min-height: 1.4em;
  color: var(--muted);
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--danger);
}

.validation-source {
  min-height: 1.2em;
  margin: 6px 0 0;
  color: rgba(213, 224, 232, 0.78);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.validation-source:empty {
  display: none;
}

.letter-count-stat {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  margin: 8px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(212, 168, 95, 0.16);
  border: 1px solid rgba(212, 168, 95, 0.5);
  color: var(--brass);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  font-weight: 700;
}

.mode-badge[hidden] {
  display: none;
}

/* Kiosk/attract-mode: a stray tap or click during the demo loop shouldn't
   be able to append a letter or press a control mid-replay — the loop
   already fully resets on its next cycle, but disabling interaction here
   avoids a visibly janky half-corrupted board in the meantime. Only
   keyboard input is meant to end the loop (see stopArcadeMode in app.js). */
body.arcade-mode #board,
body.arcade-mode .controls,
body.arcade-mode .board-tools {
  pointer-events: none;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.found-words {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.word-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(227, 232, 236, 0.96), rgba(138, 149, 159, 0.94));
  border: 1px solid rgba(222, 230, 236, 0.3);
  color: #1d2329;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.word-pill-label {
  font-size: 1.15em;
}

.word-pill-source {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  border-radius: 999px;
  background: rgba(30, 42, 53, 0.16);
  border: 1px solid rgba(43, 63, 80, 0.16);
  color: #2b3f50;
}

.word-pill-source-glyph {
  flex-shrink: 0;
}

.word-pill-source-glyph-cover {
  fill: rgba(255, 255, 255, 0.6);
  stroke: currentColor;
  stroke-width: 1.1;
}

.word-pill-source-glyph-spine {
  fill: currentColor;
  opacity: 0.6;
}

.word-pill-source-glyph-text {
  fill: currentColor;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 800;
}

.help-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 5, 4, 0.64);
  z-index: 20;
}

.help-modal[hidden] {
  display: none !important;
}

.help-dialog {
  width: min(560px, 100%);
  border-radius: 20px;
  border: 1px solid rgba(255, 226, 167, 0.18);
  background: linear-gradient(180deg, rgba(43, 33, 25, 0.98), rgba(19, 15, 12, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  padding: 18px;
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.help-close {
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #413126 0%, #2c2119 100%);
  border: 1px solid rgba(255, 226, 167, 0.12);
  color: var(--text);
}

.help-copy {
  margin: 0 0 10px;
  color: var(--muted);
}

.help-copy a {
  color: var(--brass);
}

.help-copy a:hover,
.help-copy a:focus-visible {
  color: var(--ember);
}

.help-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  color: var(--text);
}

.help-actions {
  margin-top: 14px;
  display: flex;
  justify-content: end;
}

.settings-option {
  border: 1px solid rgba(205, 216, 226, 0.24);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(36, 44, 51, 0.9), rgba(24, 29, 34, 0.9));
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
}

.settings-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #7ea694;
}

.board-input-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: center;
}

.board-input-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.board-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 226, 167, 0.2);
  background: linear-gradient(180deg, rgba(28, 21, 16, 0.95), rgba(19, 15, 12, 0.95));
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.board-paste {
  margin-top: 6px;
  resize: vertical;
  min-height: 86px;
  text-transform: none;
  letter-spacing: 0;
}

.board-paste-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.board-input:focus-visible {
  outline: 1px solid rgba(156, 200, 213, 0.6);
  outline-offset: 1px;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .board-card {
    order: 1;
  }

  .panel {
    order: 2;
  }

  .panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-art {
    display: none;
  }

  /* The decorative pipe artwork doesn't fit this narrower layout, but the
     campaign card is real content, not decoration -- keep it, as its own
     full-width row rather than depending on panel-art's height. */
  .panel-art-wrap {
    grid-column: 1 / -1;
    min-height: 0;
  }

  .campaign-card {
    position: static;
    width: auto;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100vw - 20px, 1280px);
    padding-top: 10px;
    padding-bottom: 20px;
  }

  .hero {
    margin-bottom: 6px;
  }

  .board-card {
    padding: 14px;
  }

  .board-header {
    margin-bottom: 8px;
  }

  .board-wrap {
    padding: 6px 0 10px;
  }

  .board-card,
  .panel-card {
    border-radius: 22px;
  }

  .board-frame {
    width: 100%;
  }

  .tile {
    width: 86px;
    height: 72px;
  }

  .tile-letter {
    font-size: 1.6rem;
  }

  .tile-usage-badge {
    right: -6px;
    bottom: -6px;
    width: 26px;
    height: 26px;
  }

  .side-top,
  .side-bottom {
    gap: 8px;
  }

  .side-left,
  .side-right {
    gap: 8px;
  }

  .side-top {
    top: 28px;
  }

  .side-bottom {
    bottom: 28px;
  }

  .side-left {
    left: 24px;
  }

  .side-right {
    right: 24px;
  }

  .panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .app-shell {
    width: calc(100vw - 16px);
  }

  .board-card {
    padding: 12px;
  }

  .board-wrap::before,
  .board-wrap::after {
    display: none;
  }

  .psa-banner {
    flex-direction: column;
    padding: 12px 14px;
  }

  .psa-banner-dismiss {
    align-self: flex-end;
    margin-top: -6px;
  }
}

/* Scale tiles relative to the board frame width so corners never collide.
   17cqw × 3 tiles + 2cqw × 2 gaps = 55cqw row width, centred starts at 22.5cqw.
   Left column ends at 2.5cqw + 17cqw = 19.5cqw — no overlap. */
@container (max-width: 500px) {
  .tile {
    width: 17cqw;
    height: 14cqw;
  }

  .tile-letter {
    font-size: 6cqw;
    border-radius: 3.5cqw;
  }

  .tile-usage-badge {
    width: 5cqw;
    height: 5cqw;
    font-size: 1.7cqw;
    right: -1.7cqw;
    bottom: -1.7cqw;
  }

  .side-top {
    top: 2.5cqw;
    gap: 2cqw;
  }

  .side-bottom {
    bottom: 2.5cqw;
    gap: 2cqw;
  }

  .side-left {
    left: 2.5cqw;
    gap: 1.5cqw;
  }

  .side-right {
    right: 2.5cqw;
    gap: 1.5cqw;
  }
}