@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&family=Press+Start+2P&family=Silkscreen:wght@400;700&display=swap");

/* ==================================================
   COLORS
================================================== */

:root {
  --ink: #f1f7ff;
  --muted: #b8bed8;
  --purple-950: #090518;
  --purple-900: #120924;
  --purple-800: #211143;
  --purple-700: #392067;
  --purple-600: #5b318e;
  --violet: #9c72ff;
  --cyan: #61f0e4;
  --cyan-soft: #a6fff6;
  --green: #7dffac;
  --yellow: #ffe784;
  --red: #ff778d;
  --panel: rgba(12, 7, 29, 0.94);
  --panel-soft: rgba(31, 18, 62, 0.9);
  --border: #7656bb;
}

/* ==================================================
   GLOBAL
================================================== */

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: "Silkscreen", monospace;
  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(98, 52, 155, 0.4),
      transparent 42%
    ),
    linear-gradient(
      180deg,
      #080316 0%,
      #130824 52%,
      #05020c 100%
    );
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

/* ==================================================
   FULL-SCREEN GAME FRAME
================================================== */

#game-shell {
  position: relative;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  border: none;
  background: var(--purple-950);
  box-shadow: none;
  image-rendering: pixelated;
}

#game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.08;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 3px,
      rgba(255, 255, 255, 0.1) 4px,
      transparent 5px
    );
  mix-blend-mode: screen;
}

#game-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 21;
  pointer-events: none;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.5);
}

#app {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100vh;
}

/* ==================================================
   GENERAL SCREENS
================================================== */

.screen {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(
      rgba(7, 4, 18, 0.22),
      rgba(7, 4, 18, 0.8)
    ),
    radial-gradient(
      circle at 75% 18%,
      rgba(73, 255, 221, 0.1),
      transparent 22%
    ),
    linear-gradient(
      135deg,
      #221044,
      #0d071b 58%,
      #061825
    );
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.center-screen {
  display: grid;
  place-items: center;
  text-align: center;
}

/* ==================================================
   IMAGE-BACKED SCREENS
================================================== */

.image-screen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.screen-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: pixelated;
}

.image-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      rgba(7, 4, 18, 0.14),
      rgba(7, 4, 18, 0.58)
    );
}

.foreground-panel {
  position: relative;
  z-index: 2;
}

/* ==================================================
   TITLE SCREEN
================================================== */

.title-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: #080316;
}

.title-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: pixelated;
}

.title-start-button {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 14%;
  min-width: 320px;
  padding: 24px 38px;
  transform: translateX(-50%);
  color: #071112;
  border: 3px solid #9cfff5;
  background:
    linear-gradient(
      180deg,
      #9cfff5,
      #43cfc6
    );
  font-family: "Press Start 2P", monospace;
  font-size: 1.1rem;
  line-height: 1.5;
  box-shadow:
    6px 6px 0 #17072b,
    0 0 22px rgba(97, 240, 228, 0.65);
  cursor: pointer;
}

.title-start-button:hover {
  filter: brightness(1.15);
  transform: translateX(-50%) translateY(-2px);
}

.title-start-button:active {
  transform: translateX(-50%) translateY(2px);
  box-shadow:
    3px 3px 0 #17072b,
    0 0 15px rgba(97, 240, 228, 0.55);
}

/* ==================================================
   PIXEL PANELS
================================================== */

.pixel-panel {
  width: min(900px, 94%);
  padding: clamp(24px, 4vw, 48px);
  border: 3px solid var(--border);
  background: var(--panel);
  box-shadow:
    10px 10px 0 #05020b,
    inset 0 0 0 2px rgba(191, 163, 255, 0.13);
}

/* ==================================================
   TITLES AND TEXT
================================================== */

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-title,
.scene-title,
.ending-title,
.news-title,
.art-label {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  line-height: 1.45;
  text-transform: uppercase;
  text-shadow:
    4px 4px 0 #130726,
    0 0 15px rgba(97, 240, 228, 0.25);
}

.game-title {
  color: var(--cyan-soft);
  font-size: clamp(1.5rem, 4vw, 3.5rem);
}

.game-subtitle {
  max-width: 680px;
  margin: 18px auto 0;
  color: #e2ddf2;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1.6;
}

.setup-title {
  margin: 0 0 8px;
  color: var(--cyan-soft);
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1.35rem, 3vw, 2.4rem);
  line-height: 1.5;
  text-transform: uppercase;
}

.helper {
  max-width: 720px;
  margin: 12px auto 24px;
  color: #d6d3e7;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.7;
  letter-spacing: 0;
}

/* ==================================================
   BUTTONS
================================================== */

.primary-button,
.secondary-button,
.class-button,
.choice-button {
  border: 2px solid var(--violet);
  background:
    linear-gradient(
      180deg,
      #4f2c80,
      #2b164c
    );
  box-shadow: 5px 5px 0 #080310;
  cursor: pointer;
  transition:
    transform 100ms ease,
    filter 100ms ease,
    border-color 100ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.class-button:hover,
.choice-button:hover:not(:disabled) {
  filter: brightness(1.25);
  transform: translate(-1px, -1px);
}

.primary-button:active,
.secondary-button:active,
.class-button:active,
.choice-button:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 #080310;
}

.primary-button,
.secondary-button {
  min-width: 190px;
  padding: 15px 22px;
  font-family: "Silkscreen", monospace;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.primary-button {
  color: #071112;
  border-color: var(--cyan);
  background:
    linear-gradient(
      180deg,
      #9cfff5,
      #43cfc6
    );
}

.secondary-button {
  color: var(--ink);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
}

/* Keep the title button centered despite the generic hover rules. */
.title-start-button:hover {
  transform: translateX(-50%) translateY(-2px);
}

.title-start-button:active {
  transform: translateX(-50%) translateY(2px);
}

/* ==================================================
   CLASS SELECTION
================================================== */

.class-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 14px;
  margin: 28px 0;
}

.class-button {
  padding: 18px 10px;
  color: var(--ink);
  font-family: "Silkscreen", monospace;
  font-size: 1.25rem;
  font-weight: 700;
}

.class-button.selected {
  color: #071112;
  border-color: var(--cyan);
  background: var(--cyan);
}

