﻿@font-face {
  font-family: "NeoDGMCode";
  src:
    local("NeoDGMCode"),
    local("Neo둥근모 코드"),
    url("./neodgm_code.woff") format("woff"),
    local("Neo둥근모"),
    local("Neo둥근모 Pro"),
    local("NeoDunggeunmo"),
    local("NeoDunggeunmo Pro"),
    local("NeoDunggeunmoPro-Regular"),
    url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2307-2@1.0/NeoDunggeunmoPro-Regular.woff2") format("woff2"),
    url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2307-2@1.0/NeoDunggeunmoPro-Regular.woff") format("woff"),
    url("https://cdn.jsdelivr.net/gh/neodgm/neodgm-webfont@1.600/neodgm.woff2") format("woff2"),
    url("https://cdn.jsdelivr.net/gh/neodgm/neodgm-webfont@1.600/neodgm.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #eaf2ff;
  --panel: #0f2e63;
  --panel-soft: #153a79;
  --line: #5b8de0;
  --accent: #2f74ff;
  --accent-deep: #1f58cb;
  --bg1: #081d45;
  --bg2: #0f2f69;
  --bg3: #143f83;
}

* {
  box-sizing: border-box;
  text-rendering: optimizeSpeed;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: auto;
}
[hidden] { display: none !important; }

html,
body,
input,
button,
select,
textarea {
  font-family: "NeoDGMCode", "NeoDunggeunmo", "DotGothic16", "Malgun Gothic", monospace;
}

body {
  margin: 0;
  font-family: "NeoDGMCode", "NeoDunggeunmo", "DOSGothic", "DotGothic16", "Malgun Gothic", monospace;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 12%, rgba(126, 180, 255, 0.35) 0, transparent 26%),
    radial-gradient(circle at 88% 80%, rgba(198, 159, 255, 0.24) 0, transparent 24%),
    radial-gradient(circle at 60% 40%, rgba(255, 255, 255, 0.08) 0, transparent 40%),
    linear-gradient(145deg, var(--bg1), var(--bg2) 48%, var(--bg3));
}

.modal-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(rgba(36, 57, 82, 0.28), rgba(36, 57, 82, 0.28)), url("images/start_background.png") center/cover no-repeat;
  padding: 20px;
}

.modal-card {
  width: min(660px, 95%);
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #d6d9f7;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 18px 36px rgba(47, 67, 107, 0.25);
}

.modal-card h1 {
  margin: 0 0 8px;
  font-family: "NeoDGMCode", "NeoDunggeunmo", "DOSGothic", "DotGothic16", "Malgun Gothic", monospace;
  color: #1f3d7a;
}

.modal-card p { margin: 0 0 14px; }

