@import url("https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@500;600;700;800;900&family=Press+Start+2P&display=swap");


:root {
  --bg-deep: #0d0718;
  --bg-sky: #1b1035;
  --bg-sky-soft: #2d1e4f;
  --panel: #3a2862;
  --panel-mid: #2c1d4c;
  --panel-dark: #1b1230;
  --pixel-border: #09050f;
  --text-main: #fff4cf;
  --text-dim: #d6c9ff;
  --ghost-blue: #69e5ff;
  --slime-green: #8be25b;
  --fire-orange: #ff9a3d;
  --danger-red: #ff4f70;
  --gold: #ffd75d;
  --real-green: #7ee787;
  --silly-pink: #ff8dca;
  --shadow: rgba(0, 0, 0, 0.38);
  --round-duration: 20s;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text-main);
  font-family: "Courier New", "Lucida Console", monospace;
  background:
    linear-gradient(to bottom, rgba(19, 10, 41, 0.1), rgba(7, 4, 14, 0.42)),
    linear-gradient(to bottom, var(--bg-sky) 0%, var(--bg-sky-soft) 58%, #1a102b 100%);
  image-rendering: pixelated;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
select {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 4px solid var(--ghost-blue);
  outline-offset: 3px;
}

/* ---------- BACKGROUND ---------- */
.bg-stars,
.bg-moon,
.bg-clouds,
.bg-mansion,
.bg-fog,
.ground-strip {
  position: fixed;
  pointer-events: none;
}

.bg-stars,
.bg-moon,
.bg-clouds,
.bg-mansion,
.bg-fog {
  inset: 0;
  z-index: 0;
}

.bg-stars {
  opacity: 0.72;
  background-image:
    radial-gradient(circle at 8% 18%, rgba(255, 255, 255, 0.82) 0 2px, transparent 3px),
    radial-gradient(circle at 17% 34%, rgba(255, 255, 255, 0.52) 0 1px, transparent 2px),
    radial-gradient(circle at 30% 12%, rgba(255, 255, 255, 0.66) 0 2px, transparent 3px),
    radial-gradient(circle at 44% 24%, rgba(255, 255, 255, 0.44) 0 1px, transparent 2px),
    radial-gradient(circle at 59% 17%, rgba(255, 255, 255, 0.74) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 31%, rgba(255, 255, 255, 0.44) 0 1px, transparent 2px),
    radial-gradient(circle at 91% 20%, rgba(255, 255, 255, 0.78) 0 2px, transparent 3px),
    radial-gradient(circle at 84% 43%, rgba(255, 255, 255, 0.52) 0 1px, transparent 2px),
    radial-gradient(circle at 22% 51%, rgba(255, 255, 255, 0.5) 0 1px, transparent 2px),
    radial-gradient(circle at 67% 53%, rgba(255, 255, 255, 0.42) 0 1px, transparent 2px);
}

.bg-moon::before {
  content: "";
  position: absolute;
  top: 8vh;
  right: 10vw;
  width: clamp(90px, 11vw, 160px);
  aspect-ratio: 1;
  border: 6px solid #8d7330;
  border-radius: 50%;
  background:
    radial-gradient(circle at 68% 32%, rgba(166, 131, 48, 0.34) 0 7%, transparent 8%),
    radial-gradient(circle at 31% 61%, rgba(166, 131, 48, 0.25) 0 10%, transparent 11%),
    radial-gradient(circle at 56% 77%, rgba(166, 131, 48, 0.22) 0 7%, transparent 8%),
    #ffe997;
  box-shadow:
    0 0 0 5px rgba(16, 8, 28, 0.35),
    0 0 44px rgba(255, 233, 151, 0.48);
}

.bg-clouds {
  opacity: 0.18;
  background:
    radial-gradient(ellipse at 15% 38%, #dad3ef 0 13%, transparent 14%),
    radial-gradient(ellipse at 32% 42%, #dad3ef 0 12%, transparent 13%),
    radial-gradient(ellipse at 62% 31%, #dad3ef 0 14%, transparent 15%),
    radial-gradient(ellipse at 79% 36%, #dad3ef 0 11%, transparent 12%);
  filter: blur(10px);
  animation: cloud-drift 24s linear infinite alternate;
}

.bg-mansion {
  top: auto;
  bottom: 94px;
  height: 31vh;
  min-height: 210px;
  opacity: 0.72;
  background: #0e0919;
  clip-path: polygon(
    0 100%, 0 72%, 6% 72%, 6% 56%, 11% 56%, 11% 35%, 16% 35%, 16% 68%,
    24% 68%, 24% 51%, 31% 51%, 31% 77%, 40% 77%, 40% 27%, 48% 27%, 48% 63%,
    58% 63%, 58% 47%, 66% 47%, 66% 74%, 75% 74%, 75% 34%, 81% 34%, 81% 68%,
    89% 68%, 89% 52%, 94% 52%, 94% 71%, 100% 71%, 100% 100%
  );
  box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.25);
}

.bg-mansion::before {
  content: "";
  position: absolute;
  inset: 18% 6% 12%;
  opacity: 0.22;
  background:
    linear-gradient(#ffd75d 0 0) 12% 52% / 14px 22px no-repeat,
    linear-gradient(#ffd75d 0 0) 27% 64% / 14px 22px no-repeat,
    linear-gradient(#ffd75d 0 0) 44% 35% / 14px 22px no-repeat,
    linear-gradient(#ffd75d 0 0) 64% 58% / 14px 22px no-repeat,
    linear-gradient(#ffd75d 0 0) 79% 42% / 14px 22px no-repeat,
    linear-gradient(#ffd75d 0 0) 92% 61% / 14px 22px no-repeat;
}

.bg-fog::before,
.bg-fog::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(233, 226, 255, 0.13) 0%, rgba(233, 226, 255, 0) 68%);
  filter: blur(14px);
}

.bg-fog::before {
  bottom: 96px;
  animation: fog-drift 11s ease-in-out infinite alternate;
}

.bg-fog::after {
  bottom: 26px;
  animation: fog-drift 15s ease-in-out infinite alternate-reverse;
}

.ground-strip {
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100px;
  border-top: 7px solid #09050f;
  background:
    repeating-linear-gradient(
      to right,
      #75405d 0 42px,
      #8d4e6c 42px 84px
    ) top / 100% 24px no-repeat,
    linear-gradient(to bottom, #3b1d33 0%, #291424 100%);
  box-shadow:
    inset 0 7px 0 rgba(255, 255, 255, 0.08),
    inset 0 30px 0 #4c2941;
}

@keyframes cloud-drift {
  from { transform: translateX(-3%); }
  to { transform: translateX(3%); }
}

@keyframes fog-drift {
  from { transform: translateX(-4%) scaleX(1); }
  to { transform: translateX(4%) scaleX(1.08); }
}

/* ---------- APP SHELL ---------- */
.app-shell {
  position: relative;
  z-index: 10;
  width: min(1420px, calc(100% - 28px));
  margin: 20px auto 124px;
}

.top-bar,
.screen-card,
.panel {
  border: 6px solid var(--pixel-border);
  background: linear-gradient(to bottom, var(--panel) 0%, var(--panel-mid) 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.1),
    0 9px 0 var(--shadow);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 94px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  border: 4px solid var(--pixel-border);
  background: #171026;
  font-size: 1.8rem;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.08);
}

.logo-text h1 {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: clamp(1rem, 2.1vw, 1.7rem);
  line-height: 1.35;
  text-shadow: 4px 4px 0 #000;
}

.logo-text p {
  margin: 0;
  color: var(--text-dim);
  font-size: clamp(0.48rem, 0.8vw, 0.62rem);
  line-height: 1.65;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-card {
  padding: clamp(18px, 2.3vw, 30px);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  align-items: center;
  gap: 28px;
  min-height: 650px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--ghost-blue);
  font-size: 0.55rem;
  line-height: 1.7;
}

.screen-title {
  margin: 0 0 20px;
  color: var(--gold);
  font-size: clamp(1.2rem, 3.3vw, 2.2rem);
  line-height: 1.45;
  text-shadow: 4px 4px 0 #000;
}

.screen-subtitle {
  max-width: 650px;
  margin: 0 0 30px;
  color: var(--text-dim);
  font-size: clamp(0.58rem, 0.95vw, 0.74rem);
  line-height: 2;
}

.hero-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 450px;
}

.start-tip {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 610px;
  margin-top: 26px;
  color: var(--text-dim);
  font-size: 0.52rem;
  line-height: 1.8;
}

.keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 4px solid var(--pixel-border);
  background: #fff4cf;
  color: #1b1230;
  box-shadow: 0 4px 0 #7b6c4d;
  white-space: nowrap;
}

.mascot-stage,
.bomb-scene {
  position: relative;
  overflow: hidden;
  border: 6px solid var(--pixel-border);
  background:
    linear-gradient(rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.12)),
    radial-gradient(circle at center, rgba(105, 229, 255, 0.12), transparent 58%),
    linear-gradient(to bottom, #1c1232 0%, #0f091c 100%);
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.06);
}

.mascot-stage {
  display: grid;
  place-items: center;
  min-height: 510px;
  padding: 24px;
}

.pixel-window-glow {
  position: absolute;
  inset: 12% 15%;
  border: 5px solid rgba(105, 229, 255, 0.11);
  box-shadow:
    0 0 34px rgba(105, 229, 255, 0.08),
    inset 0 0 34px rgba(105, 229, 255, 0.06);
}

.bomb-art {
  position: relative;
  z-index: 3;
  display: block;
  width: min(100%, 420px);
  max-height: 490px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 14px 0 rgba(0, 0, 0, 0.22));
  animation: hover 2.1s steps(4, end) infinite;
}

.platform-shadow {
  position: absolute;
  z-index: 2;
  bottom: 50px;
  width: 44%;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  filter: blur(6px);
}

@keyframes hover {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ---------- BUTTONS ---------- */
.pixel-btn,
.level-card,
.preset-btn,
.saved-set-btn,
.saved-set-delete {
  border: 4px solid var(--pixel-border);
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 70ms ease, filter 70ms ease;
}

.pixel-btn {
  padding: 14px 18px;
  background: linear-gradient(to bottom, #9be76b 0%, #55a638 100%);
  color: #0c1807;
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.22),
    0 6px 0 #224a16;
}

.pixel-btn.large {
  min-height: 66px;
  padding: 16px 20px;
  font-size: clamp(0.62rem, 1vw, 0.78rem);
}

.pixel-btn.small {
  min-height: 44px;
  padding: 10px 12px;
  font-size: 0.5rem;
}

.pixel-btn.alt {
  background: linear-gradient(to bottom, #77e9ff 0%, #35a4c5 100%);
  color: #07161b;
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.22),
    0 6px 0 #15516a;
}

.pixel-btn.ghost {
  background: linear-gradient(to bottom, #ffe06e 0%, #d49e25 100%);
  color: #201303;
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.2),
    0 6px 0 #76510b;
}

.pixel-btn:hover,
.level-card:hover,
.preset-btn:hover,
.saved-set-btn:hover,
.saved-set-delete:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.pixel-btn:active,
.level-card:active,
.preset-btn:active,
.saved-set-btn:active,
.saved-set-delete:active {
  transform: translateY(4px);
  box-shadow: none;
}

.pixel-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6) brightness(0.7);
}

/* ---------- HEADERS / LEVEL SELECT ---------- */
.screen-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 16px;
}

.level-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 190px;
  padding: 18px;
  text-align: left;
  color: var(--text-main);
  background: linear-gradient(to bottom, #554080 0%, #342653 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.08),
    0 6px 0 rgba(0, 0, 0, 0.35);
}

.level-card.monster {
  background: linear-gradient(to bottom, #6b3f72 0%, #422347 100%);
}

.level-card.custom {
  background: linear-gradient(to bottom, #315c78 0%, #233a59 100%);
}

.level-number {
  color: var(--gold);
  font-size: 1.45rem;
  text-shadow: 3px 3px 0 #000;
}

.level-name {
  min-height: 34px;
  color: #fff9e6;
  font-size: 0.64rem;
  line-height: 1.5;
}

.level-desc {
  flex: 1;
  color: var(--text-dim);
  font-size: 0.48rem;
  line-height: 1.75;
}

.level-example {
  color: var(--ghost-blue);
  font-size: 0.58rem;
  line-height: 1.5;
}

/* ---------- FORM CONTROLS ---------- */
.field-group,
.setting-box,
.custom-part-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-group > span,
.part-heading,
.setting-title {
  color: var(--gold);
  font-size: 0.55rem;
  line-height: 1.6;
}

input,
textarea,
select {
  width: 100%;
  border: 4px solid var(--pixel-border);
  border-radius: 0;
  background: #120b20;
  color: var(--text-main);
  padding: 14px;
  font-size: 0.58rem;
  line-height: 1.8;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.04);
}

textarea {
  min-height: 210px;
  resize: vertical;
}

select {
  cursor: pointer;
}

.custom-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  margin-bottom: 14px;
}

.custom-help {
  margin: 0 0 18px;
  color: var(--text-dim);
  font-size: 0.5rem;
  line-height: 1.8;
}

.custom-parts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.custom-part-card {
  padding: 14px;
  border: 4px solid var(--pixel-border);
  background: rgba(16, 10, 29, 0.56);
}

.is-hidden {
  display: none !important;
}

.custom-actions,
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.saved-sets-panel {
  margin-top: 24px;
  padding: 18px;
  border: 4px solid var(--pixel-border);
  background: rgba(13, 8, 24, 0.48);
}

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

.saved-sets-header h3 {
  margin: 0;
  color: var(--gold);
  font-size: 0.65rem;
}

.saved-sets-header span,
.setting-note,
.check-setting small {
  color: var(--text-dim);
  font-size: 0.46rem;
  line-height: 1.7;
}

.saved-sets-list {
  display: grid;
  gap: 10px;
}

.saved-set-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.saved-set-btn,
.saved-set-delete {
  min-height: 46px;
  padding: 10px 12px;
  color: var(--text-main);
  background: #433260;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
  font-size: 0.5rem;
}

.saved-set-btn {
  text-align: left;
}

.saved-set-delete {
  background: #6c2d46;
}

.saved-empty {
  color: var(--text-dim);
  font-size: 0.5rem;
  line-height: 1.8;
}

.settings-card {
  min-height: 520px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.setting-box {
  min-height: 190px;
  padding: 18px;
  border: 4px solid var(--pixel-border);
  background: rgba(17, 10, 31, 0.58);
}

.check-setting {
  flex-direction: row;
  align-items: flex-start;
}

.check-setting input {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  margin-top: 3px;
  accent-color: var(--slime-green);
}

.check-setting strong {
  display: block;
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 0.54rem;
  line-height: 1.6;
}

/* ---------- GAME ---------- */
.game-topline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.game-level-pill,
.space-hint {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--pixel-border);
  background: rgba(41, 27, 70, 0.92);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.06);
  padding: 10px 14px;
  color: var(--gold);
  font-size: 0.53rem;
  line-height: 1.6;
  text-align: center;
}

.space-hint {
  gap: 10px;
  color: var(--text-dim);
}

.space-hint .keycap {
  min-height: 28px;
  padding: 5px 8px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
  gap: 16px;
}

.word-panel,
.bomb-panel {
  min-height: 525px;
  padding: 18px;
}

.panel-header,
.mini-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 0.5rem;
  line-height: 1.7;
}