/* ==================================================
   FORMS
================================================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
  text-align: left;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--cyan-soft);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.form-field input {
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  color: var(--ink);
  border: 2px solid #65429e;
  outline: none;
  background: #0c0718;
  font-family: "Silkscreen", monospace;
  font-size: 1.1rem;
  line-height: 1.4;
  box-shadow: inset 4px 4px 0 rgba(0, 0, 0, 0.4);
}

.form-field input:focus {
  border-color: var(--cyan);
  box-shadow:
    inset 4px 4px 0 rgba(0, 0, 0, 0.35),
    0 0 12px rgba(97, 240, 228, 0.25);
}

.form-field input::placeholder {
  color: #827b9b;
}

.error-box {
  display: none;
  margin-top: 16px;
  padding: 13px;
  color: #26050c;
  border: 2px solid var(--red);
  background: #ff9aac;
  font-family: "Silkscreen", monospace;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.error-box.visible {
  display: block;
}

/* ==================================================
   GAME HUD
================================================== */

.hud {
  display: grid;
  grid-template-columns: 1.3fr repeat(4, 1fr);
  gap: 8px;
  padding: 10px;
  border-bottom: 3px solid #5d3b91;
  background: rgba(8, 4, 18, 0.97);
}

.hud-cell {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #4f3975;
  background: #160b2d;
}

.hud-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hud-value {
  display: block;
  overflow: hidden;
  color: var(--cyan-soft);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================================================
   GAMEPLAY LAYOUT
================================================== */

.gameplay {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  background: #080412;
}

/* ==================================================
   SCENE ART
================================================== */

.scene-art {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  min-height: clamp(340px, 52vh, 600px);
  place-items: center;
  overflow: hidden;
  border-bottom: 3px solid #5d3b91;
  background:
    radial-gradient(
      circle at 50% 20%,
      rgba(80, 42, 137, 0.18),
      transparent 40%
    ),
    #080412;
}

.scene-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: pixelated;
}

.scene-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(8, 3, 18, 0.03),
      rgba(8, 3, 18, 0.38)
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 31px,
      rgba(97, 240, 228, 0.03) 32px
    );
}

.art-label {
  position: relative;
  z-index: 2;
  max-width: 82%;
  padding: 14px 18px;
  color: var(--cyan-soft);
  border: 2px solid rgba(97, 240, 228, 0.62);
  background: rgba(8, 4, 20, 0.82);
  font-size: clamp(0.8rem, 1.8vw, 1.4rem);
  text-align: center;
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.48);
}

/* ==================================================
   COMPACT SCENE CONTENT
================================================== */

.scene-content {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  padding: 14px 24px 20px;
  background:
    radial-gradient(
      circle at 85% 0%,
      rgba(85, 255, 224, 0.07),
      transparent 23%
    ),
    linear-gradient(
      180deg,
      #160b2c,
      #0a0514
    );
}

.scene-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.scene-title {
  color: #ece7ff;
  font-size: clamp(0.9rem, 1.6vw, 1.35rem);
}

.scene-location {
  flex: 0 0 auto;
  color: var(--cyan);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

.scene-copy,
.result-copy {
  margin: 0;
  color: #f4f1ff;
  font-family: "Silkscreen", monospace;
  font-size: clamp(0.9rem, 1.25vw, 1.12rem);
  line-height: 1.5;
  letter-spacing: 0;
}

.cinematic-copy {
  margin: 0;
  color: #f4f1ff;
  font-family: "Silkscreen", monospace;
  font-size: clamp(1.05rem, 1.65vw, 1.4rem);
  line-height: 1.75;
  letter-spacing: 0;
}

.vocab {
  color: var(--cyan);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(97, 240, 228, 0.45);
  text-underline-offset: 4px;
}

/* ==================================================
   DECISION CHOICES
================================================== */

.choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding-top: 0;
}

.choice-button {
  position: relative;
  display: flex;
  min-height: 88px;
  align-items: flex-start;
  gap: 12px;
  padding: 13px;
  color: var(--ink);
  text-align: left;
}

.choice-letter {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #071112;
  background: var(--cyan);
  font-size: 1rem;
  font-weight: 700;
}

.choice-copy {
  font-family: "Silkscreen", monospace;
  font-size: clamp(0.86rem, 1vw, 1rem);
  line-height: 1.4;
}

.choice-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.75) brightness(0.65);
}

.choice-button:disabled .choice-letter {
  color: #211629;
  background: #8b8096;
}

