:root {
  --ink: #141414;
  --paper: #f4efe4;
  --muted: #666056;
  --line: #d8d1c2;
  --accent: #ff4f1f;
  --accent-2: #0ea5a4;
  --panel: #fffaf0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #ece6d8;
  font-family: Arial, "Noto Sans KR", sans-serif;
}

.landing-body {
  background:
    linear-gradient(120deg, rgba(83, 224, 193, 0.06) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 78% 18%, rgba(83, 224, 193, 0.22), transparent 29%),
    radial-gradient(circle at 16% 12%, rgba(255, 79, 31, 0.15), transparent 24%),
    linear-gradient(180deg, #101418, #07090d 72%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  color: #f7f3e8;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell,
.form-shell {
  display: grid;
  grid-template-columns: minmax(320px, 760px);
  justify-content: center;
  min-height: 100vh;
  padding: 32px 18px;
}

.control-panel {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 28px;
  box-shadow: 0 18px 60px rgba(20, 20, 20, 0.12);
}

.panel-heading {
  margin-bottom: 24px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.18;
}

.helper-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.poster-form {
  display: grid;
  gap: 18px;
}

fieldset {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0 0 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

legend {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 900;
}

label {
  display: grid;
  gap: 7px;
  color: #2b2925;
  font-size: 13px;
  font-weight: 800;
}

.field-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.check-row {
  display: flex;
  gap: 8px;
  align-items: center;
  width: fit-content;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.check-row input {
  width: auto;
}

.ai-choice-muted {
  opacity: 0.55;
}

.is-hidden {
  display: none !important;
}

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

.locked-option input {
  cursor: not-allowed;
}

.landing-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.landing-nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 18px 0;
}

.brand-mark,
.nav-link,
.hero-button {
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-size: 16px;
  font-weight: 900;
}

.brand-mark::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(135deg, #53e0c1, #ff4f1f);
  box-shadow: 0 0 24px rgba(83, 224, 193, 0.5);
}

.nav-link {
  border: 1px solid rgba(247, 243, 232, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(247, 243, 232, 0.06);
  color: #e8e2d4;
  font-size: 13px;
  font-weight: 900;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(340px, 0.78fr);
  gap: 48px;
  align-items: center;
  min-height: 620px;
}

.hero-copy {
  display: grid;
  gap: 22px;
}

.hero-copy h1 {
  max-width: 780px;
  color: #fffdf7;
  font-size: clamp(44px, 6vw, 78px);
  line-height: 0.98;
  letter-spacing: 0;
}

.landing-body .kicker {
  color: #53e0c1;
}

.hero-copy p:not(.kicker) {
  max-width: 680px;
  margin: 0;
  color: #d9d2c6;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.hero-button,
.ghost-button {
  display: inline-grid;
  width: fit-content;
  min-height: 54px;
  place-items: center;
  border-radius: 8px;
  padding: 0 22px;
  font-size: 16px;
  font-weight: 900;
}

.hero-button {
  background: linear-gradient(135deg, #ff4f1f, #ff7a45);
  color: #fffdf7;
  box-shadow: 0 18px 44px rgba(255, 79, 31, 0.26);
}

.ghost-button {
  border: 1px solid rgba(247, 243, 232, 0.2);
  background: rgba(247, 243, 232, 0.07);
  color: #fffdf7;
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.hero-metrics span {
  border: 1px solid rgba(83, 224, 193, 0.22);
  border-radius: 8px;
  background: rgba(83, 224, 193, 0.08);
  color: #d9fff5;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
}

.hero-panel {
  display: grid;
  place-items: center;
}

.mock-poster {
  position: relative;
  width: min(390px, 100%);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid rgba(247, 243, 232, 0.28);
  border-radius: 10px;
  background:
    radial-gradient(circle at 76% 24%, #2457ff 0 16%, transparent 29%),
    linear-gradient(142deg, #102a4a, #071018 62%, #0ea5a4);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.36),
    0 0 0 12px rgba(247, 243, 232, 0.04);
  padding: 28px;
}

.mock-top,
.mock-title,
.mock-title.short,
.mock-modules,
.mock-info,
.mock-footer,
.mock-person {
  position: absolute;
}

.mock-top {
  top: 30px;
  left: 28px;
  width: 92px;
  height: 16px;
  border-radius: 4px;
  background: rgba(247, 243, 232, 0.8);
}

.mock-title {
  top: 96px;
  left: 28px;
  width: 230px;
  height: 30px;
  border-radius: 6px;
  background: #f7f3e8;
}

.mock-title.short {
  top: 142px;
  width: 174px;
  background: #53e0c1;
}

.mock-person {
  top: 64px;
  right: 20px;
  width: 122px;
  height: 230px;
  border-radius: 64px 64px 10px 10px;
  background: linear-gradient(180deg, #f3d0b8, #1c2430 40%);
}

.mock-modules {
  left: 28px;
  right: 28px;
  bottom: 142px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mock-modules span {
  height: 64px;
  border-radius: 8px;
  background: rgba(247, 243, 232, 0.14);
  border: 1px solid rgba(247, 243, 232, 0.28);
}

.mock-info {
  left: 28px;
  right: 28px;
  bottom: 54px;
  height: 70px;
  border-radius: 8px;
  background: rgba(247, 243, 232, 0.9);
}

.mock-footer {
  left: 60px;
  right: 60px;
  bottom: 24px;
  height: 10px;
  border-radius: 4px;
  background: rgba(247, 243, 232, 0.68);
}

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

.tool-card {
  display: grid;
  gap: 10px;
  min-height: 190px;
  border: 1px solid rgba(247, 243, 232, 0.14);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(247, 243, 232, 0.1), rgba(247, 243, 232, 0.055));
  color: inherit;
  padding: 22px;
  text-decoration: none;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.tool-card span {
  color: #53e0c1;
  font-size: 12px;
  font-weight: 900;
}

.tool-card h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.tool-card p {
  margin: 0;
  color: #cfc8bb;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

.tool-card strong {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 900;
}

.active-tool {
  border-color: rgba(83, 224, 193, 0.58);
  background:
    linear-gradient(180deg, rgba(83, 224, 193, 0.16), rgba(83, 224, 193, 0.08));
}

.active-tool strong {
  color: #53e0c1;
}

.pending-tool {
  opacity: 0.72;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c9c0b0;
  border-radius: 8px;
  background: #fffdf7;
  color: #16130f;
  padding: 12px;
  font-size: 14px;
  outline: none;
}

input.is-example,
textarea.is-example {
  color: #928a7e;
}

input[type="file"] {
  padding: 10px;
  cursor: pointer;
}

textarea {
  resize: vertical;
}

select[multiple] {
  min-height: 160px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 79, 31, 0.14);
}

input::placeholder,
textarea::placeholder {
  color: rgba(43, 41, 37, 0.34);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.required {
  color: var(--accent);
  font-size: 12px;
}

.button-row {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 10px;
}

.generate-button,
.copy-button,
.reset-button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  color: #fffdf7;
  cursor: pointer;
  font-weight: 900;
}

.generate-button {
  background: #141414;
}

.copy-button {
  background: #2f6f6f;
}

.reset-button {
  background: #6f665b;
}

.generate-button:disabled {
  cursor: progress;
  opacity: 0.6;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.prompt-box-label {
  gap: 8px;
}

.prompt-output {
  min-height: 190px;
  background: #fff;
  font-size: 13px;
  line-height: 1.55;
}

.reference-preview {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px dashed #c9c0b0;
  border-radius: 8px;
  background: #fffdf7;
  padding: 10px;
}

.reference-preview img {
  width: 88px;
  aspect-ratio: 210 / 297;
  display: block;
  border: 1px solid #d8d1c2;
  background:
    linear-gradient(135deg, rgba(20, 20, 20, 0.12), rgba(20, 20, 20, 0.02)),
    #f4efe4;
  object-fit: cover;
}

.reference-preview:not(.has-image) img {
  opacity: 0.45;
}

.reference-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.preview-panel {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 32px;
  background:
    linear-gradient(90deg, rgba(20, 20, 20, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(20, 20, 20, 0.05) 1px, transparent 1px),
    #f4efe4;
  background-size: 28px 28px;
}

.poster {
  --poster-pad: 34px;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  width: min(520px, 100%);
  aspect-ratio: 210 / 297;
  overflow: hidden;
  border: 1px solid rgba(20, 20, 20, 0.18);
  background:
    radial-gradient(circle at 76% 74%, color-mix(in srgb, var(--accent-2) 72%, transparent), transparent 24%),
    linear-gradient(108deg, color-mix(in srgb, var(--accent) 86%, transparent) 0 18%, transparent 18%),
    var(--paper);
  box-shadow: 0 28px 70px rgba(20, 20, 20, 0.2);
  color: var(--ink);
  padding: var(--poster-pad);
}

.ai-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: none;
  object-fit: cover;
}

.has-ai-background .ai-background {
  display: block;
}

.poster-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper) 94%, transparent), transparent 42%),
    linear-gradient(0deg, color-mix(in srgb, var(--paper) 92%, transparent), transparent 46%);
}

.poster-top,
.poster-hero,
.poster-info,
.poster-benefits,
.poster-bottom {
  position: relative;
  z-index: 1;
}

.poster-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 3px solid currentColor;
  padding-bottom: 16px;
}

.logo-wrap {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: center;
}

.logo-wrap img {
  width: 52px;
  height: 52px;
  display: none;
  flex: 0 0 52px;
  object-fit: contain;
  border: 2px solid currentColor;
  background: #fff;
  padding: 5px;
}

.logo-wrap.has-image img {
  display: block;
}

.poster-activity,
.poster-date {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
}

.poster-date {
  text-align: right;
}

.poster-hero {
  align-self: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 22px;
  align-items: end;
  padding: 26px 0 22px;
}

.title-block {
  display: grid;
  gap: 16px;
}

.poster-hook {
  width: fit-content;
  margin: 0;
  border: 2px solid currentColor;
  background: color-mix(in srgb, var(--paper) 70%, white);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 900;
}

.title-block h2 {
  margin: 0;
  max-width: 10ch;
  font-size: clamp(56px, 7.4vw, 88px);
  line-height: 0.9;
  letter-spacing: 0;
  word-break: keep-all;
}

.title-compact .title-block h2 {
  max-width: 12ch;
  font-size: clamp(46px, 6.2vw, 74px);
  line-height: 0.96;
}

.title-block p {
  margin: 0;
  max-width: 34ch;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.38;
}

.instructor-wrap {
  display: grid;
  gap: 8px;
  margin: 0;
  align-self: stretch;
}

.instructor-wrap img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 3px solid currentColor;
  background:
    linear-gradient(135deg, rgba(20, 20, 20, 0.18), rgba(20, 20, 20, 0.04)),
    #fffdf7;
  object-fit: cover;
}

.instructor-wrap figcaption {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
}

.poster-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.poster-info div {
  min-height: 74px;
  border-top: 2px solid currentColor;
  background: color-mix(in srgb, var(--paper) 72%, white);
  padding: 8px 8px 0 0;
}

.poster-info span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.poster-info strong {
  display: block;
  font-size: 16px;
  line-height: 1.3;
  word-break: keep-all;
}

.poster-benefits {
  align-self: end;
  margin: 0 0 20px;
  border: 2px solid currentColor;
  background: color-mix(in srgb, var(--paper) 62%, white);
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.poster-bottom {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
}

.poster-bottom p {
  margin: 0;
  max-width: 260px;
  font-size: 15px;
  font-weight: 900;
}

.qr-wrap {
  display: grid;
  gap: 6px;
  width: 116px;
  flex: 0 0 116px;
  padding: 8px;
  background: #fff;
  border: 2px solid currentColor;
}

.qr-wrap img {
  display: block;
  width: 96px;
  height: 96px;
  background:
    linear-gradient(90deg, transparent 45%, rgba(20, 20, 20, 0.16) 45%, rgba(20, 20, 20, 0.16) 55%, transparent 55%),
    linear-gradient(transparent 45%, rgba(20, 20, 20, 0.16) 45%, rgba(20, 20, 20, 0.16) 55%, transparent 55%),
    #f5f2e8;
  object-fit: contain;
}

.qr-wrap.has-image img {
  background: #fff;
}

.qr-wrap span {
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.ai-layout-editorial {
  background:
    linear-gradient(180deg, transparent 0 74%, var(--accent-2) 74% 100%),
    linear-gradient(90deg, transparent 0 82%, var(--accent) 82% 91%, transparent 91%),
    var(--paper);
}

.ai-layout-editorial .title-block h2 {
  font-family: Georgia, "Times New Roman", serif;
}

.ai-layout-friendly {
  background:
    radial-gradient(circle at 82% 65%, color-mix(in srgb, var(--accent-2) 76%, transparent), transparent 23%),
    radial-gradient(circle at 14% 28%, color-mix(in srgb, var(--accent) 62%, transparent), transparent 18%),
    var(--paper);
}

.ai-layout-friendly .poster-hook,
.ai-layout-friendly .poster-benefits {
  border-radius: 8px;
}

@media (max-width: 900px) {
  .app-shell,
  .form-shell {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .control-panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .preview-panel {
    padding: 24px 14px;
  }

  .poster {
    --poster-pad: 24px;
  }

  .landing-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 54px 0 28px;
  }

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

@media (max-width: 520px) {
  .control-panel {
    padding: 22px 16px;
  }

  .form-grid,
  .poster-info,
  .button-row,
  .reference-preview {
    grid-template-columns: 1fr;
  }

  .poster-hero {
    grid-template-columns: 1fr;
  }

  .instructor-wrap {
    max-width: 150px;
    justify-self: end;
  }

  .title-block h2 {
    font-size: 44px;
  }

  .title-block p {
    font-size: 16px;
  }

  .poster-bottom {
    align-items: flex-start;
  }

  .qr-wrap {
    width: 98px;
    flex-basis: 98px;
  }

  .qr-wrap img {
    width: 78px;
    height: 78px;
  }
}

/* Dynamic Body Themes for poster.html */
body.edu-theme {
  background-color: #f4f6fb;
  background-image: 
    linear-gradient(rgba(99, 102, 241, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  position: relative;
}

body.edu-theme::before {
  content: "";
  position: fixed;
  top: -25%;
  left: -25%;
  width: 70vw;
  height: 70vw;
  background: radial-gradient(circle at center, rgba(0, 242, 254, 0.22) 0%, rgba(99, 102, 241, 0.08) 50%, transparent 70%);
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
}

body.edu-theme::after {
  content: "";
  position: fixed;
  bottom: -25%;
  right: -25%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle at center, rgba(83, 224, 193, 0.2) 0%, rgba(0, 242, 254, 0.08) 50%, transparent 70%);
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
}

body.edu-theme .control-panel {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 242, 254, 0.25);
  box-shadow: 
    0 25px 55px rgba(99, 102, 241, 0.08),
    0 0 35px rgba(0, 242, 254, 0.04);
}

body.academy-theme {
  background: 
    radial-gradient(circle at 18% 12%, rgba(255, 215, 0, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 82% 88%, rgba(14, 165, 164, 0.12) 0%, transparent 45%),
    linear-gradient(rgba(20, 20, 20, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 20, 20, 0.035) 1px, transparent 1px),
    #e8e2d4;
  background-size: 100% 100%, 100% 100%, 36px 36px, 36px 36px;
}
body.academy-theme .control-panel {
  border-color: rgba(255, 215, 0, 0.35);
  box-shadow: 
    0 18px 60px rgba(20, 20, 20, 0.08), 
    0 0 25px rgba(255, 215, 0, 0.05);
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    background: #fff;
  }

  .control-panel {
    display: none;
  }

  .app-shell,
  .preview-panel {
    display: block;
    min-height: auto;
    padding: 0;
    background: #fff;
  }

  .poster {
    width: 210mm;
    height: 297mm;
    box-shadow: none;
    border: 0;
  }
}

/* Reference Poster Example Layout Overrides */
@media (min-width: 1024px) {
  .form-shell {
    grid-template-columns: minmax(320px, 760px) 380px;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
  }
}

.reference-panel {
  display: block;
}

.reference-card {
  position: sticky;
  top: 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 20px;
  box-shadow: 0 18px 60px rgba(20, 20, 20, 0.12);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reference-title {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.reference-img-wrapper {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.reference-img-wrapper img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.reference-img-wrapper img:hover {
  transform: scale(1.02);
}

.reference-help {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 700;
}

/* Academy Theme specific styles for Reference Panel */
body.academy-theme .reference-card {
  border-color: rgba(255, 215, 0, 0.35);
  box-shadow: 
    0 18px 60px rgba(20, 20, 20, 0.08), 
    0 0 25px rgba(255, 215, 0, 0.05);
}
body.academy-theme .reference-title {
  color: #a4873b;
  border-color: rgba(255, 215, 0, 0.2);
}

/* Edu Theme specific styles for Reference Panel */
body.edu-theme .reference-card {
  border-color: rgba(0, 242, 254, 0.25);
  box-shadow: 
    0 18px 60px rgba(99, 102, 241, 0.08), 
    0 0 25px rgba(0, 242, 254, 0.04);
}
body.edu-theme .reference-title {
  color: #0ea5a4;
  border-color: rgba(0, 242, 254, 0.15);
}

/* Mobile responsive styles */
@media (max-width: 1023px) {
  .form-shell {
    grid-template-columns: minmax(320px, 760px);
  }
  .reference-panel {
    order: -1; /* Display above the form on mobile */
    margin-bottom: 24px;
    width: 100%;
  }
  .reference-card {
    position: static;
  }
}

/* 라이트박스 모달 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(16, 20, 24, 0.94) 0%, rgba(7, 9, 13, 0.98) 100%);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 24px;
}

.lightbox:not(.is-hidden) {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  position: relative;
  max-width: min(720px, 90vw);
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 
    0 24px 70px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 215, 0, 0.15),
    0 0 40px rgba(255, 215, 0, 0.05);
  background: #000;
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox:not(.is-hidden) .lightbox-content {
  transform: scale(1);
}

.lightbox-content img {
  display: block;
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 28px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: all 0.25s ease;
  z-index: 1001;
}

.lightbox-close:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.6);
  color: #ffd700;
  transform: rotate(90deg);
}

/* 라이트박스 뒷배경 꾸미기 (골드/인디고 오라 효과) */
.lightbox::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vw;
  height: 80vw;
  background: radial-gradient(circle at center, rgba(255, 215, 0, 0.08) 0%, rgba(14, 165, 164, 0.04) 40%, transparent 70%);
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
}

/* 테마별 라이트박스 오라 색상 최적화 */
body.edu-theme .lightbox::before {
  background: radial-gradient(circle at center, rgba(0, 242, 254, 0.1) 0%, rgba(99, 102, 241, 0.05) 50%, transparent 70%);
}
body.edu-theme .lightbox-content {
  box-shadow: 
    0 24px 70px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 242, 254, 0.15),
    0 0 40px rgba(0, 242, 254, 0.04);
}
body.edu-theme .lightbox-close {
  border-color: rgba(0, 242, 254, 0.25);
}
body.edu-theme .lightbox-close:hover {
  background: rgba(0, 242, 254, 0.1);
  border-color: rgba(0, 242, 254, 0.6);
  color: #00f2fe;
}

/* Dynamic Market Theme for poster.html */
body.market-theme {
  background-color: #fdfaf2;
  background-image: 
    linear-gradient(rgba(255, 79, 31, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 79, 31, 0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  position: relative;
}

body.market-theme::before {
  content: "";
  position: fixed;
  top: -25%;
  left: -25%;
  width: 70vw;
  height: 70vw;
  background: radial-gradient(circle at center, rgba(255, 79, 31, 0.14) 0%, rgba(255, 122, 69, 0.05) 50%, transparent 70%);
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
}

body.market-theme::after {
  content: "";
  position: fixed;
  bottom: -25%;
  right: -25%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle at center, rgba(255, 122, 69, 0.14) 0%, rgba(255, 79, 31, 0.05) 50%, transparent 70%);
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
}

body.market-theme .control-panel {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 79, 31, 0.25);
  box-shadow: 
    0 25px 55px rgba(255, 79, 31, 0.06),
    0 0 35px rgba(255, 122, 69, 0.03);
}

/* Market Template Gallery View Styles */
.market-gallery-view {
  width: 100%;
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 79, 31, 0.25);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 
    0 25px 55px rgba(255, 79, 31, 0.06),
    0 0 35px rgba(255, 122, 69, 0.03);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.gallery-heading {
  margin-bottom: 4px;
}

.market-tab-container {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 12px;
}

.market-tab-btn {
  background: none;
  border: none;
  padding: 8px 18px;
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.25s ease;
}

.market-tab-btn:hover {
  background: rgba(255, 79, 31, 0.05);
  color: #ff4f1f;
}

.market-tab-btn.active {
  background: #ff4f1f;
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 79, 31, 0.25);
}

.market-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  margin-top: 12px;
}

.market-template-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 79, 31, 0.15);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.market-template-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 79, 31, 0.45);
  box-shadow: 0 20px 40px rgba(255, 79, 31, 0.12);
}

.template-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #ece6d8;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 79, 31, 0.1);
}

.template-img-wrapper img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.market-template-card:hover .template-img-wrapper img {
  transform: scale(1.05);
}

.template-img-wrapper .category-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #ff4f1f;
  color: #fff;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 900;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(255, 79, 31, 0.3);
}

.template-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.template-info h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  color: #141414;
  line-height: 1.3;
}

.template-info p {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 700;
}

.select-template-btn {
  background: linear-gradient(135deg, #ff4f1f, #ff7a45);
  color: #fffdf7;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 900;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: auto;
  text-align: center;
  box-shadow: 0 4px 10px rgba(255, 79, 31, 0.15);
}

.select-template-btn:hover {
  box-shadow: 0 6px 18px rgba(255, 79, 31, 0.35);
  transform: translateY(-1px);
}

.back-gallery-btn {
  background: none;
  border: 1px solid rgba(255, 79, 31, 0.3);
  color: #ff4f1f;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 0;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

.back-gallery-btn:hover {
  background: rgba(255, 79, 31, 0.05);
  border-color: #ff4f1f;
  transform: translateX(-2px);
}

@media (max-width: 768px) {
  .market-tab-container {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 8px;
  }
}

.nav-buttons-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.back-home-btn {
  background: rgba(20, 20, 20, 0.04);
  border: 1.5px solid rgba(20, 20, 20, 0.18);
  color: #2b2925;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  text-decoration: none;
}

.back-home-btn:hover {
  background: rgba(20, 20, 20, 0.08);
  border-color: rgba(20, 20, 20, 0.4);
  color: #000000;
  transform: translateX(-2px);
}

/* 교육용 테마 (Edu Theme) */
body.edu-theme .back-home-btn {
  background: rgba(99, 102, 241, 0.08);
  border: 1.5px solid rgba(99, 102, 241, 0.45);
  color: #4f46e5;
}

body.edu-theme .back-home-btn:hover {
  background: rgba(99, 102, 241, 0.16);
  border-color: #4f46e5;
  color: #312e81;
}

/* 학원용 테마 (Academy Theme) */
body.academy-theme .back-home-btn {
  background: rgba(164, 135, 59, 0.08);
  border: 1.5px solid rgba(164, 135, 59, 0.45);
  color: #7c5e10;
}

body.academy-theme .back-home-btn:hover {
  background: rgba(164, 135, 59, 0.16);
  border-color: #7c5e10;
  color: #40310a;
}

/* 시장용 테마 (Market Theme) */
body.market-theme .back-home-btn {
  background: rgba(255, 79, 31, 0.08);
  border: 1.5px solid rgba(255, 79, 31, 0.45);
  color: #e03b0d;
}

body.market-theme .back-home-btn:hover {
  background: rgba(255, 79, 31, 0.16);
  border-color: #ff4f1f;
  color: #991b1b;
}



