:root {
  --paper: #f6f7fb;
  --ink: #22242c;
  --muted: #667085;
  --line: #d8dde8;
  --panel: #ffffff;
  --green: #257a5c;
  --green-soft: #dff4e9;
  --blue: #3f75c9;
  --blue-soft: #e4eeff;
  --coral: #d95f4f;
  --coral-soft: #ffe7df;
  --yellow: #e2a72c;
  --yellow-soft: #fff1c8;
  --violet: #7057b8;
  --violet-soft: #eee8ff;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow: 0 24px 60px rgba(32, 34, 44, 0.14);
  --shadow-soft: 0 2px 6px rgba(32, 34, 44, 0.05), 0 14px 34px rgba(32, 34, 44, 0.07);
  --ring: 0 0 0 1px rgba(34, 36, 44, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 10% -10%, rgba(63, 117, 201, 0.1), transparent 60%),
    radial-gradient(820px 480px at 92% -4%, rgba(217, 95, 79, 0.09), transparent 56%),
    radial-gradient(760px 520px at 50% 112%, rgba(37, 122, 92, 0.09), transparent 62%),
    var(--paper);
  background-attachment: fixed;
  font-family: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(84px, auto) 1fr minmax(150px, auto);
  gap: 14px;
  align-items: center;
  min-height: 78px;
  padding: 14px clamp(14px, 3vw, 34px);
  border-bottom: 1px solid rgba(34, 36, 44, 0.08);
  background: rgba(246, 247, 251, 0.92);
  backdrop-filter: blur(14px);
}

.brand-block {
  min-width: 0;
  text-align: center;
}

.header-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.brand-block h1 {
  margin: 1px 0 0;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 36px;
  animation: view-in 0.35s ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.dashboard-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding: 8px 0 20px;
}

.dashboard-top h2 {
  margin: 6px 0 0;
  max-width: 820px;
  font-size: clamp(1.45rem, 3vw, 2.6rem);
  line-height: 1.18;
}

.quick-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.quick-stats span {
  min-width: 74px;
  padding: 9px 14px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--ring), 0 4px 12px rgba(32, 34, 44, 0.05);
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.game-card {
  display: grid;
  grid-template-rows: 158px auto;
  min-height: 392px;
  overflow: hidden;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--ring), var(--shadow-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: card-in 0.5s ease backwards;
}

.game-card:nth-child(2) { animation-delay: 0.06s; }
.game-card:nth-child(3) { animation-delay: 0.12s; }
.game-card:nth-child(4) { animation-delay: 0.18s; }
.game-card:nth-child(5) { animation-delay: 0.24s; }

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--ring), 0 8px 16px rgba(32, 34, 44, 0.07), 0 26px 52px rgba(32, 34, 44, 0.13);
}

.game-card img {
  width: 100%;
  height: 158px;
  object-fit: cover;
  border-bottom: 5px solid var(--card-color, var(--green));
  background: #fff;
  transition: transform 0.3s ease;
}

.game-card:hover img {
  transform: scale(1.04);
}

.game-card-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px;
}

.game-card h3 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.25;
}

.clear-star {
  font-size: 1rem;
}

.record-line {
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff7df;
  border: 1px solid #ecd9a0;
  font-size: 0.85rem;
  font-weight: 800;
  color: #8a620d;
}

.game-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.tag-row span {
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--card-soft, var(--green-soft));
  color: var(--card-ink, var(--green));
  font-size: 0.82rem;
  font-weight: 800;
}