.lock-text {
  display: block;
  margin-top: 8px;
  color: var(--red);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* ==================================================
   RESULT SCREENS
================================================== */

.result-panel {
  margin-top: 10px;
  padding: 15px;
  border: 2px solid #6c4ca0;
  background: rgba(6, 3, 14, 0.84);
}

.stat-changes,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.stat-chip,
.status-badge {
  padding: 9px 12px;
  border: 1px solid;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.stat-chip.positive {
  color: #07110a;
  border-color: var(--green);
  background: var(--green);
}

.stat-chip.negative {
  color: #26050c;
  border-color: var(--red);
  background: var(--red);
}

.stat-chip.neutral {
  color: #201a06;
  border-color: var(--yellow);
  background: var(--yellow);
}

.status-badge {
  color: var(--cyan-soft);
  border-color: #5e4e86;
  background: #20143a;
  text-transform: uppercase;
}

/* ==================================================
   SCHOOL NEWS
================================================== */

.news-panel {
  border-color: #d9bf58;
  box-shadow:
    10px 10px 0 #05020b,
    inset 0 0 28px rgba(255, 231, 132, 0.07);
}

.news-title {
  margin: 0 0 20px;
  color: var(--yellow);
  font-size: clamp(0.9rem, 2.2vw, 1.55rem);
}

.news-list {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  color: #f4f0dc;
  font-family: "Silkscreen", monospace;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.7;
  list-style: none;
  text-align: left;
}

.news-list li {
  padding-left: 20px;
  border-left: 4px solid var(--yellow);
}

/* ==================================================
   CINEMATIC SCREENS
================================================== */

.cinematic-panel {
  max-width: 880px;
}

.transmission {
  color: var(--cyan-soft);
  text-shadow: 0 0 12px rgba(97, 240, 228, 0.35);
}

/* ==================================================
   CONCLUSION SCREEN
================================================== */

.conclusion {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(
      circle at 50% -5%,
      rgba(105, 82, 184, 0.35),
      transparent 45%
    ),
    linear-gradient(
      180deg,
      #130a29,
      #07030f
    );
}

.conclusion-content {
  width: 100%;
  min-height: 100vh;
  padding: clamp(22px, 4vw, 46px);
}

.ending-title {
  color: var(--cyan-soft);
  font-size: clamp(1.1rem, 2.7vw, 2.15rem);
}

.ending-copy {
  max-width: 950px;
  margin: 20px auto 28px;
  color: #e8e3f8;
  font-family: "Silkscreen", monospace;
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  line-height: 1.7;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: min(1080px, 100%);
  margin: 0 auto;
}

.report-card {
  padding: 16px;
  border: 2px solid #5e428f;
  background: rgba(20, 10, 42, 0.92);
  text-align: left;
}

.report-card.highlight {
  border-color: var(--cyan);
  background: rgba(15, 55, 64, 0.58);
}

.report-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  text-transform: uppercase;
}

.report-value {
  display: block;
  margin-top: 7px;
  color: var(--cyan-soft);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
}

.performance {
  width: min(1080px, 100%);
  margin: 20px auto 0;
  padding: 20px;
  border: 2px solid #5e428f;
  background: rgba(8, 4, 18, 0.88);
  text-align: left;
}

.performance h3 {
  margin: 0 0 14px;
  color: var(--yellow);
  font-family: "Press Start 2P", monospace;
  font-size: 1rem;
  line-height: 1.5;
}

.performance p {
  margin: 8px 0;
  color: #ddd7f0;
  font-family: "Silkscreen", monospace;
  font-size: 1.05rem;
  line-height: 1.6;
}

.rank {
  color: var(--yellow);
}

/* ==================================================
   CROSSWORD PLACEHOLDER
================================================== */

.placeholder-box {
  margin: 24px auto;
  padding: 34px;
  border: 3px dashed #7250a8;
  background: rgba(13, 7, 27, 0.78);
  color: var(--muted);
}

.small-note {
  color: var(--muted);
  font-family: "Silkscreen", monospace;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ==================================================
   TABLET
================================================== */

@media (max-width: 860px) {
  .hud {
    grid-template-columns: repeat(2, 1fr);
  }

  .hud-cell:first-child {
    grid-column: span 2;
  }

  .choices,
  .report-grid {
    grid-template-columns: 1fr 1fr;
  }

  .choice-button:last-child {
    grid-column: 1 / -1;
  }

  .title-start-button {
    bottom: 10%;
  }

  .scene-art {
    min-height: clamp(300px, 45vh, 480px);
  }
}

/* ==================================================
   MOBILE
================================================== */

@media (max-width: 600px) {
  .screen {
    padding: 14px;
  }

  .pixel-panel {
    width: 100%;
    padding: 22px 16px;
  }

  .class-grid,
  .form-grid,
  .choices,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .choice-button:last-child,
  .hud-cell:first-child {
    grid-column: auto;
  }

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

  .scene-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .title-start-button {
    bottom: 7%;
    min-width: 230px;
    padding: 17px 24px;
    font-size: 0.8rem;
  }

  .scene-art {
    min-height: 260px;
  }

  .scene-content {
    padding: 13px 14px 18px;
  }
}


/* ==================================================
   TRANSMISSION VIDEO
================================================== */

.video-screen {
  padding: clamp(18px, 3vw, 40px);
  background:
    radial-gradient(
      circle at center,
      rgba(62, 255, 225, 0.09),
      transparent 44%
    ),
    linear-gradient(
      180deg,
      #120722,
      #05020c
    );
}

.video-panel {
  width: min(1100px, 96%);
  padding: clamp(18px, 3vw, 32px);
  text-align: center;
  border: 3px solid var(--border);
  background: rgba(8, 4, 20, 0.96);
  box-shadow:
    10px 10px 0 #030107,
    0 0 30px rgba(97, 240, 228, 0.12);
}

.transmission-video {
  display: block;
  width: 100%;
  max-height: 65vh;
  margin: 20px auto 0;
  border: 3px solid var(--cyan);
  background: #000;
  box-shadow: 0 0 22px rgba(97, 240, 228, 0.3);
  object-fit: contain;
}

/* ==================================================
   KOREAN MECHANICS SCREEN
================================================== */

.mechanics-screen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.mechanics-panel {
  width: min(1050px, 96%);
  padding: clamp(22px, 3vw, 38px);
}

.mechanics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 26px;
  text-align: left;
}

.mechanics-card {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 16px;
  padding: 22px;
  border: 2px solid #67489b;
  background: rgba(10, 6, 24, 0.92);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45);
}

.mechanics-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.mechanics-card h3 {
  margin: 0 0 14px;
  color: var(--cyan-soft);
  font-family: "Noto Sans KR", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
}

.mechanics-card h3 span {
  display: block;
  margin-top: 3px;
  color: var(--cyan);
  font-family: "Silkscreen", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.mechanics-card p {
  margin: 8px 0;
  color: #f0edf9;
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: 1.05rem;
  line-height: 1.65;
  word-break: keep-all;
}

.mechanics-warning {
  margin: 22px 0 0;
  color: var(--yellow);
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  word-break: keep-all;
}

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

  .mechanics-card {
    grid-template-columns: 48px 1fr;
  }

  .transmission-video {
    max-height: 52vh;
  }
}

/* ==================================================
   MUSIC CONTROL
================================================== */

.music-toggle {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 100;

  min-width: 126px;
  padding: 10px 13px;

  color: var(--cyan-soft);
  border: 2px solid var(--cyan);
  background: rgba(8, 4, 20, 0.92);

  font-family: "Silkscreen", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;

  box-shadow:
    4px 4px 0 #05020b,
    0 0 12px rgba(97, 240, 228, 0.25);

  cursor: pointer;
}

.music-toggle:hover {
  filter: brightness(1.2);
}

.music-toggle:active {
  transform: translateY(2px);
  box-shadow: 2px 2px 0 #05020b;
}

@media (max-width: 600px) {
  .music-toggle {
    top: 8px;
    right: 8px;
    min-width: 108px;
    padding: 8px 10px;
    font-size: 0.68rem;
  }
}

#game-shell .title-screen .title-start-button {
  width: 420px !important;
  min-width: 420px !important;
  padding: 30px 48px !important;

  font-size: 1.35rem !important;
  line-height: 1.6 !important;

  transform: translateX(-50%) !important;
}

#game-shell .title-screen .title-start-button:hover {
  transform:
    translateX(-50%)
    translateY(-2px) !important;
}

