:root {
  --ink: #33305a;
  --muted: #7c769c;
  --line: #e7e3f5;
  --paper: #fef9ff;
  --panel: #ffffff;

  --mint: #1cc3ad;
  --mint-dark: #0f8f81;
  --sun: #ffcb45;
  --sun-dark: #c8860a;
  --coral: #ff7a6b;
  --sky: #56b0f0;
  --leaf: #8bd05a;
  --grape: #a98bf0;
  --bubble: #ff9ed2;

  --r-sm: 12px;
  --r: 18px;
  --r-lg: 24px;
  --pill: 999px;

  --shadow: 0 16px 34px rgba(86, 70, 140, 0.14);
  --shadow-sm: 0 8px 18px rgba(86, 70, 140, 0.12);

  --font-display: "Jua", "Noto Sans KR", system-ui, sans-serif;
  --font-body: "Noto Sans KR", "Pretendard", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  background-color: #fdf6ff;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 203, 69, 0.28), transparent 30%),
    radial-gradient(circle at 88% 4%, rgba(86, 176, 240, 0.26), transparent 28%),
    radial-gradient(circle at 78% 96%, rgba(255, 158, 210, 0.26), transparent 30%),
    radial-gradient(circle at 4% 92%, rgba(139, 208, 90, 0.24), transparent 30%),
    radial-gradient(rgba(169, 139, 240, 0.12) 2px, transparent 2px);
  background-size: auto, auto, auto, auto, 34px 34px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.2px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Sidebar (fun progress map) ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px;
  background: rgba(255, 255, 255, 0.78);
  border-right: 3px dashed rgba(169, 139, 240, 0.4);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  font-size: 1.9rem;
  background: linear-gradient(135deg, var(--sun), var(--coral));
  border-radius: 20px;
  box-shadow: 0 12px 22px rgba(255, 122, 107, 0.34);
  transform: rotate(-6deg);
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel h4,
.panel p {
  margin: 0;
}

.brand h1 {
  font-size: 1.4rem;
  color: var(--ink);
}

.brand p {
  color: var(--grape);
  font-weight: 700;
}

.brand p,
.panel-heading p,
.topbar p {
  color: var(--muted);
}

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

.step-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--pill);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.step-link span,
.section-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  font-family: var(--font-display);
  color: #fff;
  font-size: 1.05rem;
  background: var(--grape);
  border-radius: 50%;
}

.step-link:hover {
  transform: translateX(4px);
  border-color: var(--grape);
  background: #faf6ff;
}

.step-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--mint), var(--sky));
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.step-link.active span {
  color: var(--mint-dark);
  background: #fff;
}

/* ---------- Workspace ---------- */
.workspace {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto 24px;
}

.eyebrow {
  display: inline-block;
  padding: 6px 16px;
  font-weight: 700;
  color: var(--mint-dark);
  background: #d8f7f1;
  border-radius: var(--pill);
}

.topbar h2 {
  margin-top: 10px;
  font-size: clamp(1.7rem, 2.6vw, 2.6rem);
  color: var(--ink);
}

.ghost-button {
  white-space: nowrap;
}

form {
  display: grid;
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto;
}

/* ---------- Panels ---------- */
.panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  background: var(--panel);
  border: 3px solid #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  gap: 14px;
  align-items: center;
}

.section-number {
  width: 46px;
  height: 46px;
  font-size: 1.35rem;
  box-shadow: var(--shadow-sm);
}

form > .panel:nth-of-type(1) .section-number { background: var(--coral); }
form > .panel:nth-of-type(2) .section-number { background: var(--sky); }
form > .panel:nth-of-type(3) .section-number { background: var(--leaf); }
form > .panel:nth-of-type(4) .section-number { background: var(--grape); }
form > .panel:nth-of-type(5) .section-number { background: var(--mint); }
form > .panel:nth-of-type(6) .section-number { background: var(--sun); color: #6b4a00; }

.panel h3 {
  font-size: 1.5rem;
  color: var(--ink);
}

.panel-heading p {
  margin-top: 2px;
  font-weight: 700;
}

.panel h4 {
  margin-bottom: 12px;
  font-size: 1.18rem;
  color: var(--ink);
}

/* friendly helper text */
.hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 16px;
  color: #5c5680;
  font-weight: 700;
  font-size: 0.96rem;
  background: #fff7df;
  border: 2px dashed #ffd874;
  border-radius: var(--r-sm);
}