.level4-mode-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.level4-mode-control select {
  width: auto;
  min-width: 128px;
  padding: 8px 10px;
  font-size: 0.48rem;
}

.word-box {
  display: grid;
  place-items: center;
  min-height: 390px;
  margin: 16px 0;
  padding: 24px;
  border: 6px solid var(--pixel-border);
  background:
    radial-gradient(circle at center, rgba(105, 229, 255, 0.09), transparent 58%),
    linear-gradient(to bottom, #1b1230 0%, #10091e 100%);
  text-align: center;
}

.word-display {
  max-width: 100%;
  color: var(--text-main);
  font-size: clamp(4rem, 11vw, 10rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.025em;
  text-shadow: 7px 7px 0 #000;
  overflow-wrap: anywhere;
}

.placeholder-word {
  color: var(--ghost-blue);
  font-size: clamp(2.4rem, 6vw, 5rem);
}

.word-display.real-word {
  color: var(--real-green);
}

.word-display.silly-word {
  color: var(--silly-pink);
}

.word-display.monster-word {
  color: var(--fire-orange);
  font-size: clamp(3rem, 7vw, 6.5rem);
}

.word-badge {
  display: inline-block;
  margin-top: 22px;
  padding: 10px 14px;
  border: 4px solid var(--pixel-border);
  font-size: 0.52rem;
  line-height: 1.5;
  text-transform: uppercase;
}

.word-badge.real {
  background: #275e37;
  color: #dcffe2;
}

.word-badge.silly {
  background: #6b2d57;
  color: #ffd8ef;
}

.word-badge.monster {
  background: #733b17;
  color: #fff0d2;
}

.word-badge.custom {
  background: #205171;
  color: #dff7ff;
}

.bomb-scene {
  display: grid;
  place-items: center;
  min-height: 489px;
  --round-duration: 20s;
}

.bomb-art.live {
  width: min(80%, 380px);
  max-height: 380px;
}

.fuse-wrap {
  position: absolute;
  z-index: 6;
  top: 40px;
  left: 50%;
  width: min(58%, 270px);
  height: 44px;
  transform: translateX(-43%) rotate(-10deg);
}

.fuse-rope {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  height: 14px;
  border: 4px solid #3f270d;
  background:
    repeating-linear-gradient(
      90deg,
      #c88a36 0 12px,
      #f0bc62 12px 24px
    );
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.2);
  transform-origin: right center;
}

.fuse-burn {
  position: absolute;
  inset: -4px;
  background: #171026;
  transform: scaleX(0);
  transform-origin: left center;
}

.spark {
  position: absolute;
  z-index: 7;
  top: 0;
  right: -12px;
  width: 38px;
  height: 38px;
  background:
    linear-gradient(45deg, transparent 32%, #ff6b34 33% 67%, transparent 68%),
    linear-gradient(-45deg, transparent 32%, #ffd75d 33% 67%, transparent 68%);
  filter: drop-shadow(0 0 8px rgba(255, 170, 60, 0.9));
  animation: spark-flicker 180ms steps(2, end) infinite;
}

.bomb-scene.running .fuse-burn {
  animation: fuse-burn var(--round-duration) linear forwards;
}

.bomb-scene.paused .fuse-burn,
.bomb-scene.paused .spark,
.bomb-scene.paused .bomb-art {
  animation-play-state: paused;
}

.bomb-scene.exploded .spark,
.bomb-scene.exploded .fuse-wrap {
  opacity: 0;
}

.bomb-scene.exploded .bomb-art {
  animation: explosion-pop 420ms steps(5, end) 1;
}

.scene-flash {
  position: absolute;
  z-index: 9;
  inset: 0;
  opacity: 0;
  background: #fff6c7;
  pointer-events: none;
}

.bomb-scene.exploded .scene-flash {
  animation: flash 360ms steps(4, end) 1;
}

.timer-display {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  min-width: 205px;
  padding: 13px 18px;
  border: 5px solid var(--pixel-border);
  background: rgba(13, 8, 24, 0.86);
  color: var(--gold);
  font-size: clamp(1rem, 2.5vw, 1.75rem);
  line-height: 1.3;
  text-align: center;
  text-shadow: 4px 4px 0 #000;
}

.boom-text {
  position: absolute;
  z-index: 10;
  top: 30px;
  right: 26px;
  opacity: 0;
  color: var(--danger-red);
  font-size: clamp(1rem, 2.6vw, 1.9rem);
  text-shadow: 4px 4px 0 #000;
  transform: scale(0.4) rotate(-8deg);
}

.bomb-scene.exploded .boom-text {
  animation: boom-in 520ms steps(5, end) forwards;
}

.control-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.72fr);
  gap: 18px;
  align-items: center;
  margin-top: 16px;
  padding: 16px;
}

.main-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.main-controls .pixel-btn.large {
  flex: 1 1 250px;
}

.timer-controls {
  display: grid;
  gap: 12px;
}

.timer-adjust-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.timer-value-wrap {
  display: grid;
  place-items: center;
  min-width: 128px;
}

.timer-value {
  color: var(--gold);
  font-size: 1.25rem;
  text-shadow: 3px 3px 0 #000;
}

.timer-value-wrap small {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.4rem;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.preset-btn {
  min-width: 54px;
  padding: 10px 12px;
  color: var(--text-main);
  background: linear-gradient(to bottom, #695394 0%, #49366b 100%);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.08),
    0 5px 0 rgba(0, 0, 0, 0.32);
  font-size: 0.5rem;
}

.preset-btn.active {
  color: #201303;
  background: linear-gradient(to bottom, #ffad55 0%, #d86f1c 100%);
}

@keyframes fuse-burn {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes spark-flicker {
  from { transform: scale(0.88) rotate(0deg); }
  to { transform: scale(1.16) rotate(90deg); }
}

@keyframes explosion-pop {
  0% { transform: translateY(0) scale(1); filter: brightness(1); }
  35% { transform: translate(-8px, 4px) scale(1.05); filter: brightness(2); }
  70% { transform: translate(8px, -4px) scale(0.94); filter: brightness(0.65); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes flash {
  0% { opacity: 0; }
  25% { opacity: 0.95; }
  55% { opacity: 0.28; }
  100% { opacity: 0; }
}

@keyframes boom-in {
  0% { opacity: 0; transform: scale(0.4) rotate(-8deg); }
  45% { opacity: 1; transform: scale(1.35) rotate(5deg); }
  100% { opacity: 1; transform: scale(1) rotate(-3deg); }
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 120px;
  max-width: min(560px, calc(100% - 30px));
  padding: 14px 18px;
  border: 4px solid var(--pixel-border);
  background: #151024;
  color: var(--text-main);
  font-size: 0.5rem;
  line-height: 1.7;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1120px) {
  .hero-card,
  .game-layout,
  .control-bar {
    grid-template-columns: 1fr;
  }

  .hero-card {
    min-height: auto;
  }

  .level-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }

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

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

  .game-topline {
    grid-template-columns: auto 1fr;
  }

  .space-hint {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 16px, 1420px);
    margin-top: 8px;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }

  .mascot-stage {
    min-height: 390px;
  }

  .level-grid,
  .custom-parts-grid,
  .custom-toolbar {
    grid-template-columns: 1fr;
  }

  .screen-heading-row {
    flex-direction: column;
  }

  .game-topline {
    grid-template-columns: 1fr;
  }

  .word-panel,
  .bomb-panel {
    min-height: auto;
  }

  .word-box {
    min-height: 300px;
  }

  .bomb-scene {
    min-height: 430px;
  }

  .word-display {
    font-size: clamp(3.2rem, 18vw, 6rem);
  }

  .word-display.monster-word {
    font-size: clamp(2.4rem, 11vw, 4rem);
  }

  .main-controls {
    flex-direction: column;
  }

  .main-controls .pixel-btn.large {
    flex-basis: auto;
  }

  .saved-set-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}


/* ---------- V4 READABILITY + EMPHASIS ---------- */
body,
button,
input,
textarea,
select {
  font-family: "Nunito Sans", Arial, sans-serif;
}

body {
  font-weight: 500;
}

.logo-text h1,
.screen-title {
  font-family: "Press Start 2P", "Nunito Sans", sans-serif;
}

/* Start-screen copy and actions */
.hero-copy {
  text-align: center;
}

.hero-copy .screen-subtitle,
.hero-copy .eyebrow,
.hero-copy .start-tip {
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  width: min(100%, 520px);
  max-width: none;
  margin-inline: auto;
  gap: 18px;
}

.hero-buttons .pixel-btn.large {
  width: 100%;
  min-height: 78px;
  padding: 20px 28px;
  font-size: clamp(1.05rem, 1.65vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.045em;
  text-align: center;
}

.start-tip {
  justify-content: center;
  max-width: 680px;
  font-size: clamp(0.72rem, 1vw, 0.9rem);
}

.eyebrow {
  font-size: clamp(0.72rem, 0.95vw, 0.88rem);
  font-weight: 700;
}

.screen-subtitle {
  font-size: clamp(0.9rem, 1.15vw, 1.08rem);
  line-height: 1.65;
}

/* Level-select cards */
.level-grid {
  gap: 20px;
}

.level-card {
  min-height: 235px;
  gap: 15px;
  padding: 22px;
}

.level-number {
  font-size: clamp(1.9rem, 2.4vw, 2.35rem);
}

.level-name {
  min-height: 48px;
  font-size: clamp(1rem, 1.25vw, 1.22rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.level-desc {
  font-size: clamp(0.78rem, 0.94vw, 0.9rem);
  line-height: 1.45;
}

.level-example {
  font-size: clamp(0.9rem, 1.05vw, 1rem);
  font-weight: 700;
  line-height: 1.35;
}

.level-card:hover .level-name,
.level-card:focus-visible .level-name {
  color: var(--gold);
}

/* Slightly larger level-screen heading and back button */
#levelScreen .screen-title {
  font-size: clamp(1.55rem, 3vw, 2.3rem);
}

#levelScreen .screen-heading-row .pixel-btn.small {
  min-width: 88px;
  min-height: 50px;
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .hero-copy {
    text-align: center;
  }

  .hero-buttons {
    width: min(100%, 620px);
  }

  .level-card {
    min-height: 210px;
  }
}

/* ---------- V5 SILKSCREEN + SUBTLE BRICK MENUS ---------- */
/* Silkscreen is used for the readable game UI. Press Start 2P remains reserved
   for the logo and major page headings. */
body,
button,
input,
textarea,
select {
  font-family: "Nunito Sans", Arial, sans-serif;
}

.logo-text h1,
.screen-title {
  font-family: "Press Start 2P", "Nunito Sans", sans-serif;
}

/* Low-opacity haunted brickwork on menu panels only. The game screen uses
   separate .panel elements, so the word and timer areas remain visually clean. */
.screen-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.screen-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.09;
  background-image:
    /* vertical joints on alternating rows */
    linear-gradient(
      to bottom,
      rgba(255, 244, 207, 0.88) 0 30px,
      transparent 30px 64px
    ),
    linear-gradient(
      to bottom,
      transparent 0 32px,
      rgba(255, 244, 207, 0.88) 32px 62px,
      transparent 62px 64px
    ),
    /* horizontal mortar lines */
    repeating-linear-gradient(
      to bottom,
      rgba(255, 244, 207, 0.88) 0 2px,
      transparent 2px 32px
    );
  background-size:
    2px 64px,
    2px 64px,
    100% 32px;
  background-position:
    0 0,
    32px 0,
    0 0;
  background-repeat:
    repeat-x,
    repeat-x,
    repeat;
}

/* Keeps every menu element above the decorative brick layer. */
.screen-card > * {
  position: relative;
  z-index: 1;
}

/* Silkscreen is wider than Pixelify Sans, so these small refinements keep
   longer level names comfortable without making them feel secondary. */
.hero-buttons .pixel-btn.large {
  letter-spacing: 0.015em;
}

.level-name {
  font-size: clamp(0.92rem, 1.12vw, 1.08rem);
  letter-spacing: 0;
}

.level-desc {
  font-size: clamp(0.75rem, 0.9vw, 0.86rem);
}

.level-example {
  font-size: clamp(0.84rem, 0.98vw, 0.96rem);
}



/* ---------- V6 LARGE-TYPE MENUS + SHARED-BOMB GAMEPLAY ---------- */
/* Level cards are viewed from across a classroom, so every information tier
   is intentionally larger than ordinary web-interface text. */
#levelScreen .level-grid {
  gap: 22px;
}

#levelScreen .level-card {
  min-height: 250px;
  gap: 16px;
  padding: 24px;
}

#levelScreen .level-number {
  font-size: clamp(2.15rem, 2.65vw, 2.75rem);
  line-height: 1;
}

#levelScreen .level-name {
  min-height: 58px;
  font-size: clamp(1.18rem, 1.42vw, 1.48rem);
  line-height: 1.28;
  font-weight: 700;
}

#levelScreen .level-desc {
  font-size: clamp(0.94rem, 1.08vw, 1.1rem);
  line-height: 1.48;
}