#game-shell .title-screen .title-start-button:active {
  transform:
    translateX(-50%)
    translateY(2px) !important;
}

/* ==================================================
   FULL-SCREEN CROSSWORD PAGE
================================================== */

.crossword-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: #030107;
}

.crossword-full-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #030107;
  image-rendering: auto;
}

.crossword-controls {
  position: absolute;
  right: 22px;
  bottom: 20px;
  z-index: 40;
  display: flex;
  gap: 12px;
}

.crossword-controls .primary-button,
.crossword-controls .secondary-button {
  min-width: 150px;
  padding: 11px 15px;
  font-size: 0.78rem;
  background-color: rgba(8, 4, 20, 0.94);
}

.crossword-missing {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--cyan);
  font-family: "Press Start 2P", monospace;
  font-size: clamp(0.8rem, 2vw, 1.3rem);
}

@media (max-width: 600px) {
  .crossword-controls {
    right: 10px;
    bottom: 10px;
    left: 10px;
    justify-content: center;
  }

  .crossword-controls .primary-button,
  .crossword-controls .secondary-button {
    min-width: 0;
    flex: 1;
    padding: 9px 10px;
    font-size: 0.65rem;
  }
}

/* ==================================================
   COMMERCIAL EDITION — TITLE MENU
================================================== */

#game-shell .title-screen .title-actions {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 7%;
  display: grid;
  width: min(440px, 86vw);
  gap: 14px;
  transform: translateX(-50%);
}

#game-shell .title-screen .title-actions .title-start-button,
#game-shell .title-screen .title-actions .title-menu-button {
  position: static !important;
  left: auto !important;
  bottom: auto !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  transform: none !important;
}

#game-shell .title-screen .title-actions .title-start-button {
  padding: 24px 38px !important;
  font-size: 1.18rem !important;
  line-height: 1.5 !important;
}

#game-shell .title-screen .title-actions .title-menu-button {
  padding: 17px 26px;
  color: var(--ink);
  border-color: var(--violet);
  background:
    linear-gradient(
      180deg,
      rgba(84, 46, 137, 0.96),
      rgba(37, 19, 71, 0.98)
    );
  font-family: "Press Start 2P", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  box-shadow:
    6px 6px 0 #17072b,
    0 0 18px rgba(156, 114, 255, 0.35);
}

#game-shell .title-screen .title-actions .title-start-button:hover,
#game-shell .title-screen .title-actions .title-menu-button:hover {
  transform: translate(-1px, -1px) !important;
}

#game-shell .title-screen .title-actions .title-start-button:active,
#game-shell .title-screen .title-actions .title-menu-button:active {
  transform: translate(3px, 3px) !important;
}

/* ==================================================
   COMMERCIAL EDITION — TEACHER MENU
================================================== */

.teacher-screen,
.teacher-resource-screen {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.teacher-screen {
  align-items: start;
  padding-top: clamp(70px, 10vh, 110px);
  padding-bottom: 48px;
}

.teacher-panel {
  width: min(1120px, 96%);
}

.teacher-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
  text-align: left;
}

.teacher-menu-card {
  display: grid;
  grid-template-columns: 54px 1fr;
  grid-template-areas:
    "icon title"
    "icon copy";
  gap: 8px 16px;
  min-height: 150px;
  padding: 22px;
  color: var(--ink);
  border: 2px solid #67489b;
  background:
    linear-gradient(
      135deg,
      rgba(43, 23, 80, 0.98),
      rgba(10, 6, 24, 0.98)
    );
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.5);
  text-align: left;
  cursor: pointer;
  transition:
    transform 100ms ease,
    filter 100ms ease,
    border-color 100ms ease;
}

.teacher-menu-card:hover {
  filter: brightness(1.16);
  border-color: var(--cyan);
  transform: translate(-2px, -2px);
}

.teacher-menu-card:active {
  transform: translate(3px, 3px);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
}

.teacher-menu-icon {
  grid-area: icon;
  font-size: 2.3rem;
  line-height: 1;
}

.teacher-menu-title {
  grid-area: title;
  color: var(--cyan-soft);
  font-family: "Press Start 2P", monospace;
  font-size: clamp(0.78rem, 1.4vw, 1rem);
  line-height: 1.6;
  text-transform: uppercase;
}

.teacher-menu-copy {
  grid-area: copy;
  color: #ddd8ed;
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

/* ==================================================
   COMMERCIAL EDITION — TEACHER RESOURCES
================================================== */

.teacher-resource-screen {
  display: block;
  height: 100vh;
  min-height: 100vh;
  padding: clamp(64px, 7vw, 88px) 22px 48px;
}

.teacher-resource-wrap {
  width: 100%;
}

.teacher-resource-panel {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.teacher-guide-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
  text-align: left;
}

.teacher-info-card,
.settings-card {
  padding: 20px;
  border: 2px solid #5e428f;
  background: rgba(10, 6, 24, 0.94);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.42);
}

.teacher-info-card.wide {
  grid-column: 1 / -1;
}

.teacher-info-card h2,
.settings-card h2 {
  margin: 0 0 12px;
  color: var(--cyan-soft);
  font-family: "Press Start 2P", monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  text-transform: uppercase;
}

.teacher-info-card p,
.teacher-info-card li,
.settings-card p,
.settings-card label {
  color: #ede9f7;
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
}

.teacher-info-card p,
.settings-card p {
  margin: 0;
}

.teacher-info-card ul,
.teacher-info-card ol {
  margin: 0;
  padding-left: 22px;
}

.teacher-info-card li + li {
  margin-top: 6px;
}

/* ==================================================
   COMMERCIAL EDITION — VOCABULARY GUIDE
================================================== */

.vocabulary-panel {
  width: min(1240px, 100%);
}

.vocabulary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
  text-align: left;
}

.vocabulary-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  min-height: 126px;
  padding: 16px;
  border: 2px solid #57407f;
  background: rgba(10, 6, 24, 0.94);
}

.vocabulary-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #071112;
  background: var(--cyan);
  font-family: "Silkscreen", monospace;
  font-size: 0.92rem;
  font-weight: 700;
}

.vocabulary-card h2 {
  margin: 0;
  color: var(--cyan-soft);
  font-family: "Press Start 2P", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  text-transform: uppercase;
}