.control-block > .hint {
  margin-bottom: 12px;
}

/* ---------- Forms ---------- */
.form-grid {
  display: grid;
  gap: 18px;
  align-items: start;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.02rem;
}

input,
textarea {
  width: 100%;
  color: var(--ink);
  background: #fbf7ff;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input {
  min-height: 52px;
  padding: 0 16px;
}

textarea {
  min-height: 120px;
  padding: 14px 16px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #b6afce;
  font-weight: 600;
}

input:focus,
textarea:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(28, 195, 173, 0.2);
}

.control-block {
  min-width: 0;
}

/* ---------- Choice chips ---------- */
.choice-grid,
.choice-stack,
.segmented {
  display: grid;
  gap: 10px;
}

.choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.choice-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

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

.segmented {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.segmented.wrap {
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 12px 48px 12px 16px;
  color: var(--ink);
  font-weight: 700;
  background: #fbf8ff;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.choice:hover {
  transform: translateY(-2px);
  border-color: var(--grape);
  box-shadow: var(--shadow-sm);
}

.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.choice::after {
  position: absolute;
  top: 50%;
  right: 14px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: transparent;
  font-size: 1rem;
  font-weight: 900;
  content: "✓";
  background: #ffffff;
  border: 2px solid #d4cdec;
  border-radius: 50%;
  transform: translateY(-50%);
  transition: transform 0.15s ease;
}

.choice span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.choice strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.1rem;
}

.choice small {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
}

.choice-badge {
  justify-self: start;
  margin-top: 3px;
  padding: 2px 10px;
  font-style: normal;
  font-weight: 700;
  font-size: 0.72rem;
  white-space: nowrap;
  color: #9a5b00;
  background: #ffe7b3;
  border-radius: var(--pill);
}

.choice:has(input:checked) .choice-badge {
  color: #8a5200;
  background: #ffdb95;
}

.choice:has(input:checked) {
  color: #0c5f55;
  background: #d6f7f0;
  border-color: var(--mint);
  box-shadow: 0 10px 20px rgba(28, 195, 173, 0.22);
}

.choice:has(input:checked)::after {
  color: #fff;
  background: var(--mint);
  border-color: var(--mint);
  transform: translateY(-50%) scale(1.12);
  animation: pop 0.25s ease;
}

.choice:has(input:checked) small {
  color: #2a7d72;
}

@keyframes pop {
  0% { transform: translateY(-50%) scale(0.5); }
  60% { transform: translateY(-50%) scale(1.3); }
  100% { transform: translateY(-50%) scale(1.12); }
}

/* ---------- Genre preview ---------- */
.genre-preview {
  display: grid;
  grid-template-columns: minmax(220px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-top: 16px;
  padding: 18px;
  background: linear-gradient(135deg, #fff6e6, #f0f8ff);
  border: 3px dashed #ffd16b;
  border-radius: var(--r);
}

.genre-preview svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 320 / 200;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
}

.genre-preview strong {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--coral);
}

.genre-preview p {
  color: #6a6390;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.55;
}

.genre-preview .genre-games {
  margin-top: 10px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--mint-dark);
}