#levelScreen .level-example {
  font-size: clamp(1.05rem, 1.22vw, 1.25rem);
  line-height: 1.35;
  font-weight: 700;
}

/* The custom builder is a working teacher tool, not decorative small print. */
#customScreen .screen-card {
  padding: clamp(24px, 2.4vw, 38px);
}

#customScreen .custom-toolbar {
  grid-template-columns: minmax(0, 1fr) minmax(250px, 310px);
  gap: 22px;
  margin-bottom: 22px;
}

#customScreen .field-group > span,
#customScreen .part-heading {
  font-size: clamp(0.95rem, 1.05vw, 1.08rem);
  line-height: 1.45;
  font-weight: 700;
}

#customScreen input,
#customScreen textarea,
#customScreen select {
  padding: 18px;
  font-size: clamp(1.05rem, 1.18vw, 1.22rem);
  line-height: 1.65;
}

#customScreen input {
  min-height: 66px;
}

#customScreen select {
  min-height: 66px;
}

#customScreen textarea {
  min-height: 320px;
  caret-color: var(--gold);
}

#customScreen input::placeholder,
#customScreen textarea::placeholder {
  color: #aa9fc9;
  opacity: 0.8;
}

#customScreen .custom-help {
  margin-bottom: 22px;
  font-size: clamp(0.88rem, 1vw, 1rem);
  line-height: 1.65;
}