.vocabulary-card p {
  margin: 8px 0 6px;
  color: #f0edf9;
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: 0.96rem;
  line-height: 1.45;
}

.vocabulary-card span {
  color: var(--yellow);
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
}

/* ==================================================
   COMMERCIAL EDITION — MEDIA SETTINGS
================================================== */

.media-settings-panel {
  width: min(1120px, 100%);
}

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

.settings-action {
  width: 100%;
  margin-top: 18px;
}

.range-label {
  display: block;
  margin-top: 22px;
  color: var(--cyan-soft) !important;
  font-weight: 700;
}

.volume-slider {
  width: 100%;
  margin-top: 12px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  cursor: pointer;
}

.toggle-row input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--cyan);
}

.settings-video-preview {
  display: block;
  width: 100%;
  max-height: 260px;
  margin-top: 14px;
  border: 2px solid var(--cyan);
  background: #000;
  object-fit: contain;
}

.settings-warning,
.settings-status {
  margin-top: 14px !important;
  color: var(--yellow) !important;
}

.danger-action {
  border-color: var(--red);
}

/* ==================================================
   COMMERCIAL EDITION — RESPONSIVE
================================================== */

@media (max-width: 820px) {
  .teacher-menu-grid,
  .teacher-guide-grid,
  .settings-grid,
  .vocabulary-grid {
    grid-template-columns: 1fr;
  }

  .teacher-info-card.wide {
    grid-column: auto;
  }

  .teacher-screen {
    padding-top: 70px;
  }
}

@media (max-width: 600px) {
  #game-shell .title-screen .title-actions {
    bottom: 5%;
    width: min(340px, 88vw);
    gap: 10px;
  }

  #game-shell .title-screen .title-actions .title-start-button {
    padding: 18px 22px !important;
    font-size: 0.82rem !important;
  }

  #game-shell .title-screen .title-actions .title-menu-button {
    padding: 13px 18px;
    font-size: 0.64rem;
  }

  .teacher-resource-screen {
    padding: 64px 12px 28px;
  }

  .teacher-resource-panel,
  .teacher-panel {
    padding: 20px 14px;
  }

  .teacher-menu-card {
    grid-template-columns: 42px 1fr;
    min-height: 130px;
    padding: 16px;
  }

  .teacher-menu-icon {
    font-size: 1.8rem;
  }

  .vocabulary-card {
    grid-template-columns: 40px 1fr;
  }

  .vocabulary-number {
    width: 36px;
    height: 36px;
  }
}


/* ==================================================
   COMMERCIAL EDITION — CROSSWORD RESOURCE HUB
================================================== */

.crossword-resource-menu-screen .teacher-panel {
  width: min(1120px, 96%);
}

.crossword-resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
  text-align: left;
}

.crossword-resource-grid .teacher-menu-card {
  grid-template-columns: 1fr;
  grid-template-areas:
    "icon"
    "title"
    "copy";
  min-height: 225px;
  align-content: start;
}

.crossword-resource-grid .teacher-menu-icon {
  margin-bottom: 5px;
}

.crossword-resource-screen {
  min-height: 100vh;
}

.crossword-display-panel {
  width: min(1420px, 100%);
}

.crossword-workspace {
  display: grid;
  grid-template-columns: minmax(500px, 1.05fr) minmax(430px, 0.95fr);
  gap: 20px;
  align-items: start;
  margin-top: 24px;
}

.crossword-grid-card,
.crossword-clues-card,
.crossword-teacher-grid-wrap {
  padding: clamp(14px, 2vw, 24px);
  border: 2px solid #65489a;
  background: rgba(5, 3, 14, 0.94);
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.48);
}

.crossword-grid {
  display: grid;
  grid-template-columns: repeat(var(--crossword-columns), minmax(0, 1fr));
  width: min(100%, 790px);
  margin: 0 auto;
  border: 3px solid var(--cyan);
  background: #020105;
  box-shadow: 0 0 22px rgba(97, 240, 228, 0.18);
  aspect-ratio: 28 / 25;
}

.crossword-cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  aspect-ratio: 1;
}

.crossword-block {
  background: #080412;
}

.crossword-open-cell {
  color: #061215;
  border: 1px solid #12101a;
  background: #f5f8ff;
  font-family: "Silkscreen", monospace;
  font-size: clamp(0.46rem, 1.05vw, 0.9rem);
  font-weight: 700;
  line-height: 1;
}

.crossword-answer-cell {
  color: #061215;
  background: #bdfff7;
}

.crossword-cell-number {
  position: absolute;
  top: 1px;
  left: 2px;
  font-family: Arial, sans-serif;
  font-size: clamp(0.27rem, 0.5vw, 0.48rem);
  font-weight: 700;
  line-height: 1;
}

.crossword-cell-letter {
  transform: translateY(1px);
}

.crossword-clues-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.crossword-clue-column h2 {
  margin: 0 0 14px;
  padding-bottom: 8px;
  color: var(--cyan);
  border-bottom: 2px solid #7451ae;
  font-family: "Press Start 2P", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  text-transform: uppercase;
}

.crossword-clue-column ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.crossword-clue-column li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  color: #f0edf9;
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: 0.96rem;
  line-height: 1.45;
  word-break: keep-all;
}

.crossword-clue-number {
  color: var(--yellow);
  font-family: "Silkscreen", monospace;
  font-weight: 700;
}

.crossword-inline-answer {
  display: block;
  margin-top: 3px;
  color: var(--cyan-soft);
  font-family: "Silkscreen", monospace;
  font-size: 0.83rem;
  text-transform: uppercase;
}

.crossword-teacher-grid-wrap {
  width: min(920px, 100%);
  margin: 24px auto;
}

.crossword-answer-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 2px solid #5e428f;
  background: rgba(7, 4, 17, 0.95);
}

.crossword-answer-table {
  width: 100%;
  border-collapse: collapse;
  color: #f2effc;
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: 0.96rem;
  line-height: 1.45;
}

.crossword-answer-table th,
.crossword-answer-table td {
  padding: 12px 13px;
  border: 1px solid #4d376f;
  text-align: left;
  vertical-align: top;
}

