:root {
  color-scheme: light;
  --ink: #1d2524;
  --muted: #66736f;
  --line: #d8dfdb;
  --paper: #f7f6f1;
  --panel: #ffffff;
  --green: #276a54;
  --green-soft: #dcece4;
  --gold: #b47b21;
  --rose: #b75b57;
  --blue: #356f98;
  --shadow: 0 16px 48px rgba(31, 44, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

.topbar-actions,
.export-grid {
  display: flex;
  gap: 8px;
}

.icon-button,
.export-grid button,
.segmented button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.icon-button {
  padding: 0 14px;
}

.link-button {
  display: inline-grid;
  place-items: center;
}

.hub-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 246, 241, 0.96)),
    var(--paper);
}

.hub-topbar {
  align-items: center;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-symbol {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #7f3b20;
  color: #fff7ed;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(70, 31, 16, 0.18);
}

.brand-mark strong,
.brand-mark em {
  display: block;
}

.brand-mark strong {
  font-size: 20px;
  line-height: 1.05;
}

.brand-mark em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.hub-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-nav a {
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

.hub-main,
.intro-main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.hub-hero,
.tool-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 14px;
  align-items: stretch;
}

.hub-hero {
  min-height: 320px;
}

.hero-copy,
.tool-copy,
.character-card,
.cushion-intro-card,
.quest-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 36px rgba(31, 44, 40, 0.08);
}

.hero-copy,
.tool-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(20px, 3vw, 34px);
}

.hero-copy h1,
.tool-copy h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(28px, 4.1vw, 46px);
  line-height: 1.12;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.hero-copy p:not(.eyebrow),
.tool-copy > p {
  max-width: 620px;
  margin: 12px 0 0;
  color: #4d5b57;
  font-size: 15px;
  line-height: 1.65;
  font-weight: 650;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.primary-link,
.secondary-link {
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 900;
}

.primary-link {
  background: var(--green);
  color: #fff;
  box-shadow: 0 12px 24px rgba(39, 106, 84, 0.22);
}

.secondary-link {
  border: 1px solid var(--line);
  background: #fff;
}

.character-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(210px, 1fr) auto;
  place-items: center;
  min-height: 320px;
  padding: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 24%, rgba(180, 123, 33, 0.12), transparent 30%),
    linear-gradient(180deg, #fffaf1, #ffffff);
}

.mascot-image {
  display: block;
  width: min(270px, 82%);
  max-height: 254px;
  object-fit: contain;
  align-self: end;
  filter: drop-shadow(0 18px 24px rgba(88, 41, 22, 0.16));
}

.character-card.large {
  min-height: 560px;
}

.monk-character {
  position: relative;
  width: 176px;
  height: 218px;
  align-self: end;
}

.monk-character.big {
  width: 260px;
  height: 320px;
}

.monk-head,
.monk-face,
.monk-body,
.monk-sash {
  position: absolute;
  display: block;
}

.monk-head {
  left: 50%;
  top: 8px;
  width: 86px;
  height: 86px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #f2c59f;
  border: 5px solid #6b321c;
}

.monk-character.big .monk-head {
  width: 126px;
  height: 126px;
}

.monk-head::before,
.monk-head::after {
  content: "";
  position: absolute;
  top: 39px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2b1b15;
}

.monk-head::before {
  left: 24px;
}

.monk-head::after {
  right: 24px;
}

.monk-face {
  left: 50%;
  top: 65px;
  width: 28px;
  height: 12px;
  transform: translateX(-50%);
  border-bottom: 4px solid #8f4527;
  border-radius: 0 0 28px 28px;
}

.monk-character.big .monk-face {
  top: 95px;
}

.monk-body {
  left: 50%;
  bottom: 12px;
  width: 142px;
  height: 112px;
  transform: translateX(-50%);
  border-radius: 46px 46px 18px 18px;
  background: linear-gradient(135deg, #8b3f21, #5f2a18);
  border: 5px solid #4b2115;
}

.monk-character.big .monk-body {
  width: 206px;
  height: 188px;
}

.monk-sash {
  left: 62px;
  bottom: 26px;
  width: 38px;
  height: 90px;
  transform: rotate(26deg);
  border-radius: 24px;
  background: #c58a35;
  opacity: 0.95;
}

.monk-character.big .monk-sash {
  left: 92px;
  bottom: 64px;
  height: 166px;
}

.speech-bubble {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  width: 100%;
  display: grid;
  gap: 4px;
  border: 1px solid #ead7ba;
  border-radius: 8px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.92);
}

.speech-bubble strong {
  color: #7f3b20;
  font-size: 14px;
}

.speech-bubble span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  word-break: keep-all;
}