#customScreen .custom-parts-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

#customScreen .custom-part-card {
  min-width: 0;
  padding: 18px;
  gap: 14px;
}

#customScreen .custom-actions .pixel-btn {
  min-height: 62px;
  padding: 16px 22px;
  font-size: clamp(0.9rem, 1vw, 1.05rem);
  font-weight: 700;
}

#customScreen .saved-sets-header h3 {
  font-size: clamp(1.05rem, 1.2vw, 1.25rem);
}

#customScreen .saved-sets-header span,
#customScreen .saved-empty,
#customScreen .saved-set-btn,
#customScreen .saved-set-delete {
  font-size: clamp(0.82rem, 0.92vw, 0.98rem);
  line-height: 1.45;
}

/* The main game button now means Start Bomb / Next Word, depending on state. */
#spaceActionBtn {
  font-size: clamp(1rem, 1.25vw, 1.25rem);
  font-weight: 700;
}

.game-topline .space-hint,
.mini-info {
  font-size: clamp(0.76rem, 0.9vw, 0.94rem);
}

@media (max-width: 900px) {
  #levelScreen .level-card {
    min-height: 220px;
  }

  #customScreen .custom-toolbar {
    grid-template-columns: 1fr;
  }

  #customScreen .custom-parts-grid {
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   V7 — READABLE GAME TYPE + FULL-SIZE CUSTOM EDITOR
   ========================================================= */
body,
button,
input,
textarea,
select {
  font-family: "Nunito Sans", Arial, sans-serif;
}

.logo-text h1,
.screen-title {
  font-family: "Press Start 2P", "Nunito Sans", sans-serif;
}

.hero-buttons .pixel-btn.large,
.level-name,
.level-desc,
.level-example,
.level-number,
.pixel-btn,
.preset-btn,
.game-level-pill,
.space-hint {
  font-weight: 800;
  letter-spacing: 0.035em;
}

#customScreen .custom-parts-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--part-count, 2), minmax(0, 1fr));
  gap: clamp(20px, 2vw, 30px);
  align-items: stretch;
}

#customScreen .custom-part-card {
  width: 100%;
  min-height: clamp(500px, 58vh, 690px);
  padding: clamp(20px, 2vw, 30px);
}

#customScreen .part-heading,
#customScreen .field-group > span {
  font-size: clamp(1.05rem, 1.25vw, 1.28rem);
  font-weight: 900;
}

#customScreen input,
#customScreen select {
  min-height: 72px;
  font-size: clamp(1.15rem, 1.35vw, 1.38rem);
  font-weight: 700;
}

#customScreen textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: clamp(430px, 50vh, 610px);
  padding: 22px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1.35rem, 1.65vw, 1.7rem);
  font-weight: 600;
  line-height: 1.65;
  letter-spacing: 0.01em;
}

#customScreen .custom-help {
  font-size: clamp(1rem, 1.15vw, 1.18rem);
  font-weight: 650;
}

.word-display.word-swap {
  animation: word-swap-pop 150ms steps(2, end);
}

@keyframes word-swap-pop {
  0% { transform: scale(0.94); opacity: 0.55; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 900px) {
  #customScreen .custom-parts-grid {
    grid-template-columns: 1fr;
  }

  #customScreen .custom-part-card {
    min-height: 430px;
  }

  #customScreen textarea {
    min-height: 340px;
  }
}

/* =========================================================
   V9 — EIGHT BUILT-IN PHONICS MODES + CUSTOM
   ========================================================= */
@media (min-width: 1001px) {
  #levelScreen .level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

#levelScreen .level-card {
  min-height: 230px;
}

#levelScreen .level-name {
  line-height: 1.25;
}


/* =========================================================
   V10 — BRIGHT ARCADE PALETTE
   Warm red, orange, and yellow are the primary colors.
   Turquoise and green remain as small contrast accents.
   ========================================================= */
:root {
  --bg-deep: #4a1609;
  --bg-sky: #d94316;
  --bg-sky-soft: #ff8b20;
  --panel: #a8421d;
  --panel-mid: #7a2b13;
  --panel-dark: #45170b;
  --pixel-border: #2a0b04;
  --text-main: #fff8e7;
  --text-dim: #ffe1b6;
  --ghost-blue: #58d9e8;
  --slime-green: #82dc55;
  --fire-orange: #ff7a18;
  --danger-red: #eb3535;
  --gold: #ffd447;
  --real-green: #8be064;
  --silly-pink: #ff82ad;
  --shadow: rgba(73, 17, 3, 0.48);
}