.crossword-answer-table th {
  color: #061215;
  background: var(--cyan);
  font-family: "Silkscreen", monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.crossword-answer-table tbody tr:nth-child(even) {
  background: rgba(57, 32, 103, 0.25);
}

.crossword-answer-table strong {
  color: var(--cyan-soft);
  font-family: "Silkscreen", monospace;
  text-transform: uppercase;
}

/* ==================================================
   PRINTABLE CROSSWORD
================================================== */

.printable-resource-screen {
  min-height: 100vh;
  padding: 84px 22px 44px;
  color: #101010;
  background: #171024;
}

.printable-controls {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 150;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  max-width: calc(100vw - 180px);
}

.printable-controls .primary-button,
.printable-controls .secondary-button {
  min-width: 0;
  padding: 10px 13px;
  font-size: 0.72rem;
}

.printable-crossword-sheet {
  width: min(1180px, 100%);
  min-height: 760px;
  margin: 0 auto;
  padding: 28px;
  background: #fff;
  box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.5);
}

.printable-crossword-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 3px solid #111;
}

.printable-crossword-header p {
  margin: 0 0 7px;
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.printable-crossword-header h1 {
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 1.65rem;
}

.printable-student-fields {
  display: grid;
  gap: 9px;
  min-width: 270px;
  font-family: Arial, sans-serif;
  font-size: 0.92rem;
}

.printable-crossword-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.15fr) minmax(360px, 0.85fr);
  gap: 24px;
  align-items: start;
  margin-top: 22px;
}

.printable-grid-area .crossword-grid {
  width: 100%;
  border: 2px solid #111;
  box-shadow: none;
}

.printable-grid-area .crossword-block {
  background: #111;
}

.printable-grid-area .crossword-open-cell,
.printable-grid-area .crossword-answer-cell {
  color: #000;
  border-color: #555;
  background: #fff;
}

.printable-grid-area .crossword-cell-number {
  font-size: 0.42rem;
}

.printable-grid-area .crossword-cell-letter {
  font-size: 0.74rem;
}

.printable-instruction {
  margin: 0 0 14px;
  color: #111;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.printable-clues-grid {
  gap: 18px;
}

.printable-clues-grid .crossword-clue-column h2 {
  color: #111;
  border-color: #111;
  font-family: Arial, sans-serif;
  font-size: 1rem;
}

.printable-clues-grid .crossword-clue-column li {
  grid-template-columns: 27px 1fr;
  gap: 5px;
  color: #111;
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: 0.73rem;
  line-height: 1.25;
}

.printable-clues-grid .crossword-clue-number {
  color: #111;
  font-family: Arial, sans-serif;
}

.printable-clues-grid .crossword-inline-answer {
  color: #111;
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
}

@media (max-width: 1050px) {
  .crossword-resource-grid,
  .crossword-workspace,
  .printable-crossword-layout {
    grid-template-columns: 1fr;
  }

  .crossword-resource-grid .teacher-menu-card {
    min-height: 150px;
  }

  .printable-crossword-sheet {
    min-width: 820px;
  }

  .printable-resource-screen {
    overflow-x: auto;
  }
}

@media (max-width: 700px) {
  .crossword-clues-grid {
    grid-template-columns: 1fr;
  }

  .crossword-workspace {
    grid-template-columns: 1fr;
  }

  .crossword-grid-card,
  .crossword-clues-card {
    padding: 10px;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 9mm;
  }

  html,
  body,
  #game-shell,
  #app,
  .printable-resource-screen {
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    color: #000;
    background: #fff !important;
  }

  #game-shell::before,
  #game-shell::after,
  .music-toggle,
  .no-print {
    display: none !important;
  }

  .printable-crossword-sheet {
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    break-inside: avoid;
  }

  .printable-crossword-layout {
    grid-template-columns: 58% 42%;
    gap: 8mm;
    margin-top: 5mm;
  }

  .printable-crossword-header {
    padding-bottom: 3mm;
  }

  .printable-crossword-header h1 {
    font-size: 15pt;
  }

  .printable-student-fields {
    min-width: 60mm;
    font-size: 9pt;
  }

  .printable-grid-area .crossword-grid {
    max-height: 174mm;
  }

  .printable-clues-grid .crossword-clue-column li {
    font-size: 7.4pt;
  }
}


/* ==================================================
   PROJECTOR-FIRST CROSSWORD DISPLAY
================================================== */

.crossword-clue-only-screen {
  min-height: 100vh;
}

.crossword-clue-only-screen .teacher-resource-wrap {
  width: 100%;
  min-height: 100vh;
  padding: 18px;
}

.crossword-clue-only-panel {
  width: min(1540px, 100%);
  min-height: calc(100vh - 36px);
  padding: clamp(22px, 2.2vw, 36px);
}

.crossword-projector-header {
  text-align: center;
}

.crossword-projector-header .setup-title {
  font-size: clamp(1.55rem, 3vw, 2.8rem);
}

.crossword-projector-note {
  margin: 12px 0 0;
  color: #e4def4;
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: clamp(1rem, 1.35vw, 1.3rem);
  font-weight: 600;
  line-height: 1.45;
}

.crossword-clue-only-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 70px);
  margin: clamp(20px, 2.5vh, 30px) auto 0;
  padding: clamp(18px, 2vw, 30px);
  border: 2px solid #65489a;
  background: rgba(5, 3, 14, 0.95);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.48);
}

.crossword-clue-only-grid .crossword-clue-column h2 {
  margin-bottom: 16px;
  padding-bottom: 10px;
  color: var(--cyan);
  border-bottom-width: 3px;
  font-size: clamp(1rem, 1.45vw, 1.35rem);
}

.crossword-clue-only-grid .crossword-clue-column ol {
  gap: clamp(8px, 1vh, 13px);
}

.crossword-clue-only-grid .crossword-clue-column li {
  grid-template-columns: 58px 1fr;
  gap: 12px;
  color: #fff;
  font-size: clamp(1.18rem, 1.65vw, 1.78rem);
  font-weight: 700;
  line-height: 1.28;
}

.crossword-clue-only-grid .crossword-clue-number {
  font-size: 0.9em;
}

.crossword-projector-controls {
  margin-top: clamp(18px, 2vh, 28px);
}

.crossword-projector-controls .primary-button,
.crossword-projector-controls .secondary-button {
  min-width: 215px;
}

.crossword-route-note {
  border-color: var(--yellow);
  background: rgba(68, 53, 13, 0.36);
}

/* ==================================================
   UPLOADED PRINTABLE CROSSWORD
================================================== */