.tool-button,
.primary-button {
  min-height: 42px;
  border: 1px solid rgba(34, 36, 44, 0.12);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.tool-button {
  display: inline-grid;
  place-items: center;
  padding: 9px 12px;
  text-decoration: none;
}

.tool-button:hover {
  border-color: #aab2c5;
  background: #f7f9fd;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(32, 34, 44, 0.08);
}

.tool-button:focus-visible,
.primary-button:focus-visible {
  outline: 3px solid rgba(63, 117, 201, 0.35);
  outline-offset: 2px;
}

.tool-button.ghost {
  background: transparent;
}

.tool-button.active {
  border-color: rgba(37, 122, 92, 0.45);
  background: var(--green-soft);
  color: var(--green);
}

.tool-button.wide,
.primary-button {
  width: 100%;
}

.primary-button {
  padding: 12px 16px;
  border: none;
  background: linear-gradient(135deg, #2f9472, #1f6b50);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent, #257a5c) 82%, #fff), var(--accent, #1f6b50));
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 122, 92, 0.28);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent, #257a5c) 32%, transparent);
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(37, 122, 92, 0.35);
}

.primary-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(37, 122, 92, 0.25);
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(190px, 238px) minmax(0, 1fr) minmax(235px, 304px);
  gap: 16px;
  align-items: stretch;
}

.status-panel,
.play-stage,
.control-panel {
  border: none;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--ring), var(--shadow-soft);
}

.status-panel,
.control-panel {
  padding: 16px;
  border-top: 6px solid var(--accent, var(--green));
}

.status-panel h2 {
  margin: 4px 0 8px;
  font-size: 1.3rem;
  line-height: 1.22;
}

.student-line,
.concept-line {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.45;
}

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

.metric-grid div {
  min-height: 70px;
  padding: 10px 8px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fbfdff, var(--accent-soft, #eef3fc));
  box-shadow: inset 0 0 0 1px rgba(34, 36, 44, 0.06);
  text-align: center;
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.metric-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1.28rem;
}

.play-stage {
  min-height: 602px;
  overflow: hidden;
}

.scene {
  min-height: 600px;
  height: 100%;
  padding: 18px;
  background: linear-gradient(180deg, var(--accent-soft, transparent), rgba(255, 255, 255, 0) 28%);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 600px;
}

.panel-title {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.3;
  color: var(--accent-ink, var(--ink));
}

.panel-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
}

.data-table th,
.data-table td {
  padding: 10px 9px;
  border: 1px solid var(--line);
  text-align: center;
}

.data-table th {
  background: #f1f4fb;
}

.chart-wrap {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  min-height: 314px;
  margin-top: 12px;
}

.axis-labels {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  align-items: start;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

.bar-chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--bar-count, 4), minmax(42px, 1fr));
  gap: 12px;
  align-items: end;
  height: 300px;
  padding: 10px 10px 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      to top,
      #fff,
      #fff 58px,
      #edf1f8 59px,
      #edf1f8 60px
    );
}

.bar-item {
  position: relative;
  display: grid;
  align-items: end;
  justify-items: center;
  height: 100%;
}

.bar {
  width: clamp(32px, 7vw, 58px);
  min-height: 8px;
  border: 1px solid rgba(34, 36, 44, 0.18);
  border-radius: 7px 7px 3px 3px;
  background: var(--bar-color, var(--blue));
  transition: height 180ms ease;
}