html {
  background: var(--bg-deep);
}

body {
  background:
    linear-gradient(to bottom, rgba(255, 229, 113, 0.06), rgba(86, 19, 5, 0.30)),
    linear-gradient(
      to bottom,
      #ffcf48 0%,
      #ff9a25 24%,
      #ed5a1d 56%,
      #a92f13 80%,
      #5b190a 100%
    );
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-color: #64e5ef;
}

/* Bright arcade sparkles rather than a dark night sky. */
.bg-stars {
  opacity: 0.72;
  background-image:
    radial-gradient(circle at 8% 18%, #fff7cf 0 3px, transparent 4px),
    radial-gradient(circle at 18% 35%, #ffd447 0 2px, transparent 3px),
    radial-gradient(circle at 31% 12%, #fff7cf 0 3px, transparent 4px),
    radial-gradient(circle at 45% 25%, #ffef9f 0 2px, transparent 3px),
    radial-gradient(circle at 59% 17%, #fff7cf 0 3px, transparent 4px),
    radial-gradient(circle at 72% 31%, #ffd447 0 2px, transparent 3px),
    radial-gradient(circle at 91% 20%, #fff7cf 0 3px, transparent 4px),
    radial-gradient(circle at 84% 43%, #ffef9f 0 2px, transparent 3px),
    radial-gradient(circle at 22% 51%, #ffd447 0 2px, transparent 3px),
    radial-gradient(circle at 67% 53%, #fff7cf 0 2px, transparent 3px);
}

/* The old moon becomes a glowing arcade sun / coin. */
.bg-moon::before {
  border-color: #e84b16;
  background:
    radial-gradient(circle at 68% 32%, rgba(232, 75, 22, 0.28) 0 7%, transparent 8%),
    radial-gradient(circle at 31% 61%, rgba(232, 75, 22, 0.20) 0 10%, transparent 11%),
    radial-gradient(circle at 56% 77%, rgba(232, 75, 22, 0.18) 0 7%, transparent 8%),
    #ffe66d;
  box-shadow:
    0 0 0 5px rgba(106, 28, 7, 0.28),
    0 0 50px rgba(255, 229, 92, 0.62);
}

.bg-clouds {
  opacity: 0.16;
  background:
    radial-gradient(ellipse at 15% 38%, #fff6d6 0 13%, transparent 14%),
    radial-gradient(ellipse at 32% 42%, #fff6d6 0 12%, transparent 13%),
    radial-gradient(ellipse at 62% 31%, #fff6d6 0 14%, transparent 15%),
    radial-gradient(ellipse at 79% 36%, #fff6d6 0 11%, transparent 12%);
}

/* Keep the platformer silhouette, but change it from haunted purple to warm arcade brown. */
.bg-mansion {
  background: #4a160d;
  opacity: 0.68;
  box-shadow: 0 -16px 50px rgba(103, 24, 7, 0.24);
}

.bg-mansion::before {
  opacity: 0.34;
  background:
    linear-gradient(#ffd447 0 0) 12% 52% / 14px 22px no-repeat,
    linear-gradient(#ffd447 0 0) 27% 64% / 14px 22px no-repeat,
    linear-gradient(#ffd447 0 0) 44% 35% / 14px 22px no-repeat,
    linear-gradient(#ffd447 0 0) 64% 58% / 14px 22px no-repeat,
    linear-gradient(#ffd447 0 0) 79% 42% / 14px 22px no-repeat,
    linear-gradient(#ffd447 0 0) 92% 61% / 14px 22px no-repeat;
}

.bg-fog::before,
.bg-fog::after {
  background: radial-gradient(
    ellipse,
    rgba(255, 226, 142, 0.16) 0%,
    rgba(255, 182, 73, 0) 68%
  );
}

.ground-strip {
  border-top-color: var(--pixel-border);
  background:
    repeating-linear-gradient(
      to right,
      #d95a22 0 42px,
      #ef7430 42px 84px
    ) top / 100% 24px no-repeat,
    linear-gradient(to bottom, #8e2d16 0%, #5f1d0f 100%);
  box-shadow:
    inset 0 7px 0 rgba(255, 238, 193, 0.13),
    inset 0 30px 0 #ad3d1d;
}

.top-bar,
.screen-card,
.panel {
  background:
    linear-gradient(to bottom, rgba(255, 213, 71, 0.08), transparent 18%),
    linear-gradient(to bottom, var(--panel) 0%, var(--panel-mid) 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 231, 162, 0.16),
    0 9px 0 var(--shadow);
}

.logo-icon {
  background: #4b170b;
}

.logo-text h1,
.screen-title,
.level-number,
.field-group > span,
.part-heading,
.setting-title,
.saved-sets-header h3,
.check-setting strong,
.timer-value,
.game-level-pill {
  color: var(--gold);
}

.logo-text p,
.screen-subtitle,
.start-tip,
.level-desc,
.custom-help,
.saved-sets-header span,
.setting-note,
.check-setting small,
.saved-empty,
.panel-header,
.mini-info,
.space-hint {
  color: var(--text-dim);
}

.keycap {
  background: #fff3c4;
  color: #4a1609;
  box-shadow: 0 4px 0 #b76f24;
}

.mascot-stage,
.bomb-scene {
  background:
    linear-gradient(rgba(255, 255, 255, 0.035), rgba(73, 17, 3, 0.16)),
    radial-gradient(circle at center, rgba(255, 196, 61, 0.26), transparent 58%),
    linear-gradient(to bottom, #6f2412 0%, #351008 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 232, 170, 0.10),
    inset 0 0 42px rgba(255, 122, 24, 0.12);
}

.pixel-window-glow {
  border-color: rgba(255, 212, 71, 0.18);
  box-shadow:
    0 0 38px rgba(255, 176, 40, 0.14),
    inset 0 0 38px rgba(255, 212, 71, 0.09);
}

/* Buttons remain color coded, but all colors are brighter and more arcade-like. */
.pixel-btn {
  background: linear-gradient(to bottom, #a8ed68 0%, #5fb83c 100%);
  color: #18330d;
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.28),
    0 6px 0 #2f681e;
}

.pixel-btn.alt {
  background: linear-gradient(to bottom, #73e8ef 0%, #29aeba 100%);
  color: #073438;
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.26),
    0 6px 0 #12636a;
}

.pixel-btn.ghost {
  background: linear-gradient(to bottom, #ffe96c 0%, #efa91c 100%);
  color: #4a2502;
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.28),
    0 6px 0 #9a5c08;
}

.level-card {
  background:
    linear-gradient(to bottom, rgba(255, 225, 110, 0.10), transparent 22%),
    linear-gradient(to bottom, #d35a22 0%, #8f2d13 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 230, 168, 0.16),
    0 6px 0 rgba(82, 17, 4, 0.46);
}

.level-card:nth-child(3n + 2) {
  background:
    linear-gradient(to bottom, rgba(255, 247, 195, 0.13), transparent 22%),
    linear-gradient(to bottom, #e77c24 0%, #aa3c14 100%);
}

.level-card:nth-child(3n) {
  background:
    linear-gradient(to bottom, rgba(255, 241, 175, 0.11), transparent 22%),
    linear-gradient(to bottom, #c9462a 0%, #802016 100%);
}

.level-card.monster {
  background:
    linear-gradient(to bottom, rgba(255, 225, 110, 0.10), transparent 22%),
    linear-gradient(to bottom, #e63e32 0%, #8d1b1b 100%);
}

.level-card.custom {
  background:
    linear-gradient(to bottom, rgba(208, 255, 248, 0.10), transparent 22%),
    linear-gradient(to bottom, #168e98 0%, #0c5961 100%);
}

.level-name {
  color: #fff9e8;
}

.level-example,
.eyebrow {
  color: #74e6ed;
}

input,
textarea,
select {
  background: #44170d;
  color: var(--text-main);
  box-shadow: inset 0 4px 0 rgba(255, 226, 169, 0.07);
}

input::placeholder,
textarea::placeholder,
#customScreen input::placeholder,
#customScreen textarea::placeholder {
  color: #e9ad83;
}

.custom-part-card,
.saved-sets-panel,
.setting-box {
  background: rgba(77, 22, 9, 0.68);
}

.saved-set-btn,
.saved-set-delete {
  background: #a8401f;
}

.saved-set-delete {
  background: #b52828;
}

.check-setting input {
  accent-color: var(--slime-green);
}

.game-level-pill,
.space-hint {
  background: rgba(113, 37, 15, 0.94);
  box-shadow: inset 0 4px 0 rgba(255, 222, 149, 0.10);
}

.word-box {
  background:
    radial-gradient(circle at center, rgba(255, 187, 58, 0.13), transparent 58%),
    linear-gradient(to bottom, #4a180d 0%, #2a0d07 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 232, 181, 0.07),
    inset 0 0 45px rgba(255, 101, 21, 0.06);
}

.placeholder-word {
  color: #74e6ed;
}

.word-display.monster-word {
  color: #ff9a31;
}

.word-badge.real {
  background: #37742f;
  color: #ecffe8;
}

.word-badge.silly {
  background: #a33560;
  color: #ffe2f0;
}

.word-badge.monster {
  background: #a64615;
  color: #fff1ce;
}

.word-badge.custom {
  background: #147886;
  color: #e6fbff;
}

.fuse-track {
  border-color: #6a3514;
  background:
    repeating-linear-gradient(
      to right,
      #d38b32 0 12px,
      #ffd070 12px 24px
    );
}

.bomb-scene::before {
  background: #5a190b;
}

.spark {
  background:
    linear-gradient(45deg, transparent 32%, #ff5b20 33% 67%, transparent 68%),
    linear-gradient(-45deg, transparent 32%, #ffe45f 33% 67%, transparent 68%);
  filter: drop-shadow(0 0 10px rgba(255, 180, 43, 0.95));
}

.fuse-cap {
  background: #fff2af;
}

.timer-display {
  background: rgba(68, 19, 8, 0.90);
  color: var(--gold);
}

.preset-btn {
  background: linear-gradient(to bottom, #c95425 0%, #8c2c14 100%);
  box-shadow:
    inset 0 4px 0 rgba(255, 226, 163, 0.12),
    0 5px 0 rgba(83, 17, 4, 0.42);
}

.preset-btn.active {
  color: #4a2003;
  background: linear-gradient(to bottom, #ffe46b 0%, #f1a31a 100%);
}

.toast {
  background: #4a180d;
}

/* Warm, subtle brick detail on menu screens. */
.screen-card::before {
  opacity: 0.10;
  background-image:
    linear-gradient(
      to bottom,
      rgba(255, 223, 133, 0.82) 0 30px,
      transparent 30px 64px
    ),
    linear-gradient(
      to bottom,
      transparent 0 32px,
      rgba(255, 223, 133, 0.82) 32px 62px,
      transparent 62px 64px
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 223, 133, 0.82) 0 2px,
      transparent 2px 32px
    );
}

/* Keep the game readable even when the surrounding palette is bright. */
.word-display {
  text-shadow: 7px 7px 0 #2a0b04;
}

.logo-text h1,
.screen-title,
.level-number,
.timer-value,
.boom-text {
  text-shadow: 4px 4px 0 #2a0b04;
}

/* =========================================================
   V11 — PLAYROOM ARCADE / KINDERGARTEN PALETTE
   Softer, brighter, and more cheerful than Bright Arcade.
   The game areas stay dark enough for classroom readability.
   ========================================================= */

:root {
  --bg-deep: #8f2f1c;
  --bg-sky: #ffd767;
  --bg-sky-soft: #ff9f58;
  --panel: #fff0b8;
  --panel-mid: #ffd36d;
  --panel-dark: #f27a45;
  --pixel-border: #4b2416;
  --text-main: #4b2718;
  --text-dim: #74422d;
  --ghost-blue: #46c6d4;
  --slime-green: #82cf4a;
  --fire-orange: #ff7b2f;
  --danger-red: #e94b3c;
  --gold: #ffe65d;
  --real-green: #6fc75a;
  --silly-pink: #ed76aa;
  --shadow: rgba(103, 35, 18, 0.34);
}

html {
  background: #8f2f1c;
}

body {
  color: var(--text-main);
  background:
    linear-gradient(to bottom, rgba(255, 250, 208, 0.10), rgba(206, 67, 35, 0.12)),
    linear-gradient(to bottom, #ffe27a 0%, #ffb45f 53%, #f56e53 100%);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-color: #087f91;
}

/* Confetti instead of stars. */
.bg-stars {
  opacity: 0.62;
  background-image:
    radial-gradient(circle at 8% 16%, #f34e45 0 5px, transparent 6px),
    radial-gradient(circle at 18% 33%, #3bbbc7 0 4px, transparent 5px),
    radial-gradient(circle at 29% 11%, #fff3ba 0 6px, transparent 7px),
    radial-gradient(circle at 42% 27%, #75c94c 0 4px, transparent 5px),
    radial-gradient(circle at 57% 15%, #f35d3f 0 5px, transparent 6px),
    radial-gradient(circle at 70% 31%, #fff0a6 0 4px, transparent 5px),
    radial-gradient(circle at 89% 18%, #2eb6c5 0 5px, transparent 6px),
    radial-gradient(circle at 82% 43%, #7cc94b 0 4px, transparent 5px),
    radial-gradient(circle at 22% 52%, #f35c76 0 4px, transparent 5px),
    radial-gradient(circle at 66% 52%, #fff5c6 0 4px, transparent 5px);
}

/* Sunny arcade medallion. */
.bg-moon::before {
  top: 5vh;
  right: 7vw;
  border-color: #db7d24;
  background:
    radial-gradient(circle at 67% 31%, rgba(224, 132, 37, 0.20) 0 7%, transparent 8%),
    radial-gradient(circle at 33% 65%, rgba(224, 132, 37, 0.16) 0 10%, transparent 11%),
    #fff3a3;
  box-shadow:
    0 0 0 5px rgba(121, 45, 17, 0.14),
    0 0 52px rgba(255, 239, 133, 0.72);
}

.bg-clouds {
  opacity: 0.34;
  background:
    radial-gradient(ellipse at 14% 35%, #fff9df 0 13%, transparent 14%),
    radial-gradient(ellipse at 31% 41%, #fff9df 0 12%, transparent 13%),
    radial-gradient(ellipse at 63% 29%, #fff9df 0 14%, transparent 15%),
    radial-gradient(ellipse at 80% 37%, #fff9df 0 12%, transparent 13%);
  filter: blur(8px);
}

/* Turn the haunted skyline into a soft toy-town silhouette. */
.bg-mansion {
  opacity: 0.22;
  background: #b63c27;
  box-shadow: 0 -16px 45px rgba(123, 40, 21, 0.14);
}

.bg-mansion::before {
  opacity: 0.55;
  background:
    linear-gradient(#fff0a4 0 0) 12% 52% / 14px 22px no-repeat,
    linear-gradient(#61c8ce 0 0) 27% 64% / 14px 22px no-repeat,
    linear-gradient(#fff0a4 0 0) 44% 35% / 14px 22px no-repeat,
    linear-gradient(#79c959 0 0) 64% 58% / 14px 22px no-repeat,
    linear-gradient(#fff0a4 0 0) 79% 42% / 14px 22px no-repeat,
    linear-gradient(#61c8ce 0 0) 92% 61% / 14px 22px no-repeat;
}

.bg-fog::before,
.bg-fog::after {
  background: radial-gradient(ellipse, rgba(255, 249, 224, 0.24) 0%, rgba(255, 249, 224, 0) 68%);
}

/* Color-block playground floor. */
.ground-strip {
  border-top-color: #4b2416;
  background:
    repeating-linear-gradient(
      to right,
      #ef5e43 0 42px,
      #ffb13e 42px 84px,
      #53bdc8 84px 126px,
      #8acb4f 126px 168px
    ) top / 100% 25px no-repeat,
    linear-gradient(to bottom, #db643d 0%, #a83a27 100%);
  box-shadow:
    inset 0 7px 0 rgba(255, 248, 201, 0.24),
    inset 0 31px 0 #f08a45;
}

/* Cream-and-coral arcade cabinetry. */
.top-bar {
  color: #fff9df;
  background:
    linear-gradient(to bottom, rgba(255, 246, 185, 0.18), transparent 34%),
    linear-gradient(to bottom, #ef6b43 0%, #cb432d 100%);
}

.screen-card {
  color: var(--text-main);
  background:
    linear-gradient(to bottom, rgba(255, 255, 236, 0.36), transparent 22%),
    linear-gradient(to bottom, #fff0b8 0%, #ffd16f 100%);
}

.panel {
  background:
    linear-gradient(to bottom, rgba(255, 244, 198, 0.16), transparent 25%),
    linear-gradient(to bottom, #ed7043 0%, #c9442e 100%);
}

.top-bar,
.screen-card,
.panel {
  border-color: #4b2416;
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 240, 0.30),
    0 9px 0 rgba(104, 34, 17, 0.28);
}

.logo-icon {
  border-color: #4b2416;
  background: #fff0a6;
}

.logo-text h1 {
  color: #fff1a1;
}

.logo-text p {
  color: #fff8e0;
}

.screen-title {
  color: #c63c2d;
  text-shadow: 4px 4px 0 rgba(255, 249, 213, 0.74);
}

.eyebrow {
  color: #087f91;
}

.screen-subtitle,
.start-tip,
.custom-help,
.saved-sets-header span,
.setting-copy p,
.setting-note,
.field-group > span,
.part-heading {
  color: #6b3b28;
}

.keycap {
  color: #fff9e6;
  background: #c6402c;
  border-color: #4b2416;
}

/* Friendly, chunky menu cards. */
.level-card {
  color: #4c2817;
  background:
    linear-gradient(to bottom, rgba(255, 255, 232, 0.32), transparent 24%),
    linear-gradient(to bottom, #ffd85d 0%, #f4a533 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 238, 0.32),
    0 6px 0 rgba(111, 38, 17, 0.28);
}

.level-card:nth-child(3n + 2) {
  background:
    linear-gradient(to bottom, rgba(255, 255, 237, 0.28), transparent 24%),
    linear-gradient(to bottom, #ff9a5b 0%, #ed6543 100%);
}

.level-card:nth-child(3n) {
  background:
    linear-gradient(to bottom, rgba(255, 255, 238, 0.28), transparent 24%),
    linear-gradient(to bottom, #69d0d3 0%, #35aeb7 100%);
}

.level-card.monster {
  background:
    linear-gradient(to bottom, rgba(255, 255, 237, 0.28), transparent 24%),
    linear-gradient(to bottom, #f66a58 0%, #d7433d 100%);
}

.level-card.custom {
  background:
    linear-gradient(to bottom, rgba(255, 255, 238, 0.28), transparent 24%),
    linear-gradient(to bottom, #9cd75d 0%, #6dbb45 100%);
}

.level-number {
  color: #c23a2b;
  text-shadow: 3px 3px 0 rgba(255, 246, 190, 0.75);
}

.level-name {
  color: #4b2718;
}

.level-desc {
  color: #6b3927;
}

.level-example {
  color: #fff9df;
  background: rgba(91, 40, 22, 0.45);
  border-color: rgba(75, 36, 22, 0.82);
}

/* Large, light custom editor. */
input,
textarea,
select,
#customScreen input,
#customScreen textarea,
#customScreen select {
  color: #4a2718;
  background: #fffdf0;
  border-color: #7b3b24;
  box-shadow: inset 0 4px 0 rgba(238, 153, 69, 0.13);
}

input::placeholder,
textarea::placeholder,
#customScreen input::placeholder,
#customScreen textarea::placeholder {
  color: #b67c5c;
}

.custom-part-card,
.saved-sets-panel,
.setting-box {
  color: #4b2718;
  background: rgba(255, 247, 205, 0.82);
  border-color: #9a4a2b;
}

.saved-sets-header h3,
.setting-copy strong {
  color: #b83a2d;
}

.saved-set-btn {
  color: #fff9df;
  background: #e46d43;
}

.saved-set-delete {
  color: #fff9df;
  background: #d44942;
}

/* Keep gameplay high contrast and energetic. */
.game-level-pill,
.space-hint {
  color: #fff9df;
  background: rgba(112, 35, 19, 0.88);
}

.panel-header,
.mini-info {
  color: #fff3d2;
}

.word-box {
  border-color: #4b2416;
  background:
    radial-gradient(circle at center, rgba(255, 174, 52, 0.14), transparent 58%),
    linear-gradient(to bottom, #4e2115 0%, #2b100a 100%);
}

.word-display {
  color: #fff9df;
  text-shadow: 7px 7px 0 #250b05;
}

.placeholder-word {
  color: #71dce0;
}

.bomb-scene {
  background:
    radial-gradient(circle at center, rgba(255, 231, 98, 0.16), transparent 58%),
    linear-gradient(to bottom, #fff1a9 0%, #f49c4f 100%);
}

.bomb-scene::before {
  background: #8d3b24;
}

.timer-display {
  color: #fff06d;
  background: rgba(76, 28, 14, 0.88);
}

.control-bar {
  color: #fff9df;
}

.timer-value,
.boom-text {
  color: #fff06d;
  text-shadow: 4px 4px 0 #4b160a;
}

.preset-btn {
  color: #fff9df;
  background: linear-gradient(to bottom, #e76d43 0%, #bd3e2c 100%);
}

.preset-btn.active {
  color: #4a2609;
  background: linear-gradient(to bottom, #fff16f 0%, #f4b62f 100%);
}

.toast {
  color: #fff9df;
  background: #a8412b;
}

/* Subtle playroom-brick detail. */
.screen-card::before {
  opacity: 0.075;
  background-image:
    linear-gradient(
      to bottom,
      rgba(182, 70, 39, 0.78) 0 30px,
      transparent 30px 64px
    ),
    linear-gradient(
      to bottom,
      transparent 0 32px,
      rgba(182, 70, 39, 0.78) 32px 62px,
      transparent 62px 64px
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(182, 70, 39, 0.78) 0 2px,
      transparent 2px 32px
    );
}


/* =========================================================
   V13 — ANIMATED BOMB CHARACTER
   The supplied drawings already include a fuse, so the older CSS fuse overlay
   is hidden to avoid displaying two fuses at once.
   ========================================================= */
.fuse-wrap {
  display: none;
}

.bomb-art {
  image-rendering: auto;
  transition: opacity 90ms linear, filter 180ms ease;
  filter: drop-shadow(0 14px 0 rgba(91, 42, 20, 0.2));
}

.bomb-art.art-change {
  animation: art-change-flash 150ms steps(2, end) 1, hover 2.1s steps(4, end) infinite;
}

.bomb-scene.mood-calm .bomb-art {
  filter: drop-shadow(0 14px 0 rgba(91, 42, 20, 0.20));
}

.bomb-scene.mood-worried .bomb-art {
  filter:
    drop-shadow(0 14px 0 rgba(91, 42, 20, 0.20))
    drop-shadow(0 0 12px rgba(255, 195, 56, 0.46));
  animation-duration: 1.65s;
}

.bomb-scene.mood-serious .bomb-art {
  filter:
    saturate(1.12)
    drop-shadow(0 14px 0 rgba(91, 42, 20, 0.20))
    drop-shadow(0 0 18px rgba(255, 117, 37, 0.62));
  animation-duration: 1.05s;
}

.bomb-scene.mood-panic .bomb-art {
  filter:
    saturate(1.25)
    drop-shadow(0 14px 0 rgba(91, 42, 20, 0.20))
    drop-shadow(0 0 24px rgba(235, 61, 44, 0.82));
  animation: panic-bob 150ms steps(2, end) infinite;
}

.bomb-scene.showing-explosion .bomb-art,
.bomb-scene.exploded.showing-explosion .bomb-art {
  width: min(92%, 450px);
  max-height: 430px;
  filter: drop-shadow(0 0 28px rgba(255, 116, 30, 0.76));
  animation: explosion-art-pop 520ms steps(5, end) 1;
}

.bomb-scene.showing-aftermath .bomb-art,
.bomb-scene.exploded.showing-aftermath .bomb-art {
  animation: aftermath-arrive 360ms steps(4, end) 1, hover 2.2s steps(4, end) 360ms infinite;
}

.bomb-scene.ending-ashes .bomb-art,
.bomb-scene.exploded.ending-ashes .bomb-art {
  animation: aftermath-arrive 360ms steps(4, end) 1;
  transform: translateY(22px);
}

.bomb-scene.ending-soot .bomb-art,
.bomb-scene.exploded.ending-soot .bomb-art {
  animation: soot-wobble 700ms steps(4, end) 1, hover 2.6s steps(4, end) 700ms infinite;
}

.bomb-scene.ending-just-kidding .bomb-art,
.bomb-scene.exploded.ending-just-kidding .bomb-art {
  animation: kidding-bounce 640ms steps(5, end) 1, hover 2.2s steps(4, end) 640ms infinite;
}

@keyframes art-change-flash {
  0% { opacity: 0.55; }
  100% { opacity: 1; }
}

@keyframes panic-bob {
  0% { transform: translate(-3px, -3px) rotate(-1deg); }
  50% { transform: translate(4px, 1px) rotate(1deg); }
  100% { transform: translate(-2px, 4px) rotate(-1deg); }
}

@keyframes explosion-art-pop {
  0% { transform: scale(0.45); opacity: 0; }
  35% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes aftermath-arrive {
  0% { transform: scale(0.72); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes soot-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  50% { transform: rotate(4deg); }
  75% { transform: rotate(-2deg); }
}

@keyframes kidding-bounce {
  0% { transform: translateY(18px) scale(0.82); opacity: 0; }
  45% { transform: translateY(-12px) scale(1.08); opacity: 1; }
  72% { transform: translateY(4px) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}


/* =========================================================
   V14 — FINAL TRANSPARENT ART SAFETY
   ========================================================= */
.bomb-art {
  display: block;
  background: transparent !important;
  object-fit: contain;
  color: transparent;
}

.bomb-art:not([src]),
.bomb-art[src=""] {
  visibility: hidden;
}

/* =========================================================
   V17 — SETTINGS SCREEN CONTRAST FIX
   Makes the pale yellow settings labels readable on cream cards.
   ========================================================= */
#settingsScreen .setting-title,
#settingsScreen .check-setting strong {
  color: #8f2f24;
  font-weight: 800;
  text-shadow: none;
}

#settingsScreen .setting-note,
#settingsScreen .check-setting small {
  color: #6b3b28;
}


/* =========================================================
   V18 — INTERACTIVE TUTORIAL SYSTEM
   ========================================================= */

.help-btn {
  min-width: 52px;
  font-size: 1.35rem;
  font-weight: 900;
  padding-inline: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(73, 37, 24, 0.70);
  backdrop-filter: blur(3px);
}

.help-card {
  width: min(760px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  padding: clamp(24px, 4vw, 42px);
  color: #4b2e1f;
  background:
    linear-gradient(rgba(255, 248, 224, 0.94), rgba(255, 238, 184, 0.96)),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(166, 92, 52, .10) 35px 38px);
  border: 6px solid #5b2c1c;
  box-shadow: 0 10px 0 #8c4b1f, 0 22px 45px rgba(61, 27, 12, .32);
}

.help-card h2,
.help-card h3 {
  color: #b33b2e;
  margin-top: 0;
}

.help-card h2 {
  font-family: "Press Start 2P", Arial, sans-serif;
  font-size: clamp(1.35rem, 2.6vw, 2.1rem);
  line-height: 1.35;
}

.help-card p,
.help-card li {
  font-size: 1.05rem;
  line-height: 1.65;
}

.help-badge {
  display: inline-block;
  margin-bottom: 14px;
  color: #007f92;
  font-weight: 900;
  letter-spacing: .08em;
}

.help-actions {
  display: flex;
  gap: 14px;
  margin-top: 26px;
}

.help-actions .pixel-btn.large {
  flex: 1;
}

.help-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.help-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.help-menu-option {
  min-height: 138px;
  padding: 20px;
  text-align: left;
  color: #4b2e1f;
  background: #fff8df;
  border: 5px solid #8f4a2a;
  box-shadow: 0 6px 0 #c06b28;
  cursor: pointer;
}

.help-menu-option:hover,
.help-menu-option:focus-visible {
  transform: translateY(-2px);
  outline: 4px solid #16a7ba;
  outline-offset: 2px;
}

.help-menu-option strong,
.help-menu-option span {
  display: block;
}

.help-menu-option strong {
  margin-bottom: 10px;
  color: #c43d30;
  font-size: 1.12rem;
}

.help-menu-option span {
  font-size: .95rem;
  line-height: 1.45;
}

.help-menu-option[disabled] {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.instructions-panel {
  margin-top: 24px;
  padding: 22px 24px;
  background: rgba(255,255,255,.58);
  border: 4px solid #d4873a;
}

.instructions-panel ol {
  padding-left: 1.5rem;
}

.tutorial-layer {
  position: fixed;
  inset: 0;
  z-index: 12000;
  pointer-events: none;
}

.tutorial-spotlight {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 100px;
  height: 60px;
  border: 6px solid #ffe066;
  border-radius: 8px;
  box-shadow:
    0 0 0 5px rgba(255, 111, 44, .78),
    0 0 0 9999px rgba(53, 25, 21, .68),
    0 0 26px 10px rgba(255, 224, 102, .7);
  transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease;
  pointer-events: none;
}

.tutorial-popover {
  position: fixed;
  width: min(440px, calc(100vw - 32px));
  padding: 22px;
  color: #4b2e1f;
  background: #fff8df;
  border: 5px solid #5b2c1c;
  box-shadow: 0 8px 0 #d47a22, 0 18px 35px rgba(56, 24, 12, .32);
  pointer-events: auto;
}

.tutorial-popover h3 {
  margin: 10px 0 12px;
  color: #c43d30;
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
}

.tutorial-popover p {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.55;
}

.tutorial-topline,
.tutorial-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tutorial-progress {
  color: #007f92;
  font-weight: 900;
}

.tutorial-skip {
  border: 0;
  padding: 4px;
  color: #7b452e;
  background: transparent;
  font: inherit;
  font-size: .88rem;
  text-decoration: underline;
  cursor: pointer;
}

.tutorial-action-row {
  margin-top: 18px;
}

.tutorial-action-hint {
  color: #8a5137;
  font-size: .88rem;
  line-height: 1.4;
}

body.tutorial-active .tutorial-target {
  position: relative;
  z-index: 12002 !important;
}

body.tutorial-active .tutorial-target,
body.tutorial-active .tutorial-target * {
  pointer-events: auto !important;
}

.tutorial-popover.tutorial-success {
  border-color: #168f74;
  box-shadow: 0 8px 0 #5abc48, 0 18px 35px rgba(56, 24, 12, .32);
}

@media (max-width: 760px) {
  .help-menu-grid {
    grid-template-columns: 1fr;
  }

  .stacked-on-small {
    flex-direction: column;
  }

  .tutorial-popover {
    left: 16px !important;
    right: 16px;
    width: auto;
  }
}


/* Last Bell Studio website integration */
.site-return-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 4px solid var(--pixel-border);
  color: var(--text-main);
  background: var(--panel-dark);
  box-shadow: inset 0 3px 0 rgba(255,255,255,0.08), 0 5px 0 rgba(0,0,0,0.34);
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.25;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.site-return-link:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.site-return-link:active {
  transform: translateY(3px);
  box-shadow: inset 0 3px 0 rgba(255,255,255,0.08), 0 2px 0 rgba(0,0,0,0.34);
}

.site-return-link:focus-visible {
  outline: 4px solid var(--ghost-blue);
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .site-return-link { min-height: 40px; font-size: 0.58rem; }
}


/* V13 QA: make level labels and timer +/- controls projector-readable */
#minusBtn,#plusBtn{min-width:72px;min-height:62px;padding:8px 16px;font-size:2rem;line-height:1;}
#levelScreen .level-name{font-size:clamp(.9rem,1.45vw,1.18rem);line-height:1.2;}

/* =========================================================
   V14 QA ROUND 2 — game header + timer-control balance
   ========================================================= */
.game-level-pill{
  width:100%;
  min-height:52px;
  padding:10px 20px;
  font-size:clamp(.72rem,1.05vw,.92rem);
  line-height:1.45;
}
#minusBtn,#plusBtn{
  min-width:64px;
  min-height:54px;
  padding:6px 14px;
  font-size:1.65rem;
  line-height:1;
  transform:translateY(4px);
}
.timer-value-wrap{min-width:108px;}
.timer-value{font-size:clamp(1.55rem,2.35vw,2rem);line-height:1;}
.timer-value-wrap small{margin-top:7px;font-size:.46rem;}


/* =========================================================
   V18 — TEACHER READABILITY + CUSTOM SET IMPORT / EXPORT
   ========================================================= */
.settings-card .setting-title,
.settings-card .check-setting strong{
  font-size:clamp(.78rem,1.05vw,1rem);
  line-height:1.45;
}
.settings-card .setting-note,
.settings-card .check-setting small{
  font-size:clamp(.72rem,.9vw,.9rem);
  line-height:1.55;
}
.settings-card input,
.settings-card select{
  font-size:clamp(.78rem,1vw,.95rem);
  line-height:1.5;
}
.settings-card .screen-title{font-size:clamp(1.55rem,3vw,2.4rem)}
.settings-card .eyebrow{font-size:clamp(.7rem,.85vw,.9rem)}
.visually-hidden-file{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:-1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;
  border:0!important;
}
.custom-actions #importSetsBtn,
.custom-actions #exportSetsBtn{min-width:150px}