.printable-image-resource-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.printable-image-sheet {
  width: min(1540px, calc(100vw - 44px));
  margin: 0 auto;
  padding: 12px;
  background: #fff;
  box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.52);
}

.printable-crossword-image {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  object-fit: contain;
}

.printable-image-missing {
  display: grid;
  min-height: 70vh;
  place-items: center;
  color: #111;
  font-family: Arial, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 900px) {
  .crossword-clue-only-grid {
    grid-template-columns: 1fr;
  }

  .crossword-clue-only-panel {
    min-height: 100vh;
  }
}

@media print {
  .printable-image-sheet {
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  .printable-crossword-image {
    width: 100%;
    max-height: 190mm;
    object-fit: contain;
  }
}


/* ==================================================
   QUICK TUTORIAL + PERSISTENT HELP
================================================== */

.help-toggle {
  position: fixed;
  top: 14px;
  right: 154px;
  z-index: 110;

  width: 44px;
  height: 44px;
  padding: 0;

  color: var(--cyan-soft);
  border: 2px solid var(--cyan);
  background: rgba(8, 4, 20, 0.94);

  font-family: "Press Start 2P", monospace;
  font-size: 1rem;
  line-height: 1;

  box-shadow:
    4px 4px 0 #05020b,
    0 0 12px rgba(97, 240, 228, 0.25);

  cursor: pointer;
}

.help-toggle:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}

.help-toggle:active {
  transform: translateY(2px);
  box-shadow: 2px 2px 0 #05020b;
}

.tutorial-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
}

.tutorial-modal-backdrop,
.tutorial-fullscreen {
  position: absolute;
  inset: 0;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  overflow: auto;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 10%, rgba(86, 51, 144, 0.24), transparent 36%),
    rgba(2, 1, 8, 0.96);
  backdrop-filter: blur(4px);
}

.tutorial-first-run-panel,
.tutorial-help-panel,
.tutorial-complete-panel {
  position: relative;
  width: min(760px, 94vw);
  text-align: center;
}

.tutorial-first-run-panel .helper,
.tutorial-help-panel .helper,
.tutorial-complete-panel .helper {
  margin-inline: auto;
}

.tutorial-close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink);
  border: 2px solid var(--violet);
  background: #21113a;
  font-family: Arial, sans-serif;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.tutorial-help-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.tutorial-help-button {
  width: 100%;
  min-width: 0;
}

.tutorial-fullscreen {
  place-items: stretch;
  padding: 0;
  background: #05020b;
}

.tutorial-demo-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  min-height: 100vh;
  background: #080412;
}

.tutorial-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px;
  color: #f6f2ff;
  border-bottom: 2px solid var(--violet);
  background: rgba(8, 4, 18, 0.99);
  font-family: "Silkscreen", monospace;
}

.tutorial-topbar > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.tutorial-progress {
  color: var(--cyan);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

.tutorial-exit-button {
  padding: 9px 12px;
  color: #d7cfea;
  border: 1px solid #655080;
  background: #170d28;
  font-family: "Silkscreen", monospace;
  cursor: pointer;
}

.tutorial-demo-game {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.tutorial-demo-art {
  min-height: clamp(220px, 34vh, 390px);
}

.tutorial-demo-content {
  padding-bottom: 26px;
}

.tutorial-demo-choices .choice-button {
  position: relative;
}

.tutorial-coach-card {
  position: relative;
  z-index: 5;
  padding: 16px clamp(18px, 3vw, 36px) 18px;
  color: #f8f5ff;
  border-top: 3px solid var(--cyan);
  background:
    linear-gradient(180deg, rgba(25, 13, 48, 0.99), rgba(10, 6, 22, 0.99));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.38);
  font-family: "Noto Sans KR", Arial, sans-serif;
  font-size: clamp(0.98rem, 1.45vw, 1.2rem);
  line-height: 1.55;
  text-align: center;
}

.tutorial-coach-card p {
  max-width: 980px;
  margin: 5px auto;
}

.tutorial-step-label {
  display: inline-block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-family: "Silkscreen", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.tutorial-feedback {
  min-height: 1.4em;
  margin-top: 7px;
  color: #ffd79a;
  font-weight: 700;
}

.tutorial-target {
  z-index: 3;
  border-color: #9ffff3 !important;
  box-shadow:
    5px 5px 0 #080310,
    0 0 0 3px rgba(97, 240, 228, 0.34),
    0 0 28px rgba(97, 240, 228, 0.8) !important;
  animation: tutorialPulse 1.3s ease-in-out infinite alternate;
}

.tutorial-target-soft {
  padding: 10px;
  border: 2px solid rgba(97, 240, 228, 0.58);
  box-shadow: 0 0 22px rgba(97, 240, 228, 0.2);
}

.tutorial-meter-changed {
  border-color: var(--cyan);
  box-shadow: inset 0 0 18px rgba(97, 240, 228, 0.14);
}

.tutorial-meter-changed .hud-value {
  color: #fff6a8;
}

.tutorial-wrong {
  animation: tutorialWrong 240ms linear 2;
}

.tutorial-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 26px 0;
}

.tutorial-flow > div {
  display: grid;
  min-height: 110px;
  align-content: center;
  gap: 9px;
  padding: 12px 8px;
  border: 2px solid #58417d;
  background: rgba(16, 8, 34, 0.86);
}

.tutorial-flow span {
  display: grid;
  width: 32px;
  height: 32px;
  margin: 0 auto;
  place-items: center;
  color: #051010;
  border-radius: 50%;
  background: var(--cyan);
  font-family: "Silkscreen", monospace;
  font-weight: 700;
}

.tutorial-flow strong {
  color: #f6f2ff;
  font-family: "Silkscreen", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
}

.tutorial-reminder {
  margin: 18px 0 0;
  color: #cfc8df;
  font-size: 0.95rem;
}

.tutorial-guide-note {
  border-color: var(--cyan) !important;
  background: rgba(20, 66, 70, 0.22) !important;
}

@keyframes tutorialPulse {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.18);
  }
}

@keyframes tutorialWrong {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-5px); }
  70% { transform: translateX(5px); }
}

@media (max-width: 760px) {
  .help-toggle {
    top: 8px;
    right: 124px;
    width: 38px;
    height: 38px;
    font-size: 0.85rem;
  }

  .tutorial-help-actions,
  .tutorial-flow {
    grid-template-columns: 1fr;
  }

  .tutorial-flow > div {
    min-height: 68px;
  }

  .tutorial-topbar {
    align-items: flex-start;
  }

  .tutorial-demo-hud {
    grid-template-columns: repeat(2, 1fr);
  }

  .tutorial-demo-hud .hud-cell:first-child {
    grid-column: 1 / -1;
  }
}