.bar-value {
  position: absolute;
  top: -2px;
  min-width: 28px;
  padding: 3px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.bar-name {
  position: absolute;
  bottom: -29px;
  width: 100%;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.slider-list,
.button-list {
  display: grid;
  gap: 9px;
}

.slider-row {
  display: grid;
  grid-template-columns: minmax(70px, 96px) 1fr minmax(30px, auto);
  gap: 8px;
  align-items: center;
  min-height: 42px;
}

.slider-row span:first-child {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.slider-value {
  text-align: right;
  font-weight: 900;
}

.scene-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.scene-title h3 {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.7rem);
}

.scene-badge {
  padding: 7px 13px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--ring), 0 3px 8px rgba(32, 34, 44, 0.06);
  color: var(--muted);
  font-weight: 900;
}

.storybook {
  display: grid;
  gap: 14px;
  min-height: 100%;
}

.spider-room,
.delivery-yard,
.catch-zone,
.stair-yard,
.rocket-yard {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.spider-room {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(37, 122, 92, 0.12), transparent),
    #fff;
}

.web-line {
  position: absolute;
  width: 260px;
  height: 2px;
  background: rgba(34, 36, 44, 0.18);
  transform-origin: left center;
}

.spider {
  position: absolute;
  right: 13%;
  top: 24%;
  width: 110px;
  height: 110px;
  border: 4px solid #22242c;
  border-radius: 50%;
  background: var(--coral-soft);
  display: grid;
  place-items: center;
  font-weight: 900;
  text-align: center;
}

.spider::before,
.spider::after {
  content: "";
  position: absolute;
  inset: 18px -22px;
  border-top: 4px solid #22242c;
  border-bottom: 4px solid #22242c;
  border-radius: 50%;
}

.rescued-note {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.destination-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.destination {
  min-height: 120px;
  padding: 12px;
  border: 1px dashed rgba(34, 36, 44, 0.25);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.destination strong {
  display: block;
  font-size: 1.05rem;
}

.delivery-count {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
  font-weight: 900;
}

.doll-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.doll {
  min-height: 36px;
  border-radius: 8px;
  background: var(--yellow-soft);
  color: #6f4b00;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.critters {
  position: relative;
  min-height: 368px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(226, 167, 44, 0.12), transparent 45%),
    #fff;
  overflow: hidden;
}

.critter {
  position: absolute;
  width: 74px;
  min-height: 50px;
  border: 2px solid rgba(34, 36, 44, 0.24);
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(32, 34, 44, 0.08);
}

.critter.caught {
  pointer-events: none;
  opacity: 0.18;
  transform: scale(0.9);
}

.option-grid {
  display: grid;
  gap: 10px;
}

.chart-option {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.mini-bars {
  display: grid;
  grid-template-columns: repeat(var(--bar-count, 3), 1fr);
  gap: 6px;
  align-items: end;
  height: 42px;
}

.mini-bars span {
  display: block;
  min-height: 5px;
  border-radius: 5px 5px 2px 2px;
  background: var(--blue);
}

.stair-yard {
  display: grid;
  align-items: end;
  min-height: 326px;
  padding: 18px;
  background:
    linear-gradient(180deg, #fff, #f5fbf2);
}

.stair-stack {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 250px;
}

.step-block {
  display: grid;
  place-items: center;
  width: min(100px, 20vw);
  min-width: 58px;
  border: 2px solid rgba(34, 36, 44, 0.25);
  border-radius: 7px 7px 2px 2px;
  background: var(--yellow);
  color: #fff;
  font-weight: 900;
  text-align: center;
}

.pick-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.rocket-yard {
  position: relative;
  min-height: 232px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #e4eeff, #ffffff 60%);
}

.rocket {
  position: absolute;
  left: 14%;
  bottom: 24px;
  width: 76px;
  height: 138px;
  border: 3px solid #22242c;
  border-radius: 46px 46px 16px 16px;
  background: var(--coral-soft);
  display: grid;
  place-items: center;
  color: var(--coral);
  font-weight: 900;
  transition: transform 800ms ease;
}

.rocket.launched {
  transform: translateY(-300px);
}

.flame {
  position: absolute;
  left: 24px;
  bottom: -28px;
  width: 24px;
  height: 34px;
  border-radius: 50% 50% 8px 8px;
  background: var(--yellow);
}

.selected-bar {
  outline: 4px solid rgba(217, 95, 79, 0.32);
  outline-offset: 4px;
}

.overlay,
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(22, 24, 32, 0.45);
  backdrop-filter: blur(7px);
}

.overlay-panel,
.modal-panel {
  width: min(720px, 100%);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
  animation: panel-pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes panel-pop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
}

.overlay-panel {
  padding: clamp(22px, 4vw, 34px);
}

.overlay-panel h2 {
  margin: 6px 0 8px;
  font-size: clamp(1.5rem, 4vw, 2.35rem);
}

.overlay-panel p {
  line-height: 1.55;
}

.modal-panel {
  width: min(1020px, 100%);
  max-height: calc(100dvh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.letter-panel {
  width: min(920px, 100%);
}

.modal-header {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 2px 0 0;
  font-size: 1.25rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.view-toggle {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbff;
}

.letter-body {
  display: grid;
  gap: 18px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.letter-note,
.debug-activity,
.debug-prompts {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.letter-note {
  background:
    linear-gradient(120deg, rgba(37, 122, 92, 0.09), transparent 42%),
    #fff;
}

.letter-note p,
.debug-activity li,
.debug-prompts p {
  line-height: 1.6;
}

.letter-note p {
  margin: 0 0 12px;
}

.letter-note p:last-child {
  margin-bottom: 0;
}

.debug-activity h3,
.debug-prompts h3 {
  margin: 0 0 12px;
  font-size: 1.08rem;
}

.debug-activity ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.prompt-grid p {
  margin: 0;
  min-height: 96px;
  padding: 12px;
  border-radius: 8px;
  background: #f7f9fd;
}

.sheet-viewer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 0;
  padding: 14px;
}

.sheet-viewer figure {
  min-width: 0;
  min-height: 0;
  margin: 0;
  text-align: center;
}

.sheet-viewer img {
  max-width: 100%;
  max-height: calc(100dvh - 190px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.sheet-viewer figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 920px) {
  .dashboard-top,
  .game-shell {
    grid-template-columns: 1fr;
  }

  .quick-stats {
    justify-content: flex-start;
  }

  .status-panel,
  .control-panel,
  .play-stage,
  .scene {
    min-height: auto;
  }

  .game-shell {
    gap: 12px;
  }
}

@media (max-width: 620px) {
  .app-header {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    padding: 10px;
  }

  .header-actions {
    flex-direction: column;
  }

  .brand-block h1 {
    font-size: 1.1rem;
  }

  .view {
    width: min(100% - 18px, 1180px);
    padding-top: 14px;
  }

  .game-card {
    grid-template-rows: 132px auto;
    min-height: 0;
  }

  .game-card img {
    height: 132px;
  }

  .metric-grid,
  .destination-grid,
  .modal-header,
  .modal-actions,
  .sheet-viewer {
    grid-template-columns: 1fr;
  }

  .modal-header,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .view-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .chart-wrap {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .bar-chart {
    gap: 6px;
    height: 260px;
    padding-inline: 6px;
  }

  .bar {
    width: clamp(24px, 9vw, 42px);
  }

  .slider-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ===== 거미잡기 리디자인 ===== */
.hunt-brief {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.decoy-warning {
  color: #b7473b;
  font-weight: 800;
}

.hunt-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.room-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.room-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  background: #f1f4fb;
  font-weight: 900;
}

.room-tally {
  font-size: 0.78rem;
  letter-spacing: 1px;
  overflow: hidden;
  white-space: nowrap;
}

.room-body {
  position: relative;
  height: 170px;
  background:
    radial-gradient(circle at 80% 15%, rgba(34, 36, 44, 0.06), transparent 36%),
    linear-gradient(180deg, rgba(37, 122, 92, 0.05), transparent),
    #fff;
}

.spider-pop {
  position: absolute;
  width: 56px;
  height: 56px;
  border: 2px solid rgba(34, 36, 44, 0.25);
  border-radius: 50%;
  background: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(32, 34, 44, 0.12);
  animation: pop-in 0.18s ease;
}

.spider-pop:hover {
  transform: scale(1.08);
}

.spider-pop.decoy {
  background: #ffeef0;
}

.spider-pop.smashed {
  animation: smash 0.24s forwards;
  pointer-events: none;
}

.spider-pop.fled {
  animation: flee 0.38s forwards;
  pointer-events: none;
}

@keyframes pop-in {
  from {
    transform: scale(0.3);
    opacity: 0;
  }
}

@keyframes smash {
  to {
    transform: scale(0.15) rotate(45deg);
    opacity: 0;
  }
}

@keyframes flee {
  to {
    transform: translateY(-30px) scale(0.5);
    opacity: 0;
  }
}

.timer-badge b {
  color: #b7473b;
}

.timer-badge.low {
  background: #ffe7df;
  color: #b7473b;
  animation: timer-blink 1s infinite;
}

@keyframes timer-blink {
  50% {
    opacity: 0.55;
  }
}

.hunt-stats {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}

.hunt-stats b {
  float: right;
}

.rescue-row {
  display: grid;
  grid-template-columns: 175px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.web-cage {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    repeating-conic-gradient(rgba(34, 36, 44, 0.04) 0 8deg, transparent 8deg 24deg),
    #fff;
  text-align: center;
}

.cage-teacher {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border: 3px solid rgba(34, 36, 44, 0.25);
  border-radius: 50%;
  background: var(--coral-soft, #ffe7df);
  font-size: 2rem;
}

.cage-teacher span {
  font-size: 0.62rem;
  font-weight: 900;
}

.strand-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  min-height: 10px;
}

.strand {
  width: 26px;
  height: 7px;
  border-radius: 4px;
  background: #8d93a5;
  transition: all 0.3s ease;
}

.strand.cut {
  background: #e2e6f0;
  transform: scaleX(0.35);
}

.cage-note {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
}

.cage-note b {
  color: #b7473b;
}

.gchart-wrap {
  position: relative;
}

.gchart {
  display: grid;
  grid-template-columns: 38px repeat(var(--cols, 4), minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.gcol {
  display: grid;
  gap: 6px;
  justify-items: stretch;
  text-align: center;
}

.gcells {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
}

.gcell,
.gaxis-num {
  height: 27px;
}

.gaxis-num {
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}

.gcell {
  padding: 0;
  border: 1.5px dashed #c9d1e2;
  border-radius: 5px;
  background: #fafbfe;
  cursor: pointer;
}

.gcell:hover {
  border-color: #8d93a5;
}

.gcell.filled {
  border-style: solid;
  border-color: rgba(34, 36, 44, 0.3);
  background: var(--bar-color, #257a5c);
}

.gcol.locked .gcell {
  cursor: default;
  opacity: 0.92;
}

.gcol.locked .gname::after {
  content: " 🔒";
}

.gcol.wrong {
  animation: col-shake 0.4s;
}

@keyframes col-shake {
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

.gval {
  font-weight: 900;
}

.gname {
  font-size: 0.85rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.peek-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px;
  border: 2px solid #e2a72c;
  border-radius: 8px;
  background: #fffbe8;
}

.peek-cover h4 {
  margin: 0;
  font-size: 1.05rem;
}

.peek-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.peek-row strong {
  min-width: 64px;
}

.question-box {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.question-box p {
  margin: 0;
}

.option-row {
  display: grid;
  gap: 8px;
}

.feedback-note {
  min-height: 1.3em;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
}

.feedback-note.good {
  color: #257a5c;
}

.feedback-note.bad {
  color: #b7473b;
}

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

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

  .room-body {
    height: 140px;
  }
}

/* ===== 인형 배송 리디자인 ===== */
.belt-lane {
  position: relative;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    repeating-linear-gradient(
      90deg,
      #e8ecf5 0 26px,
      #f4f6fb 26px 52px
    );
  animation: belt-roll 1.4s linear infinite;
}

@keyframes belt-roll {
  to {
    background-position-x: 52px;
  }
}

.belt-doll {
  position: absolute;
  top: 14px;
  left: -60px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid rgba(34, 36, 44, 0.22);
  border-radius: 12px;
  background: #fff;
  font-size: 1.7rem;
  line-height: 1;
  box-shadow: 0 6px 12px rgba(32, 34, 44, 0.12);
}

.belt-doll i {
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 900;
  color: #8a620d;
  text-align: center;
}

.belt-doll.bomb {
  background: #34363f;
  border-color: #16171c;
}

.belt-doll.front {
  outline: 3px solid #e2a72c;
  outline-offset: 2px;
}

.belt-doll.front::after {
  content: "▼";
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  color: #e2a72c;
  font-size: 0.85rem;
  animation: front-bounce 0.7s ease-in-out infinite alternate;
}

@keyframes front-bounce {
  to {
    transform: translateX(-50%) translateY(4px);
  }
}

.belt-doll.shipped {
  transition: transform 0.4s ease, opacity 0.4s ease !important;
  transform: translateY(-58px) scale(0.6);
  opacity: 0;
}

.belt-doll.dropped {
  transition: transform 0.55s ease-in, opacity 0.55s ease-in !important;
  transform: translateY(70px) rotate(50deg);
  opacity: 0;
}

.order-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.order-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.order-panel h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.order-panel h4 small {
  color: #b7473b;
  font-size: 0.78rem;
}

.dchart {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
}

.dchart-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 190px;
  text-align: right;
}

.dchart-axis span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 0;
  overflow: visible;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}

.dchart-bars {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  height: 190px;
  margin-bottom: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-image: linear-gradient(to top, #e4e9f3 1px, transparent 1px);
  background-size: 100% calc(100% / var(--rows, 6));
  background-position: 0 -1px;
}

.dchart-col {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
}

.dchart-bar {
  position: relative;
  width: 64%;
  min-height: 2px;
  border-radius: 6px 6px 0 0;
  background: var(--bar-color, #3f75c9);
  transition: height 0.25s ease;
}

.dchart-bar .dchart-val {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.82rem;
  font-weight: 900;
}

.dchart-name {
  position: absolute;
  bottom: -26px;
  left: 0;
  right: 0;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.dchart-col.done .dchart-name::after {
  content: " ✅";
}

.dest-buttons {
  display: grid;
  gap: 9px;
}

.dest-button {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.dest-button:hover {
  border-color: #8d93a5;
}

.dest-button .dest-icon {
  font-size: 1.5rem;
}

.dest-button .dest-key {
  position: absolute;
  right: 12px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f1f4fb;
  font-size: 0.8rem;
  color: var(--muted);
}

.dest-button.done {
  border-color: #257a5c;
  background: #dff4e9;
}

.dest-button.done .dest-name::after {
  content: " ✅";
}

.dest-button .dest-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #6a6f7e;
}

.dest-button.trash {
  border-color: #d8a3a3;
  background: #fdf1f1;
}

.dest-button.trash:hover {
  border-color: #b85c5c;
}

.complaint-line {
  margin: 0;
  font-weight: 900;
}

.complaint-line span {
  letter-spacing: 2px;
}

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

  .dchart-axis,
  .dchart-bars {
    height: 150px;
  }
}

/* ===== 벌레와 생쥐 리디자인 ===== */
.night-zone {
  position: relative;
  height: 380px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
  background:
    radial-gradient(circle at 20% 80%, rgba(63, 117, 201, 0.1), transparent 40%),
    radial-gradient(circle at 75% 20%, rgba(226, 167, 44, 0.1), transparent 45%),
    #f4f0e6;
}

.night-dark {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    circle var(--light-r, 110px) at var(--lx, 50%) var(--ly, 50%),
    transparent 0,
    transparent calc(var(--light-r, 110px) - 26px),
    rgba(12, 14, 24, 0.55) calc(var(--light-r, 110px) - 8px),
    rgba(12, 14, 24, 0.96) var(--light-r, 110px)
  );
}

.night-zone.flash .night-dark {
  animation: night-flash 0.45s ease;
}

@keyframes night-flash {
  30% {
    opacity: 0.15;
  }
}

.night-critter {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 1.8rem;
  line-height: 1;
  cursor: crosshair;
  transition: left 0.5s ease, top 0.5s ease;
}

.night-critter:hover {
  transform: scale(1.12);
}

.night-critter.bat {
  font-size: 1.9rem;
}

.night-critter.zapped {
  animation: zap 0.28s forwards;
  pointer-events: none;
}

@keyframes zap {
  40% {
    transform: scale(1.4) rotate(-14deg);
  }
  to {
    transform: scale(0.1) rotate(30deg);
    opacity: 0;
  }
}

.catch-pouch {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-content: flex-start;
  min-height: 130px;
  padding: 14px;
  border: 2px dashed #b9a06a;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #fdf6e3, #f7ecd2);
  font-size: 1.45rem;
  line-height: 1;
}

.catch-pouch span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(34, 36, 44, 0.1);
}

.catch-pouch .rescued-note {
  width: auto;
  height: auto;
  font-size: 0.95rem;
}

.pouch-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-weight: 800;
  font-size: 0.9rem;
}

.pouch-item {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(34, 36, 44, 0.1);
  font-size: 1.45rem;
  line-height: 1;
}

.pouch-item:hover:not(:disabled) {
  border-color: #8d93a5;
  transform: scale(1.08);
}

.pouch-item.sorted-out {
  transition: transform 0.2s ease-in, opacity 0.2s ease-in;
  transform: translateY(26px) scale(0.5);
  opacity: 0;
}

.sort-bins {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.sort-bin {
  border: 2px solid var(--bin-color, var(--line));
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.bin-head {
  padding: 7px 10px;
  background: var(--bin-color, #eee);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 900;
}

.bin-head b {
  font-size: 1rem;
}

.bin-body {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
  min-height: 56px;
  padding: 8px;
  font-size: 1.05rem;
  line-height: 1;
}

.chart-option.option-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.mini-bars.tall {
  height: 96px;
  padding: 0 6px;
  border-bottom: 2px solid rgba(34, 36, 44, 0.35);
}

.mini-bars.ruled {
  background-image: linear-gradient(to top, #dde3ee 1px, transparent 1px);
  background-size: 100% 11px;
  background-position: 0 100%;
}

.chart-option.wrong-option {
  border-color: #d95f4f;
  background: #ffeef0;
  opacity: 0.55;
}

.chart-option:hover:not(:disabled) {
  border-color: #8d93a5;
}

/* ===== 계단 쌓기 리디자인 ===== */
.escape-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.escape-yard {
  position: relative;
  min-height: 270px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #dceafe 0%, #eef5ff 45%, #f3fbf0 100%);
}

.sky-rope {
  position: absolute;
  top: 8px;
  right: 14px;
  font-size: 1.5rem;
  line-height: 1.1;
  text-align: center;
}

.stair-stack2 {
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.sblock {
  flex: 1 1 36px;
  max-width: 58px;
  min-width: 34px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(34, 36, 44, 0.28);
  border-radius: 8px 8px 0 0;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  animation: block-drop 0.3s ease;
}

@keyframes block-drop {
  from {
    transform: translateY(-26px);
    opacity: 0.3;
  }
}

.climber {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 2;
  font-size: 1.8rem;
  line-height: 1;
  transition: left 0.45s ease, bottom 0.45s ease, transform 0.8s ease, opacity 0.8s ease;
}

.climber.escaped {
  transform: translateY(-190px) translateX(40px) scale(0.8);
  opacity: 0;
}

.vote-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.vote-panel h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.vote-panel h4 small {
  color: #b7473b;
  font-size: 0.76rem;
}

.sgraph {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 150px;
  padding: 8px 8px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-image: linear-gradient(to top, #e4e9f3 1px, transparent 1px);
  background-size: 100% 12px;
  background-position: 0 calc(100% - 26px);
}

.sg-col {
  display: grid;
  gap: 4px;
  justify-items: center;
  align-content: end;
}

.sg-bar {
  position: relative;
  width: 26px;
  border-radius: 5px 5px 0 0;
  border: 1.5px solid rgba(34, 36, 44, 0.3);
}

.sg-val {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  font-weight: 900;
}

.sg-name {
  height: 22px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.picto-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin: 0 0 8px;
  font-size: 1rem;
}

.picto-row strong {
  flex: 0 0 64px;
  font-size: 0.85rem;
}

.picto-row span {
  letter-spacing: 1px;
  word-break: break-all;
}

.tiger-track {
  position: relative;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, transparent 0 28px, rgba(34, 36, 44, 0.07) 28px 34px),
    #fdf8ee;
  overflow: hidden;
}

.tiger {
  position: absolute;
  top: 6px;
  left: 0;
  font-size: 1.7rem;
  line-height: 1;
  transition: left 1s linear;
}

.track-goal {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 1.4rem;
}

.pick-row {
  display: grid;
  gap: 8px;
}

.shake-button {
  animation: col-shake 0.4s;
  border-color: #d95f4f !important;
}

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

  .sblock {
    width: 44px;
    flex-basis: 44px;
    font-size: 0.62rem;
  }
}

/* ===== 로켓 리디자인 ===== */
.launch-yard {
  position: relative;
  height: 200px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, #1d2447 0%, #3a4a87 38%, #8fb4e8 72%, #dff0fb 100%);
}

.alt-band {
  position: absolute;
  left: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 900;
}

.rocket2 {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.1rem;
  line-height: 1;
  transition: bottom 1.2s ease-in;
}

.rocket2.flying::after {
  content: "🔥";
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%) rotate(135deg);
  font-size: 1.2rem;
  animation: timer-blink 0.3s infinite;
}

.gchart.compact .gcell,
.gchart.compact .gaxis-num {
  height: 15px;
  border-radius: 3px;
  font-size: 0.6rem;
}

.gcol.sel {
  outline: 3px solid #e2a72c;
  outline-offset: 2px;
  border-radius: 8px;
}

.gcol.eng-ok .gname::after {
  content: " 🔥";
}

.gcol.eng-fail .gname::after {
  content: " 💨";
}

.gcol.eng-fail {
  animation: col-shake 0.4s;
}

.clue-list {
  display: grid;
  gap: 8px;
}

.clue-card {
  padding: 11px 12px;
  border: 2px dashed #b9a06a;
  border-radius: 10px;
  background: #fffbe8;
  font-size: 0.92rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.clue-card.done {
  border-style: solid;
  border-color: #257a5c;
  background: #dff4e9;
  text-decoration: line-through;
  opacity: 0.75;
}

.clue-card.done::after {
  content: " ✅";
}

.clue-card.violated {
  border-style: solid;
  border-color: #d95f4f;
  background: #ffeef0;
  color: #b7473b;
  animation: col-shake 0.4s;
}

.clue-card.violated::after {
  content: " ❌";
}

.gcol.clue-glow {
  outline: 3px dashed #e2a72c;
  outline-offset: 2px;
  border-radius: 8px;
  background: #fff7df;
}

.sum-hint {
  padding: 8px 10px;
  border-radius: 8px;
  background: #e4eeff;
  font-weight: 800;
}

/* ===== 모던 폴리시: 막대 광택과 인터랙션 ===== */
.bar,
.dchart-bar,
.sg-bar,
.sblock {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0) 48%);
}

.dest-button,
.chart-option,
.clue-card,
.pouch-item,
.gcell {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.dest-button {
  border-radius: 12px;
}

.dest-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(32, 34, 44, 0.08);
}

.chart-option {
  border-radius: 12px;
}

.chart-option:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(32, 34, 44, 0.08);
}

.data-table,
.bar-chart,
.dchart-bars,
.belt-lane,
.order-panel,
.sort-bin,
.night-zone,
.room-panel,
.escape-yard,
.vote-panel,
.launch-yard,
.gchart,
.web-cage {
  border-radius: 12px;
}

/* ===== 아트 디렉션: 게임별 테마 컬러 ===== */
.game-card .primary-button {
  background: var(--card-color, #257a5c);
  background: linear-gradient(135deg, color-mix(in srgb, var(--card-color, #257a5c) 82%, #fff), var(--card-color, #257a5c));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--card-color, #257a5c) 32%, transparent);
}

.overlay-panel .eyebrow {
  color: var(--accent-ink, var(--muted));
}

.game-card img {
  border-bottom: none;
}