/* ---------- Game icon builder ---------- */
.icon-builder {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.icon-preview {
  width: 116px;
  height: 116px;
}

.icon-preview svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.icon-controls {
  display: grid;
  gap: 14px;
}

.icon-field {
  display: grid;
  gap: 8px;
}

.icon-label {
  font-weight: 800;
  color: var(--ink);
}

.icon-swatches,
.icon-shapes,
.icon-decos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.swatch:hover {
  transform: scale(1.08);
}

.swatch.selected {
  box-shadow: 0 0 0 3px var(--mint);
  transform: scale(1.12);
}

.shape-chip {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.shape-chip:hover {
  transform: translateY(-2px);
  border-color: var(--grape);
}

.shape-chip svg {
  width: 26px;
  height: 26px;
}

.shape-chip.selected {
  border-color: var(--mint);
  background: #e2f7f0;
}

.deco-chip {
  padding: 7px 14px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--pill);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.deco-chip:hover {
  transform: translateY(-2px);
  border-color: var(--grape);
}

.deco-chip.selected {
  border-color: var(--mint);
  background: #e2f7f0;
  color: #0c5f55;
}

.icon-letter {
  width: 92px;
  min-height: 44px;
  text-align: center;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 1.2rem;
}

@media (max-width: 640px) {
  .icon-builder {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

/* ---------- Entry cards (drawings) ---------- */
.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.entry-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  background: #fbf8ff;
  border: 3px solid #f0ebff;
  border-radius: var(--r);
}

.entry-card h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.25rem;
  color: var(--grape);
}

.upload-box {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 132px;
  padding: 16px;
  color: var(--mint-dark);
  font-weight: 700;
  text-align: center;
  background: #eafaf6;
  border: 3px dashed var(--mint);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease;
}

.upload-box::before {
  content: "📷";
  font-size: 2.2rem;
}

.upload-box:hover {
  transform: translateY(-2px);
  background: #dff6ef;
}

.upload-box input {
  display: none;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}

.thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  background: #eaf0f3;
  border-radius: var(--r-sm);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  max-width: calc(100% - 10px);
  padding: 2px 8px;
  overflow: hidden;
  color: white;
  font-weight: 700;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--grape);
  border-radius: var(--pill);
}

/* ---------- Summary + buttons ---------- */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-item {
  padding: 16px;
  text-align: center;
  border-radius: var(--r);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}

.summary-strip .summary-item:nth-child(1) { background: #fff0ed; }
.summary-strip .summary-item:nth-child(2) { background: #e7f3ff; }
.summary-strip .summary-item:nth-child(3) { background: #eefae0; }
.summary-strip .summary-item:nth-child(4) { background: #f4eeff; }

.summary-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--ink);
}

.summary-item span {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.accent-button,
.ghost-button,
.mini-button {
  min-height: 54px;
  padding: 0 24px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.1rem;
  color: #fff;
  border: 0;
  border-radius: var(--pill);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--mint), var(--sky));
}

.accent-button {
  color: #6b4a00;
  background: linear-gradient(135deg, var(--sun), var(--coral));
}

.ghost-button {
  min-height: 48px;
  padding: 0 20px;
  color: var(--mint-dark);
  background: #d8f7f1;
  box-shadow: none;
}

.mini-button {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.98rem;
  color: var(--grape);
  background: #f1ebff;
  box-shadow: none;
}

.primary-button:hover,
.accent-button:hover,
.ghost-button:hover,
.mini-button:hover {
  transform: translateY(-3px);
  filter: brightness(1.04);
}

.primary-button:active,
.accent-button:active,
.ghost-button:active,
.mini-button:active {
  transform: translateY(0) scale(0.97);
}

/* ---------- Output cards ---------- */
.output-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.output-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  background: #faf7ff;
  border: 2px solid #efeaff;
  border-radius: var(--r);
}

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

.output-head h4 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ink);
}

.output-card textarea {
  min-height: 320px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  background: #2b2747;
  color: #f3effb;
  border-color: #2b2747;
  border-radius: var(--r-sm);
}

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
    border-right: 0;
    border-bottom: 3px dashed rgba(169, 139, 240, 0.4);
  }

  .step-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .step-link {
    flex: 0 0 auto;
  }

  .workspace {
    padding: 18px;
  }

  .form-grid.two,
  .form-grid.three,
  .output-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .panel {
    padding: 18px;
  }

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

  .genre-preview {
    grid-template-columns: 1fr;
  }

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

  .button-row button {
    width: 100%;
  }
}