.modal-card input {
  width: min(320px, 90%);
  border: 1px solid #a8bae8;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  margin-bottom: 10px;
}
.character-step {
  text-align: left;
}
.character-builder {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  margin-top: 10px;
}
.character-preview-wrap {
  border: 2px solid #8fc6dc;
  border-radius: 12px;
  background: linear-gradient(180deg, #f4fcff, #e4f3fb);
  display: grid;
  place-items: center;
  padding: 10px;
}
.character-preview {
  width: 88px;
  height: 88px;
  image-rendering: pixelated;
  object-fit: contain;
}
.character-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.character-controls label {
  font-size: 0.84rem;
  color: #2d5870;
  display: grid;
  gap: 4px;
}
.character-controls select {
  width: 100%;
  border: 1px solid #92c6dd;
  border-radius: 9px;
  background: #fafdff;
  color: #24526b;
  padding: 6px;
  font: inherit;
}
.character-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.character-actions button {
  border: 2px solid #7fbcd8;
  border-radius: 10px;
  background: linear-gradient(180deg, #d9f1fc, #bde5f5);
  color: #244f68;
  font: inherit;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
}

.character-choice-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.character-choice {
  border: 2px solid #8dc5dc;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fdff, #e8f4fb);
  color: #2a5870;
  font: inherit;
  font-weight: 700;
  padding: 8px;
  display: grid;
  gap: 6px;
  justify-items: center;
  cursor: pointer;
}

.character-choice img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
}

.character-choice.active {
  border-color: #ddb96e;
  background: linear-gradient(180deg, #fff3cf, #f8e1b2);
  color: #6f4d1f;
  box-shadow: 0 0 0 3px rgba(221, 185, 110, 0.28);
}

.app {
  width: 100vw;
  min-height: 100vh;
  padding: 12px;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1.5px);
  background-size: 18px 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #1b4b9f, #245ec5 55%, #2f72e8);
  border: 2px solid #7eadff;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 10px 22px rgba(4, 19, 52, 0.45);
}

.topbar h2 { margin: 0; color: #ffffff; }
.topbar p { margin: 2px 0 0; color: #d6e7ff; }

.status-box {
  display: grid;
  gap: 4px;
  align-content: center;
  font-size: 0.92rem;
  background: rgba(5, 31, 82, 0.38);
  border: 1px solid rgba(163, 196, 255, 0.45);
  border-radius: 12px;
  padding: 8px 10px;
}

.tabs {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid #7aa8ff;
  background: linear-gradient(180deg, #2f74ff, #255fd0);
  color: #f4f8ff;
  border-radius: 16px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 5px 0 #183f8b,
    0 10px 16px rgba(7, 22, 56, 0.38);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tab-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid rgba(185, 216, 255, 0.8);
  background: rgba(10, 34, 84, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-size: 0.95rem;
  line-height: 1;
}

.tab-btn:hover {
  transform: translateY(-1px);
}

.tab-btn.active {
  background: linear-gradient(180deg, #5798ff, #3f83f0);
  box-shadow: 0 3px 0 #1c4c9d, 0 8px 14px rgba(7, 22, 56, 0.36);
}

.view {
  display: none;
  margin-top: 10px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(17, 52, 109, 0.95), rgba(14, 42, 89, 0.97));
  box-shadow: inset 0 1px 0 rgba(175, 206, 255, 0.22), 0 12px 24px rgba(5, 18, 45, 0.4);
  padding: 12px;
}

.view.active { display: block; }

.builder-controls h3,
.builder-layout h3,
.builder-layout h4,
.game-head h3,
.codex h4,
.concept-card h4 {
  margin: 0;
}

.chip-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.chip {
  border: 1px solid #78a5f6;
  background: linear-gradient(180deg, #1e4da2, #163a7c);
  color: #e6f0ff;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
}

.chip.active {
  background: linear-gradient(180deg, #4e8fff, #3576e5);
}

.builder-layout {
  margin-top: 4px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
}

.builder-layout > section {
  display: flex;
  align-items: flex-start;
}

.small { font-size: 0.9rem; margin: 6px 0; }

.inventory {
  display: grid;
  gap: 8px;
}

.inventory-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid #6f9ae2;
  border-radius: 10px;
  background: linear-gradient(180deg, #1d4b9d, #173f87);
  color: #eef5ff;
  padding: 7px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.inventory-item.active {
  border-color: #9cc0ff;
  background: linear-gradient(180deg, #2e72e4, #245fcb);
}

.inventory-item.locked {
  opacity: 0.55;
  filter: grayscale(0.35);
  cursor: not-allowed;
}

.item-thumb {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex: 0 0 auto;
}

.item-name {
  font-weight: 700;
}

.item-emoji {
  width: 34px;
  text-align: center;
  font-size: 1.45rem;
  line-height: 1;
  flex: 0 0 auto;
}

.lock-badge {
  margin-left: auto;
  font-size: 0.98rem;
}

.item-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #b7c8ee;
  border-radius: 10px;
  background: #fff;
  padding: 7px;
  cursor: pointer;
  text-align: left;
}

.item-btn.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.item-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #8ea4d7;
}
.item-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #90c5dc;
  background: #f8fdff;
  image-rendering: pixelated;
  object-fit: cover;
  object-position: center;
}

.ecosystem-canvas {
  position: relative;
  width: 68%;
  max-width: 100%;
  margin: 0 auto;
  margin-top: -72px;
  min-height: 340px;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  border: 2px dashed #6f97de;
  overflow: hidden;
}

.canvas-tip {
  position: absolute;
  left: 10px;
  top: 8px;
  background: rgba(17, 51, 108, 0.88);
  border: 1px solid #76a1ee;
  color: #dfebff;
  border-radius: 10px;
  padding: 6px 8px;
  margin: 0;
  font-size: 0.88rem;
}

.bg-field,
.bg-farm,
.bg-lake,
.bg-sea,
.bg-mountain {
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}

.bg-field {
  background-image: url("images/bg_field.png");
  background-color: #dff0ff;
}

.bg-farm {
  background-image: url("images/bg_forest.png");
  background-color: #d7f0d6;
}

.bg-lake {
  background-image: url("images/bg_lake.png");
  background-color: #d5ecff;
}

.bg-sea {
  background-image: url("images/bg_sea.png");
  background-color: #c6eaff;
}

.bg-mountain {
  background-image: url("images/bg_mountain.png");
  background-color: #e9edff;
}

.placed-item {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  cursor: grab;
  touch-action: none;
}

.placed-item:active {
  cursor: grabbing;
}

.placed-emoji {
  width: 100%;
  height: 100%;
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  line-height: 1;
  display: block;
  text-align: center;
  filter: drop-shadow(0 2px 4px rgba(30, 40, 60, 0.25));
}
.placed-avatar {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  object-fit: cover;
  object-position: center;
  filter: drop-shadow(0 2px 4px rgba(30, 40, 60, 0.25));
}

.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.game-head-right {
  display: flex;
  gap: 10px;
  font-size: 0.92rem;
}

.toolbar {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar button,
#nextQuizBtn,
#enterBtn {
  border: 3px solid #91b8ff;
  border-radius: 16px;
  background: linear-gradient(180deg, #3579ea, #295fc2);
  color: #f4f8ff;
  font: inherit;
  font-weight: 700;
  padding: 9px 13px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 5px 0 #163b81,
    0 10px 16px rgba(7, 22, 56, 0.35);
}

.toolbar button:hover,
#nextQuizBtn:hover,
#enterBtn:hover {
  transform: translateY(-1px);
}

.toolbar button:active,
#nextQuizBtn:active,
#enterBtn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #163b81;
}

.hint-box {
  margin: 8px 0;
  border: 1px dashed #7fa8ee;
  background: rgba(17, 52, 110, 0.72);
  color: #d9e7ff;
  border-radius: 10px;
  padding: 8px;
  min-height: 38px;
}

.mini-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 12px;
}

.mini-layout > section {
  min-width: 0;
}

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

.deck-card {
  border: 1px solid #76a4ee;
  border-radius: 10px;
  background: linear-gradient(180deg, #224f9b, #1a407f);
  color: #f0f6ff;
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  cursor: grab;
}

.deck-card.selected {
  border-color: #98beff;
  box-shadow: 0 0 0 3px rgba(123, 166, 239, 0.35);
  background: linear-gradient(180deg, #2f72dc, #255eba);
}

.deck-thumb,
.node-thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #9fb4e3;
  object-fit: cover;
  background: #f4f9ff;
}

.codex {
  margin-top: 10px;
  border-top: 1px dashed #b3c2e9;
  padding-top: 8px;
}

.game-board {
  position: relative;
  min-height: 510px;
  border: 2px dashed #78a2eb;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #d9e7f2, #dcead7);
}

.line-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 8;
  pointer-events: none;
}

.node,
.slot {
  position: absolute;
  z-index: 4;
  width: 140px;
  min-height: 56px;
  border: 2px solid #83a8ea;
  border-radius: 12px;
  background: #eaf2ff;
  box-shadow: 0 6px 16px rgba(52, 74, 121, 0.2);
  padding: 7px;
}

.node { cursor: pointer; }

.node.selected {
  border-color: #f1be56;
  box-shadow: 0 0 0 3px rgba(241, 190, 86, 0.3);
}

.slot {
  border-style: dashed;
  display: grid;
  place-items: center;
  color: #3f5e96;
  font-weight: 700;
}

.wrong-shake {
  animation: wrongShake 0.38s ease;
}

@keyframes wrongShake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

.wrong-mark {
  position: absolute;
  right: 8px;
  top: 2px;
  color: #d13a3a;
  font-weight: 900;
  font-size: 1.15rem;
  text-shadow: 0 1px 0 #fff;
  pointer-events: none;
}

.slot.filled {
  border-style: solid;
}

.node-head {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 7px;
  align-items: center;
}

.line {
  display: none;
}

.line-end-glyph {
  fill: #1f4f95;
  font-size: 24px;
  font-weight: 800;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 1.2px;
  paint-order: stroke fill;
  pointer-events: none;
}

.line.energy {
  animation: energyFlow 0.45s ease;
}

@keyframes energyFlow {
  0% { stroke-width: 8; stroke: #ffe28a; }
  100% { stroke-width: 3; stroke: #5a89c5; }
}

.feedback {
  margin: 8px 0 0;
  min-height: 24px;
  font-weight: 700;
}

.quiz-card {
  border: 1px solid #76a5ea;
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #1b468f, #153a79);
  color: #edf5ff;
  margin: 8px 0;
}

.quiz-options {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.quiz-option {
  border: 1px solid #80abed;
  border-radius: 10px;
  background: linear-gradient(180deg, #2357ac, #1a4487);
  color: #eef5ff;
  text-align: left;
  padding: 8px;
  cursor: pointer;
  font: inherit;
}

.quiz-choice {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #87b0f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #2a62bf 0%, #204c98 100%);
  color: #f3f8ff;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 4px 0 #194188,
    0 8px 16px rgba(6, 22, 53, 0.3);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.quiz-choice:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #3873d7 0%, #285ab0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 5px 0 #1a4693,
    0 10px 18px rgba(6, 22, 53, 0.36);
}

.quiz-choice:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 0 #1a4693,
    0 3px 8px rgba(6, 22, 53, 0.36);
}

.quiz-choice:disabled {
  opacity: 0.8;
  cursor: default;
  transform: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 2px 0 #aebfdf,
    0 4px 10px rgba(56, 79, 130, 0.14);
}

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

.concept-card {
  border: 1px solid #73a0e7;
  border-radius: 12px;
  background: linear-gradient(180deg, #1b4893, #163d80);
  color: #ebf4ff;
  padding: 14px;
}

.concept-card h4 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.concept-card p {
  margin: 8px 0 0;
  line-height: 1.75;
}

.concept-figure {
  margin: 0 0 10px;
  border: 1px solid #7da8eb;
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}

.concept-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  background: #ffffff;
}

.concept-figure figcaption {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.92rem;
  color: #d6e8ff;
  background: #1b427f;
  border-top: 1px solid #5f8fd9;
}

.concept-list {
  margin: 10px 0 0;
  padding-left: 20px;
  line-height: 1.7;
}

.concept-list .star-line {
  list-style: none;
}

.center-popup {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  pointer-events: none;
  padding: 16px;
}

.center-popup.interactive {
  pointer-events: auto;
}

.center-popup::before {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
}

.center-popup > div {
  position: relative;
  max-width: min(92vw, 760px);
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  color: #fff;
  text-align: center;
  padding: 16px 20px;
  font-family: "NeoDGMCode", "NeoDunggeunmo", "DOSGothic", "DotGothic16", "Malgun Gothic", monospace;
  box-shadow: 0 14px 34px rgba(32, 44, 74, 0.35);
}

input,
button,
select,
textarea {
  font-family: "NeoDGMCode", "NeoDunggeunmo", "DOSGothic", "DotGothic16", "Malgun Gothic", monospace;
}

.center-popup > div p {
  margin: 0;
  line-height: 1.5;
}

.popup-title {
  margin: 0 0 6px;
}

.popup-choice-window {
  min-width: min(92vw, 420px);
}

.popup-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.popup-actions.vertical {
  grid-template-columns: 1fr;
}

.popup-action {
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 0 rgba(18, 31, 66, 0.35);
}

.popup-action:hover {
  background: rgba(255, 255, 255, 0.3);
}

.center-popup.mission > div { background: linear-gradient(135deg, #3f97d2, #59bd93); }
.center-popup.error > div { background: linear-gradient(135deg, #ca5f5f, #9b3939); }
.center-popup.reward > div { background: linear-gradient(135deg, #ffbc62, #ff8e8e); }

.center-popup.unlock > div {
  max-width: min(94vw, 920px);
  padding: 24px 30px;
  background: linear-gradient(135deg, #fff2c4, #f7df9f);
  border-color: #ddb96e;
  color: #6d4b1c;
}

.center-popup.unlock > div p {
  font-size: 1.08rem;
  font-weight: 700;
}

.center-popup.endgame > div {
  background: linear-gradient(135deg, #ffefbe, #f4d992);
  border-color: #d8b66f;
  color: #65461b;
}

.center-popup.endgame .popup-action {
  color: #65461b;
  border-color: #e0bf79;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 4px 0 rgba(146, 111, 47, 0.35);
}

.center-popup.endgame .popup-action:hover {
  background: rgba(255, 255, 255, 0.9);
}

.center-popup.mini-select > div {
  background: linear-gradient(135deg, #dff6d6, #c7efc9);
  color: #2f5842;
  border-color: #b7dfba;
}

.center-popup.mini-select .popup-title {
  font-weight: 500;
}

.center-popup.mini-select p {
  font-weight: 400;
}

.center-popup.mini-select .popup-action {
  font-weight: 500;
  color: #2f5842;
  background: rgba(255, 255, 255, 0.72);
  border-color: #a8d4ae;
}

.center-popup.mini-select .popup-action:hover {
  background: rgba(255, 255, 255, 0.88);
}

.event-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  background: rgba(16, 26, 44, 0.45);
}

.event-card {
  width: min(560px, 92vw);
  background: #fff;
  border: 2px solid #a8bbea;
  border-radius: 14px;
  padding: 14px;
}

.event-card h4 { margin: 0 0 6px; }
.event-card p { margin: 0; }

.event-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.reward-stars {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.reward-star {
  color: #bfcae2;
  font-size: 1.2rem;
}

.reward-star.on {
  color: #ffd45d;
  animation: pop 0.4s ease;
}

@keyframes pop {
  0% { transform: scale(0.6); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

.butterfly-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9500;
}

.butterfly {
  position: absolute;
  font-size: 1.6rem;
  animation: fly 1.2s ease forwards;
}

@keyframes fly {
  0% { transform: translateY(20px) scale(0.8); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(-120px) scale(1.1); opacity: 0; }
}

.speech-bubble {
  position: absolute;
  z-index: 20;
  background: #fff;
  border: 1px solid #9db3e4;
  border-radius: 10px;
  padding: 5px 8px;
  font-size: 0.82rem;
  box-shadow: 0 4px 10px rgba(42, 61, 100, 0.2);
}

.wither {
  opacity: 0.36;
  filter: grayscale(0.8);
}

/* Pastel green/yellow theme override */
:root {
  --ink: #4a5334;
  --panel: #fffdf3;
  --panel-soft: #f6fbe8;
  --line: #d5ddad;
  --accent: #f7efbc;
  --accent-deep: #d8e39b;
  --bg1: #fffde8;
  --bg2: #f6fbdf;
  --bg3: #edf7d7;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 243, 188, 0.58) 0, transparent 28%),
    radial-gradient(circle at 88% 80%, rgba(222, 250, 205, 0.46) 0, transparent 24%),
    linear-gradient(145deg, var(--bg1), var(--bg2) 48%, var(--bg3));
}

.app {
  background-image:
    radial-gradient(rgba(190, 206, 146, 0.24) 1px, transparent 1.5px);
}

.topbar {
  background: linear-gradient(135deg, #fff8cb, #f3f8c0 55%, #e9f4b3);
  border: 2px solid #cbd89a;
  box-shadow: 0 10px 22px rgba(156, 171, 113, 0.24);
}

.topbar h2,
.topbar p {
  color: #44522a;
}

.status-box {
  background: rgba(255, 255, 241, 0.86);
  border: 1px solid rgba(198, 212, 151, 0.78);
}

.tab-btn {
  border: 2px solid #cfd89c;
  background: linear-gradient(180deg, #fff6ca, #eaf3ba);
  color: #445326;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 5px 0 #c0cd84,
    0 10px 16px rgba(142, 157, 97, 0.24);
}

.tab-btn.active {
  background: linear-gradient(180deg, #fffbe0, #f0f7c7);
  box-shadow: 0 3px 0 #c6d48b, 0 8px 14px rgba(132, 146, 88, 0.22);
}

.tab-icon {
  border: 2px solid rgba(206, 218, 154, 0.92);
  background: rgba(255, 255, 236, 0.94);
}

.view {
  border: 2px solid #d4dfab;
  background: linear-gradient(180deg, rgba(255, 255, 242, 0.96), rgba(245, 250, 228, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 12px 24px rgba(164, 177, 120, 0.18);
}

.chip {
  border: 1px solid #d2dca3;
  background: linear-gradient(180deg, #fff8d4, #edf5c0);
  color: #445326;
}

.chip.active {
  background: linear-gradient(180deg, #fffde9, #f4facf);
}

.inventory-item {
  border: 1px solid #d6dfad;
  background: linear-gradient(180deg, #fffde8, #f2f8d8);
  color: #445326;
}

.inventory-item.active {
  border-color: #cfd89a;
  background: linear-gradient(180deg, #fff9d8, #f0f6c6);
}

.canvas-tip {
  background: rgba(244, 250, 222, 0.95);
  border: 1px solid #bbd286;
  color: #4c5b33;
}

.toolbar button,
#nextQuizBtn,
#enterBtn {
  border: 3px solid #d1dba0;
  background: linear-gradient(180deg, #fff8cd, #edf5bc);
  color: #425224;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 5px 0 #bcc984,
    0 10px 16px rgba(139, 152, 98, 0.22);
}

.toolbar button:active,
#nextQuizBtn:active,
#enterBtn:active {
  box-shadow: 0 1px 0 #bcc984;
}

.hint-box,
.quiz-card,
.concept-card {
  color: #45552b;
}

.hint-box {
  border: 1px dashed #bfd48b;
  background: rgba(246, 251, 226, 0.88);
}

.deck-card {
  border: 1px solid #bbd587;
  background: linear-gradient(180deg, #f5f9df, #e8f0ca);
  color: #45552b;
}

.deck-card.selected {
  border-color: #c9d77f;
  background: linear-gradient(180deg, #f8f0bc, #f0e4a2);
  box-shadow: 0 0 0 3px rgba(219, 209, 124, 0.34);
}

.quiz-card {
  border: 1px solid #bfd78a;
  background: linear-gradient(180deg, #f5f9e0, #ecf4ce);
}

.quiz-option,
.quiz-choice {
  border-color: #bdd485;
  color: #435126;
}

.quiz-option {
  background: linear-gradient(180deg, #f5f9df, #e8f0c8);
}

.quiz-choice {
  background: linear-gradient(180deg, #f5efbe 0%, #e9dd98 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 4px 0 #c7b56a,
    0 8px 16px rgba(144, 124, 53, 0.22);
}

.quiz-choice:hover {
  background: linear-gradient(180deg, #f8f3cb 0%, #efe3a6 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 5px 0 #c2b066,
    0 10px 18px rgba(144, 124, 53, 0.24);
}

.quiz-choice:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 0 #c2b066,
    0 3px 8px rgba(144, 124, 53, 0.22);
}

.concept-card {
  border: 1px solid #c2d88f;
  background: linear-gradient(180deg, #f8fae8, #edf4d5);
}

.concept-figure {
  border: 1px solid #c4d994;
}

.concept-figure figcaption {
  color: #4f5f34;
  background: #edf5d0;
  border-top: 1px solid #c6da95;
}

/* Bright pastel boost */
:root {
  --ink: #4a5731;
  --panel: #fffef6;
  --panel-soft: #f8fce9;
  --line: #d8e4af;
  --accent: #fff5bf;
  --accent-deep: #dce99f;
  --bg1: #fffef2;
  --bg2: #f8fde8;
  --bg3: #f0fadf;
}

body {
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 247, 196, 0.72) 0, transparent 28%),
    radial-gradient(circle at 88% 80%, rgba(227, 255, 210, 0.58) 0, transparent 24%),
    linear-gradient(145deg, var(--bg1), var(--bg2) 48%, var(--bg3));
}

.topbar {
  background: linear-gradient(135deg, #fffddc, #f6fccf 55%, #eef9c2);
  border-color: #d6e2aa;
  box-shadow: 0 10px 22px rgba(178, 196, 129, 0.22);
}

.status-box {
  background: rgba(255, 255, 247, 0.9);
  border-color: rgba(209, 224, 162, 0.86);
}

.view {
  border-color: #dbe7b2;
  background: linear-gradient(180deg, rgba(255, 255, 248, 0.97), rgba(248, 253, 234, 0.99));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 12px 24px rgba(176, 194, 129, 0.16);
}

.tab-btn {
  border-color: #d8e3aa;
  background: linear-gradient(180deg, #fffbd8, #f1f8c8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 5px 0 #c9d78f,
    0 10px 16px rgba(166, 183, 118, 0.2);
}

.tab-btn.active {
  background: linear-gradient(180deg, #ffffea, #f5fbd7);
  box-shadow: 0 3px 0 #d0dc98, 0 8px 14px rgba(166, 183, 118, 0.2);
}

.inventory-item,
.deck-card,
.quiz-card,
.concept-card {
  background: linear-gradient(180deg, #fffef1, #f5fbdc);
  border-color: #d8e3ad;
}

.toolbar button,
#nextQuizBtn,
#enterBtn,
.quiz-choice {
  border-color: #d8e3a8;
  background: linear-gradient(180deg, #fffad2, #eff6be);
}

@media (max-width: 1000px) {
  .builder-layout,
  .mini-layout {
    grid-template-columns: 1fr;
  }

  .game-board,
  .ecosystem-canvas {
    width: 100%;
    margin: 0;
    min-height: 440px;
  }

  .ecosystem-canvas {
    margin-top: 0;
  }

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

/* Final pastel rebalance: yellow accent + softer multicolor base */
:root {
  --ink: #4c5a3a;
  --panel: #fffdf8;
  --panel-soft: #f8fbf3;
  --line: #d8e5cc;
  --accent: #ffeeb4;
  --accent-deep: #cfe4bb;
  --bg1: #fffdf7;
  --bg2: #f6fbf2;
  --bg3: #eef8f5;
}

body {
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 239, 178, 0.58) 0, transparent 30%),
    radial-gradient(circle at 86% 18%, rgba(255, 214, 224, 0.35) 0, transparent 26%),
    radial-gradient(circle at 82% 82%, rgba(202, 240, 222, 0.42) 0, transparent 24%),
    linear-gradient(145deg, var(--bg1), var(--bg2) 48%, var(--bg3));
}

.topbar {
  background: linear-gradient(135deg, #fffbe8, #f6fbe9 56%, #edf7ee);
  border-color: #d6e4c9;
  box-shadow: 0 10px 22px rgba(166, 190, 152, 0.2);
}

.view {
  border-color: #d9e6cc;
  background: linear-gradient(180deg, rgba(255, 255, 251, 0.97), rgba(247, 252, 241, 0.99));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 12px 24px rgba(164, 186, 150, 0.15);
}

.status-box {
  background: rgba(255, 255, 251, 0.92);
  border-color: rgba(212, 226, 200, 0.9);
}

.tab-btn {
  border-color: #d7e4c8;
  background: linear-gradient(180deg, #fff7d8, #f2f8de);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 5px 0 #c9d9b8,
    0 10px 16px rgba(161, 180, 145, 0.2);
}

.tab-btn.active {
  background: linear-gradient(180deg, #fffbe9, #f4fae6);
  box-shadow: 0 3px 0 #d2dfc4, 0 8px 14px rgba(161, 180, 145, 0.2);
}

.toolbar button,
#nextQuizBtn,
#enterBtn,
.quiz-choice {
  border-color: #d8e5c9;
  background: linear-gradient(180deg, #fff2bf, #f0f7d7);
  color: #4a5837;
}

.inventory-item,
.deck-card,
.quiz-card,
.concept-card {
  background: linear-gradient(180deg, #fffef8, #f3f9e8);
  border-color: #d8e4c8;
}

/* MiniGame1 board recolor: remove blue board and harmonize with pastel theme */
.game-board {
  border: 2px dashed #c9dcc2;
  background: linear-gradient(180deg, #fffdf7 0%, #f6faef 52%, #edf7ef 100%);
}

.node,
.slot {
  border-color: #c8d9bf;
  background: #fffef9;
  color: #4a5a39;
  box-shadow: 0 6px 16px rgba(118, 143, 104, 0.18);
}

.slot {
  color: #587048;
}

.node.selected {
  border-color: #e7c97b;
  box-shadow: 0 0 0 3px rgba(231, 201, 123, 0.3);
}

.line-end-glyph {
  fill: #7f9e71;
}

/* Cyworld minihome inspired skin override (graphics only) */
:root {
  --ink: #1c3550;
  --panel: #f4fbff;
  --panel-soft: #eaf6ff;
  --line: #6eb8d8;
  --accent: #66c8eb;
  --accent-deep: #3e9fc8;
  --bg1: #d6f0ff;
  --bg2: #b9e3f8;
  --bg3: #a7d7ee;
}

body {
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)),
    linear-gradient(140deg, var(--bg1), var(--bg2) 52%, var(--bg3));
}

.app {
  max-width: 1260px;
  margin: 14px auto;
  padding: 14px;
  border: 3px solid #62b2d3;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(234, 248, 255, 0.78)),
    repeating-linear-gradient(90deg, rgba(100, 175, 210, 0.08) 0 2px, transparent 2px 14px);
  box-shadow:
    inset 0 0 0 3px rgba(213, 238, 250, 0.95),
    0 16px 28px rgba(38, 103, 130, 0.25);
}

.topbar {
  border: 2px solid #59a8c9;
  border-radius: 16px;
  background: linear-gradient(180deg, #79d0ef, #5eb7d9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 8px 18px rgba(47, 116, 146, 0.24);
}

.topbar h2,
.topbar p {
  color: #f8fdff;
  text-shadow: 0 1px 0 rgba(25, 88, 118, 0.35);
}

.status-box {
  background: rgba(245, 252, 255, 0.9);
  border: 1px solid #9ecfe4;
  color: #2a5572;
}

.tabs {
  gap: 7px;
}

.tab-btn {
  border: 2px solid #66b2d0;
  border-radius: 12px;
  background: linear-gradient(180deg, #9edcf3, #78c6e4);
  color: #1f4f69;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.68),
    0 4px 0 #4b9bbc,
    0 8px 14px rgba(54, 124, 154, 0.24);
}

.tab-btn.active {
  background: linear-gradient(180deg, #caf0ff, #a9e1f7);
  box-shadow: 0 2px 0 #5ca8c8, 0 7px 12px rgba(54, 124, 154, 0.22);
}

.tab-icon {
  border-color: rgba(70, 148, 182, 0.6);
  background: rgba(235, 249, 255, 0.9);
}

.view {
  border: 2px solid #73bad8;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fdff, #edf8ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 10px 20px rgba(65, 132, 162, 0.14);
}

.builder-layout > aside,
.mini-layout > aside {
  border: 1px solid #96cde4;
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #fafdff, #eaf6fd);
}

.chip {
  border-color: #82bfd9;
  background: linear-gradient(180deg, #d6f1fc, #bde5f5);
  color: #245773;
}

.chip.active {
  background: linear-gradient(180deg, #ffeec1, #f7dea4);
  border-color: #d9bd7a;
  color: #6e4d1f;
}

.inventory-item,
.deck-card,
.quiz-card,
.concept-card,
.hint-box,
.canvas-tip {
  border-color: #9dcee4;
  background: linear-gradient(180deg, #ffffff, #edf8ff);
  color: #294f67;
}

.inventory-item.active,
.deck-card.selected {
  border-color: #e0c480;
  background: linear-gradient(180deg, #fff4d0, #fce7b8);
  color: #694a21;
}

.toolbar button,
#nextQuizBtn,
#enterBtn,
.quiz-choice {
  border-color: #79b9d5;
  background: linear-gradient(180deg, #d9f1fc, #bce4f4);
  color: #224e67;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 4px 0 #5a9fbe,
    0 8px 12px rgba(62, 127, 157, 0.22);
}

#enterBtn {
  background: linear-gradient(180deg, #ffeab7, #f6d99a);
  border-color: #d6b66e;
  color: #66471a;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 4px 0 #bf9c57,
    0 8px 12px rgba(122, 93, 45, 0.24);
}

.ecosystem-canvas {
  border: 2px solid #88c5df;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.game-board {
  border: 2px dashed #90c8df;
  border-radius: 12px;
  min-height: 500px;
  background:
    linear-gradient(180deg, #fafdff 0%, #eff8fd 56%, #e9f5fb 100%),
    repeating-linear-gradient(90deg, rgba(109, 181, 214, 0.08) 0 1px, transparent 1px 18px);
}

.node,
.slot {
  border: 2px solid #9ccfe3;
  background: linear-gradient(180deg, #ffffff, #eef8fd);
  color: #28526d;
  box-shadow: 0 6px 14px rgba(76, 140, 168, 0.18);
}

.slot {
  border-style: dashed;
}

.node.selected {
  border-color: #e6ca84;
  box-shadow: 0 0 0 3px rgba(230, 202, 132, 0.3);
}

.line-end-glyph {
  fill: #69a9c7;
}

.modal-card,
.event-card {
  border-color: #84c4de;
  background: linear-gradient(180deg, #ffffff, #edf8ff);
  box-shadow: 0 12px 24px rgba(58, 121, 150, 0.2);
}

/* Cyworld retro layout boost: side tabs + thick frame + sticker badges */
.app {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 118px;
  grid-template-areas:
    "top top"
    "view tabs";
  gap: 0;
  border: 4px solid #5aa9cb;
  border-radius: 24px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(235, 249, 255, 0.82)),
    radial-gradient(circle at 8px 8px, rgba(111, 183, 215, 0.24) 1px, transparent 1.5px) 0 0 / 16px 16px,
    repeating-linear-gradient(90deg, rgba(101, 176, 210, 0.08) 0 2px, transparent 2px 14px);
  box-shadow:
    inset 0 0 0 3px rgba(224, 244, 253, 0.96),
    inset 0 0 0 7px rgba(112, 184, 216, 0.34),
    0 18px 30px rgba(36, 102, 130, 0.26);
}

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar > div:first-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.tabs {
  grid-area: tabs;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 12px 0 0 0;
  margin-left: -1px;
  box-shadow: none;
}

.tab-btn {
  width: 100%;
  justify-content: flex-start;
  border-left: 0;
  border-radius: 0 12px 12px 0;
  padding: 10px 10px 10px 8px;
  font-size: 0.9rem;
  min-height: 58px;
}

.tab-label-stack {
  display: inline-block;
  line-height: 1.06;
}

.mini-tab-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-subtabs {
  width: calc(100% - 10px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 0 10px;
}

.mini-subtab {
  width: 100%;
  border: 2px solid #7dbdd8;
  border-radius: 10px;
  background: linear-gradient(180deg, #edf8ff, #d8edf8);
  color: #2a5972;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.2;
  text-align: left;
  padding: 7px 8px 7px 9px;
  cursor: pointer;
  box-shadow: 0 3px 0 #5da5c4, 0 6px 10px rgba(66, 136, 165, 0.2);
}

.sub-label-stack {
  display: inline-block;
  line-height: 1.05;
}

.mini-subtab.active {
  border-color: #debf79;
  background: linear-gradient(180deg, #fff1c7, #f8e2ac);
  color: #68491d;
  box-shadow: 0 2px 0 #c7a766, 0 5px 9px rgba(122, 93, 45, 0.2);
}

.view {
  grid-area: view;
  margin-top: 0;
  min-height: 620px;
  border-right-width: 1px;
}

.inventory-progress {
  margin: 4px 0 6px;
  color: #2a5870;
  font-size: 0.95rem;
  font-weight: 700;
}

.inventory-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inventory-help-wrap {
  position: relative;
}

.inventory-help-btn {
  width: 24px;
  height: 24px;
  border: 2px solid #79b9d5;
  border-radius: 50%;
  background: linear-gradient(180deg, #d9f1fc, #bce4f4);
  color: #224e67;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.inventory-help-bubble {
  position: absolute;
  left: calc(100% + 8px);
  top: -4px;
  width: 280px;
  border: 2px solid #89c4dd;
  border-radius: 8px;
  background: #f9fdff;
  color: #2a5870;
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 8px 10px;
  z-index: 20;
  box-shadow: 0 8px 16px rgba(61, 123, 151, 0.18);
}

.inventory-help-bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 10px;
  width: 10px;
  height: 10px;
  background: #f9fdff;
  border-left: 2px solid #89c4dd;
  border-bottom: 2px solid #89c4dd;
  transform: rotate(45deg);
}

.builder-layout > section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

#builderView .builder-controls {
  width: 96%;
  margin: 0 auto;
}

#builderView .builder-controls h3 {
  margin: 0;
}

#builderView .builder-controls .chip-list {
  margin-top: 6px;
}

.ecosystem-canvas {
  width: 96%;
  max-width: 100%;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
}

@media (max-width: 1000px) {
  .app {
    display: block;
    border-width: 3px;
    border-radius: 18px;
  }

  .character-builder {
    grid-template-columns: 1fr;
  }

  .character-preview-wrap {
    width: 120px;
    margin: 0 auto;
  }

  .character-controls {
    grid-template-columns: 1fr;
  }

  .character-choice-list {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 6px;
    margin-left: 0;
  }

  .mini-tab-group {
    width: auto;
    flex-direction: row;
    align-items: center;
  }

  .tab-btn {
    width: auto;
    min-height: 0;
    border-left: 2px solid #66b2d0;
    border-radius: 10px;
    justify-content: center;
  }

  .mini-subtabs {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 0;
    margin-left: 0;
  }

  .mini-subtab {
    width: auto;
    border-radius: 10px;
    text-align: center;
    padding: 7px 10px;
  }

  .sub-label-stack br {
    display: none;
  }

  .tab-label-stack br {
    display: none;
  }

  .view {
    min-height: 0;
    margin-top: 10px;
  }
}