/* Last Bell Studio website integration */
.site-return-link {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 500;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 11px;
  border: 2px solid #76f2d0;
  color: #effdf8;
  background: rgba(5,18,23,.92);
  box-shadow: 4px 4px 0 rgba(0,0,0,.45);
  font: 700 11px/1 "Silkscreen", ui-monospace, monospace;
  text-decoration: none;
  letter-spacing: .04em;
}
.site-return-link:hover { transform: translate(-1px,-1px); border-color: #ffd36e; }
.site-return-link:focus-visible { outline: 3px solid #ffd36e; outline-offset: 3px; }
@media (max-width: 720px) {
  .site-return-link { top: 8px; left: 8px; min-height: 34px; padding: 7px 8px; font-size: 9px; }
}


/* ==================================================
   V16.8 — SUBTLE ANIMATED MIDNIGHT TITLE
   The school/background stays fixed while four independent cloud sprites
   cross the sky at different speeds. The supplied title lettering remains
   a separate transparent overlay so clouds can pass behind it.
================================================== */
#game-shell .title-screen {
  isolation: isolate;
}

#game-shell .title-screen .title-background {
  z-index: 0;
}

#game-shell .title-screen .title-cloud-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

#game-shell .title-screen .title-cloud {
  position: absolute;
  left: -34vw;
  width: clamp(190px, 24vw, 475px);
  height: auto;
  opacity: 0.97;
  image-rendering: pixelated;
  will-change: transform;
  filter: drop-shadow(0 5px 4px rgba(28, 11, 63, 0.16));
  animation-name: midnight-cloud-cross;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

#game-shell .title-screen .title-cloud-top-left {
  top: 22.5%;
  width: clamp(190px, 23vw, 454px);
  animation-duration: 190s;
  animation-delay: -12s;
}

#game-shell .title-screen .title-cloud-top-right {
  top: 26%;
  width: clamp(200px, 24vw, 476px);
  animation-duration: 225s;
  animation-delay: -118s;
}

#game-shell .title-screen .title-cloud-bottom-left {
  top: 34.5%;
  width: clamp(170px, 20vw, 390px);
  opacity: 0.9;
  animation-duration: 250s;
  animation-delay: -72s;
}

#game-shell .title-screen .title-cloud-bottom-right {
  top: 38%;
  width: clamp(160px, 19vw, 360px);
  opacity: 0.88;
  animation-duration: 275s;
  animation-delay: -205s;
}

#game-shell .title-screen .title-text-art {
  position: absolute;
  inset: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  image-rendering: pixelated;
}

#game-shell .title-screen .title-actions {
  z-index: 30;
}

@keyframes midnight-cloud-cross {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(168vw, 0, 0); }
}

@media (max-width: 700px) {
  #game-shell .title-screen .title-cloud-top-left { top: 24%; }
  #game-shell .title-screen .title-cloud-top-right { top: 28%; }
  #game-shell .title-screen .title-cloud-bottom-left { top: 36%; }
  #game-shell .title-screen .title-cloud-bottom-right { top: 40%; }
}

@media (prefers-reduced-motion: reduce) {
  #game-shell .title-screen .title-cloud {
    animation: none;
  }
  #game-shell .title-screen .title-cloud-top-left { left: 4%; }
  #game-shell .title-screen .title-cloud-top-right { left: 68%; }
  #game-shell .title-screen .title-cloud-bottom-left { left: -2%; }
  #game-shell .title-screen .title-cloud-bottom-right { left: 78%; }
}


/* ==================================================
   V16.9 — FINAL CLASSROOM POLISH
================================================== */

/* Reserve a real utility strip during gameplay so Last Bell / Help / Music
   never cover the HUD. Title and teacher-resource screens keep their layout. */
#game-shell .gameplay {
  padding-top: 60px;
}

#game-shell .gameplay .scene-art {
  min-height: clamp(300px, 46vh, 540px);
}

/* Free-license attribution must be readable on the dark settings card. */
.settings-status a {
  color: #fff2a6 !important;
  font-weight: 700;
  text-decoration-color: #fff2a6;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.settings-status a:visited { color: #ffdca0 !important; }
.settings-status a:hover,
.settings-status a:focus-visible { color: #ffffff !important; }

/* Classroom vocabulary helper: keep the English visible and reveal Korean
   on hover/focus/click. */
.vocab[data-korean] {
  position: relative;
  cursor: help;
  outline-offset: 4px;
}

.vocab[data-korean]::after {
  content: attr(data-korean);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 900;
  width: max-content;
  max-width: min(320px, 72vw);
  padding: 9px 12px;
  border: 2px solid var(--cyan);
  color: #071112;
  background: var(--cyan-soft);
  box-shadow: 5px 5px 0 rgba(0,0,0,.55);
  font-family: "Noto Sans KR", sans-serif;
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .12s ease, transform .12s ease;
}

.vocab[data-korean]:hover::after,
.vocab[data-korean]:focus-visible::after,
.vocab[data-korean].vocab-open::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 700px) {
  #game-shell .gameplay { padding-top: 54px; }
  #game-shell .gameplay .scene-art { min-height: clamp(250px, 42vh, 460px); }
}

@media (prefers-reduced-motion: reduce) {
  .vocab[data-korean]::after { transition: none; }
}

/* =========================================================
   V17.1 — projector-readable Korean vocabulary popups
   Larger type and padding make meanings readable from the back of class.
   ========================================================= */
.vocab[data-korean]::after {
  max-width: min(420px, 78vw);
  padding: 12px 16px;
  font-size: clamp(1.08rem, 1.45vw, 1.28rem);
  line-height: 1.5;
}


/* =========================================================
   V17.2 — back-of-class vocabulary readability
   Roughly doubles the V17.1 Korean definition size for projector use.
   ========================================================= */
.vocab[data-korean]::after {
  max-width: min(640px, 86vw);
  padding: 18px 24px;
  font-size: clamp(2rem, 2.8vw, 2.5rem);
  line-height: 1.35;
  border-width: 3px;
  box-shadow: 7px 7px 0 rgba(0,0,0,.55);
}