.section-title-row span,
.quest-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.quest-section {
  margin-top: 20px;
}

.section-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title-row h2 {
  font-size: 26px;
}

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

.quest-card {
  min-height: 154px;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  padding: 18px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.quest-card.available:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(39, 106, 84, 0.16);
}

.quest-card.locked {
  opacity: 0.74;
}

.quest-icon {
  position: relative;
  display: inline-grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  overflow: hidden;
}

.quest-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quest-card.available .quest-icon {
  background: #f2dfc2;
  color: #7f3b20;
}

.quest-icon i,
.quest-icon b {
  position: absolute;
  display: block;
}

.icon-cushion i {
  width: 47px;
  height: 47px;
  border-radius: 12px;
  background: linear-gradient(135deg, #a6552d, #6f2e18);
  border: 3px solid #5d2a18;
  box-shadow: inset 0 0 0 3px rgba(255, 217, 177, 0.18);
}

.icon-cushion b {
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: rgba(64, 25, 13, 0.45);
}

.icon-bowl i {
  bottom: 18px;
  width: 50px;
  height: 28px;
  border-radius: 0 0 18px 18px;
  background: #8f4527;
  border: 3px solid #5d2a18;
}

.icon-bowl b {
  top: 21px;
  width: 42px;
  height: 15px;
  border-radius: 50%;
  background: #f3d89c;
}

.icon-broom i {
  left: 43px;
  top: 15px;
  width: 7px;
  height: 48px;
  border-radius: 4px;
  background: #7f3b20;
  transform: rotate(32deg);
}

.icon-broom b {
  left: 18px;
  bottom: 14px;
  width: 34px;
  height: 25px;
  border-radius: 4px 4px 10px 10px;
  background: #c58a35;
  transform: rotate(32deg);
  box-shadow: inset 0 -4px 0 rgba(127, 59, 32, 0.22);
}

.icon-checklist i {
  width: 43px;
  height: 49px;
  border-radius: 5px;
  background: #fffaf1;
  border: 3px solid #276a54;
}

.icon-checklist b {
  left: 28px;
  top: 27px;
  width: 25px;
  height: 20px;
  border-top: 3px solid #b47b21;
  border-bottom: 3px solid #b47b21;
}

.icon-checklist::after {
  content: "";
  position: absolute;
  left: 24px;
  top: 25px;
  width: 9px;
  height: 15px;
  border-right: 3px solid #276a54;
  border-bottom: 3px solid #276a54;
  transform: rotate(42deg);
}

.icon-box i {
  width: 46px;
  height: 38px;
  border-radius: 5px;
  background: #d8a45a;
  border: 3px solid #7f3b20;
  transform: translateY(4px);
}

.icon-box b {
  top: 20px;
  width: 50px;
  height: 19px;
  border-radius: 4px;
  background: #f0c77f;
  border: 3px solid #7f3b20;
}

.icon-people i,
.icon-people b {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f2c59f;
  border: 3px solid #7f3b20;
}

.icon-people i {
  left: 16px;
  top: 21px;
}

.icon-people b {
  right: 16px;
  top: 21px;
}

.icon-people::after {
  content: "";
  position: absolute;
  left: 16px;
  bottom: 14px;
  width: 44px;
  height: 21px;
  border-radius: 14px 14px 5px 5px;
  background: #276a54;
}

.quest-card strong {
  font-size: 21px;
}

.quest-card p {
  margin: 0;
  color: #56625f;
  line-height: 1.55;
  font-weight: 650;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.quest-card em {
  width: fit-content;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #fff;
  color: var(--green);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.quest-card.locked em {
  color: #7c5018;
  background: #fff7ed;
  border-color: #ead7ba;
}

.intro-main {
  min-height: calc(100vh - 80px);
  display: grid;
  align-items: center;
}

.tool-intro {
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
}

.tool-visual {
  min-width: 0;
}

.cushion-intro-card {
  position: relative;
  min-height: 560px;
  display: grid;
  grid-template-rows: minmax(220px, 1fr) auto auto;
  gap: 16px;
  overflow: hidden;
  padding: 28px;
  background:
    radial-gradient(circle at 24% 18%, rgba(180, 123, 33, 0.16), transparent 30%),
    linear-gradient(180deg, #fffaf1 0%, #ffffff 68%);
}

.cushion-preview {
  position: relative;
  min-height: 260px;
  display: grid;
  place-items: center;
}

.large-cushion,
.cushion-shadow {
  display: block;
}

.large-cushion {
  position: relative;
  width: min(250px, 68vw);
  aspect-ratio: 0.78;
  border-radius: 18px 18px 14px 14px;
  background:
    linear-gradient(90deg, rgba(255, 224, 191, 0.08), transparent 24%, rgba(44, 18, 10, 0.12)),
    linear-gradient(145deg, #a6552d, #7b331b 58%, #612715);
  border: 5px solid #542515;
  box-shadow:
    inset 0 0 0 8px rgba(255, 207, 153, 0.08),
    inset 0 -28px 34px rgba(54, 21, 10, 0.24),
    0 26px 46px rgba(89, 42, 24, 0.22);
}

.large-cushion::before,
.large-cushion::after {
  content: "";
  position: absolute;
  left: 17px;
  right: 17px;
  border-radius: 50%;
}

.large-cushion::before {
  top: 51%;
  height: 2px;
  background: rgba(72, 29, 15, 0.3);
}

.large-cushion::after {
  bottom: 14px;
  height: 12px;
  border-bottom: 3px solid rgba(62, 24, 12, 0.35);
}

.cushion-shadow {
  position: absolute;
  bottom: 18px;
  width: 240px;
  height: 22px;
  border-radius: 50%;
  background: rgba(77, 43, 24, 0.16);
  filter: blur(6px);
}

.mini-layout-card {
  border: 1px solid #ead7ba;
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.mini-layout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mini-layout-head strong {
  font-size: 14px;
}

.mini-layout-head span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

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

.mini-layout-grid i {
  display: block;
  aspect-ratio: 1;
  border-radius: 5px;
  background: linear-gradient(135deg, #a6552d, #6f2e18);
  border: 2px solid #5d2a18;
}

.mini-layout-grid i:nth-child(5n) {
  margin-right: 18px;
}

.cushion-bubble {
  position: static;
}

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

.reward-list > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.reward-list span {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.reward-list strong {
  display: block;
  margin-top: 12px;
}

.reward-list p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  font-weight: 650;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(292px, 360px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  flex: 1;
}

.control-panel,
.stage-panel {
  min-width: 0;
}

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

.panel-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(31, 44, 40, 0.05);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.section-heading span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.section-heading h2 {
  font-size: 15px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: #fbfcfa;
  outline: none;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(39, 106, 84, 0.13);
}

.field-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

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

.input-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  overflow: hidden;
}

.input-with-unit:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(39, 106, 84, 0.13);
}

.input-with-unit input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.input-with-unit em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  text-align: center;
  border-left: 1px solid var(--line);
}

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

.segmented button.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
}

.check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.export-grid button {
  padding: 0 6px;
}

.stage-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

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

.summary-strip > div {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.summary-strip span,
.canvas-toolbar span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.summary-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.canvas-toolbar strong {
  display: block;
  margin-bottom: 4px;
}

.canvas-toolbar label {
  display: grid;
  grid-template-columns: auto 140px;
  align-items: center;
  gap: 10px;
}

.stage-scroll {
  min-height: 540px;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(29, 37, 36, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(29, 37, 36, 0.04) 1px, transparent 1px);
  background-size: 22px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stage-frame {
  width: fit-content;
  min-width: 100%;
  min-height: 100%;
  display: grid;
  place-items: start center;
  padding: 24px;
  transform-origin: top center;
}

#layoutSvg {
  display: block;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(120%);
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  transition: transform 180ms ease;
  z-index: 40;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 980px) {
  .hub-hero,
  .tool-intro {
    grid-template-columns: 1fr;
  }

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

  .character-card.large {
    min-height: 360px;
  }

  .character-card {
    min-height: 240px;
  }

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

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

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hub-nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hub-main,
  .intro-main {
    width: min(100% - 24px, 1180px);
    padding-top: 16px;
  }

  .hero-copy,
  .tool-copy {
    padding: 24px;
  }

  .hero-copy h1,
  .tool-copy h1 {
    font-size: 32px;
  }

  .quest-grid,
  .reward-list {
    grid-template-columns: 1fr;
  }

  .quest-card {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 14px;
  }

  .quest-icon {
    width: 64px;
    height: 64px;
  }

  .quest-icon {
    transform: scale(0.9);
    transform-origin: top left;
  }

  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .monk-character {
    transform: scale(0.82);
  }

  .workspace {
    padding: 12px;
  }

  .control-panel,
  .summary-strip {
    grid-template-columns: 1fr;
  }

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

  .canvas-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .canvas-toolbar label {
    width: 100%;
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .stage-scroll {
    min-height: 420px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .control-panel,
  .summary-strip,
  .canvas-toolbar,
  .toast {
    display: none !important;
  }

  .workspace {
    display: block;
    padding: 0;
  }

  .stage-scroll {
    border: 0;
    overflow: visible;
    min-height: auto;
  }

  .stage-frame {
    padding: 0;
  }

  #layoutSvg {
    width: 100%;
    height: auto;
    box-shadow: none;
  }
}
