:root {
  color-scheme: light;
  font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif;
  background: #edf4ef;
  color: #173c2a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 18px;
}

button, input { font: inherit; }

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  margin: -8px -4px 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e1ebe4;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #173c2a;
  text-decoration: none;
}

.app-brand img { display: block; width: 52px; height: 52px; object-fit: contain; }
.app-brand span { font-size: 15px; font-weight: 950; letter-spacing: -.02em; }
.app-brand small { display: block; margin-top: 2px; color: #718078; font-size: 9px; font-weight: 850; letter-spacing: .11em; }
.home-link { padding: 9px 13px; border: 1px solid #d4e4d9; border-radius: 999px; background: #f4faf6; color: #216b42; font-size: 12px; font-weight: 900; text-decoration: none; }

.prototype-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 30px;
  border: 1px solid rgba(27, 91, 59, .12);
  border-radius: 30px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 24px 70px rgba(24, 72, 48, .14);
}

.prototype-header { text-align: center; }
.eyebrow { margin: 0 0 5px; color: #a06a2c; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(25px, 4vw, 32px); }
.description { margin: 8px 0 24px; color: #6a786f; font-size: 14px; }

.designer-grid {
  display: grid;
  grid-template-columns: minmax(330px, .9fr) minmax(380px, 1.1fr);
  gap: 24px;
  align-items: start;
}

.preview-panel { position: sticky; top: 20px; }

.badge-stage {
  display: grid;
  place-items: center;
  min-height: 388px;
  border: 1px solid rgba(27, 91, 59, .08);
  border-radius: 24px;
  background: radial-gradient(circle at 50% 43%, rgba(255,255,255,.98), rgba(235,242,237,.72) 58%, rgba(215,229,220,.75));
  overflow: hidden;
}

.yn-badge {
  position: relative;
  width: min(92%, 370px);
  aspect-ratio: 1;
  isolation: isolate;
  filter: drop-shadow(0 18px 18px rgba(45, 38, 23, .18));
}

.yn-badge-layer {
  position: absolute;
  left: var(--layer-x);
  top: var(--layer-y);
  width: var(--layer-width);
  height: auto;
  transform: translate(-50%, -50%) rotate(var(--layer-rotation));
  pointer-events: none;
  user-select: none;
}

.yn-badge-layer[data-slot="plate"] {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  clip-path: circle(49% at 50% 50%);
}

.yn-badge-layer[data-slot="insect"] {
  filter: drop-shadow(0 4px 2px rgba(16, 20, 16, .24)) drop-shadow(0 1px 0 rgba(255, 255, 255, .45));
}

.selection-summary {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #123f2d;
  color: white;
  text-align: left;
}

.selection-summary strong { font-size: 16px; }
.selection-summary > span:last-child { color: rgba(255,255,255,.7); font-size: 12px; }
.summary-kicker { color: #b9d7c5; font-size: 11px; font-weight: 800; letter-spacing: .08em; }

.option-panel { display: grid; gap: 18px; }

.choice-section {
  min-width: 0;
  margin: 0;
  padding: 15px;
  border: 1px solid #dce8df;
  border-radius: 20px;
  background: #f8fbf9;
}

.choice-section legend { padding: 0 8px; color: #294a38; font-size: 14px; font-weight: 900; text-align: left; }
.choice-section legend span { margin-right: 5px; color: #a06a2c; font-size: 11px; }

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

.choice-card {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 104px;
  padding: 6px 5px 8px;
  border: 1px solid #dbe6de;
  border-radius: 14px;
  background: white;
  color: #40584a;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.choice-card:hover { transform: translateY(-1px); border-color: #9abca7; }
.choice-card:focus-visible { outline: 3px solid rgba(47, 154, 95, .28); outline-offset: 2px; }
.choice-card.is-selected {
  border-color: #2f9a5f;
  box-shadow: inset 0 0 0 1px #2f9a5f, 0 7px 18px rgba(36, 119, 72, .12);
  color: #17643a;
}

.choice-card.is-selected::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2f9a5f;
  color: white;
  font-size: 12px;
}

.choice-card img { width: 72px; height: 72px; object-fit: contain; pointer-events: none; }
#insectChoices .choice-card img { width: 78px; }
#backgroundChoices .choice-card img {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
}

.choice-subgroup-title {
  margin: 4px 2px 8px;
  color: #6a786f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
}

.choice-subgroup-title:not(:first-child) { margin-top: 14px; }

.layer-details { border: 1px solid #dce8df; border-radius: 16px; background: #f8fbf9; color: #294a38; }
.layer-details summary { padding: 13px 15px; font-size: 13px; font-weight: 800; cursor: pointer; }

.layer-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 12px 12px;
}

.layer-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 1px solid #dce8df;
  border-radius: 12px;
  background: white;
  color: #294a38;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.layer-toggle input { accent-color: #2b7b50; }
.structure-note { margin: 22px 2px 0; padding-top: 17px; border-top: 1px solid #e7eee9; color: #718078; font-size: 12px; line-height: 1.55; text-align: center; }

@media (max-width: 760px) {
  body { padding: 14px 10px; }
  .prototype-shell { padding: 22px 14px 18px; border-radius: 22px; }
  .app-topbar { margin: -7px 0 18px; }
  .app-brand img { width: 46px; height: 46px; }
  .description { margin-bottom: 18px; }
  .designer-grid { grid-template-columns: 1fr; gap: 18px; }
  .preview-panel { position: static; }
  .badge-stage { min-height: 330px; }
  .yn-badge { width: min(88vw, 330px); }
}

@media (max-width: 380px) {
  .choice-grid { gap: 7px; }
  .choice-section { padding: 12px; }
  .choice-card { min-height: 94px; }
  .choice-card img { width: 62px; height: 62px; }
  .badge-stage { min-height: 305px; }
}
