@font-face {
  font-family: "Gmarket Sans Bold";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansBold.woff")
    format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pretendard";
  src: url("https://cdn.jsdelivr.net/npm/pretendard@1.3.9/dist/web/static/woff2/Pretendard-SemiBold.woff2")
    format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pretendard";
  src: url("https://cdn.jsdelivr.net/npm/pretendard@1.3.9/dist/web/static/woff2/Pretendard-Bold.woff2")
    format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #f3f5ff;
  --line: rgba(243, 245, 255, 0.72);
  --line-weak: rgba(243, 245, 255, 0.36);
  --wall: #353ca7;
  --ui-font: "Pretendard", "Noto Sans KR", "Space Grotesk", sans-serif;
  --title-font: "Min Sans Black", "Min Sans", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  position: relative;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--ui-font);
  touch-action: none;
}

#posterCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.intro-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 8, 28, 0.84);
  backdrop-filter: blur(3px);
}

.intro-gate.is-hidden {
  display: none;
}

.intro-card {
  width: min(1080px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(243, 245, 255, 0.52);
  background: rgba(34, 45, 145, 0.78);
  display: grid;
  grid-template-columns: minmax(260px, 44%) 1fr;
}

.intro-image-wrap {
  min-height: 100%;
  background: rgba(0, 0, 0, 0.22);
}

.intro-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 380px;
  object-fit: cover;
}

.intro-content {
  display: grid;
  gap: 12px;
  padding: 24px 24px 22px;
}

.intro-eyebrow {
  margin: 0;
  font: 600 10px/1.1 "Pretendard", "Noto Sans KR", sans-serif;
  letter-spacing: 0.36px;
  text-transform: uppercase;
  color: rgba(243, 245, 255, 0.78);
}

.intro-content h1 {
  margin: 0;
  font: 700 30px/1.05 var(--title-font);
  letter-spacing: 0.2px;
  color: #fff;
}

.intro-desc {
  margin: 0;
  font: 600 14px/1.6 "Pretendard", "Noto Sans KR", sans-serif;
  color: rgba(243, 245, 255, 0.95);
}

.intro-link-line {
  margin: 0;
  font: 600 12px/1.5 "Pretendard", "Noto Sans KR", sans-serif;
  color: rgba(243, 245, 255, 0.82);
}

.intro-link-line a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.intro-license {
  border-top: 1px solid rgba(243, 245, 255, 0.33);
  padding-top: 12px;
}

.intro-license-title {
  margin: 0 0 6px;
  font: 700 12px/1.35 "Pretendard", "Noto Sans KR", sans-serif;
  color: rgba(255, 255, 255, 0.96);
}

.intro-license ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.intro-license li {
  font: 600 12px/1.5 "Pretendard", "Noto Sans KR", sans-serif;
  color: rgba(243, 245, 255, 0.87);
}

.intro-enter-button {
  justify-self: start;
  margin-top: 4px;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.intro-enter-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.control-panel {
  position: fixed;
  top: 56px;
  left: 18px;
  width: min(330px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: none;
  background: transparent;
  z-index: 3;
  transition: transform 240ms ease, opacity 180ms ease;
}

.control-panel.is-collapsed {
  transform: translateX(calc(-100% - 30px));
  opacity: 0;
  pointer-events: none;
}

.panel-toggle {
  position: fixed;
  left: 18px;
  top: 18px;
  z-index: 4;
  min-width: 76px;
}

.panel-blur {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(460px, 46vw);
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  backdrop-filter: blur(0px);
  -webkit-mask-image: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.94) 0%,
    rgba(0, 0, 0, 0.94) 40%,
    rgba(0, 0, 0, 0.48) 72%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-image: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.94) 0%,
    rgba(0, 0, 0, 0.94) 40%,
    rgba(0, 0, 0, 0.48) 72%,
    rgba(0, 0, 0, 0) 100%
  );
  transition: opacity 180ms ease, backdrop-filter 220ms ease;
}

.panel-blur::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(8, 10, 28, 0.18) 0%,
    rgba(8, 10, 28, 0.12) 34%,
    rgba(8, 10, 28, 0.06) 62%,
    rgba(8, 10, 28, 0) 100%
  );
}

body.panel-open .panel-blur {
  opacity: 0.82;
  backdrop-filter: blur(3px);
}

.control-group {
  display: grid;
  gap: 8px;
}

.control-group + .control-group {
  margin-top: 34px;
}

.group-title {
  margin: 0 0 2px;
  padding-top: 2px;
  font: 600 10px/1.2 "Pretendard", "Noto Sans KR", sans-serif;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: rgba(243, 245, 255, 0.88);
}

.control-panel label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: rgba(243, 245, 255, 0.84);
  line-height: 1.1;
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
}

.control-panel input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 10px;
  font: 700 22px/1.12 var(--title-font);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
  outline: none;
}

.control-panel input[type="text"]:focus {
  border-color: #fff;
}

.control-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 32px 8px 10px;
  font: 600 14px/1.2 "Pretendard", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background-color: rgba(255, 255, 255, 0.03);
  background-image: linear-gradient(
      45deg,
      transparent 50%,
      rgba(243, 245, 255, 0.92) 50%
    ),
    linear-gradient(135deg, rgba(243, 245, 255, 0.92) 50%, transparent 50%);
  background-position: calc(100% - 15px) 54%, calc(100% - 9px) 54%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.control-panel select:focus {
  border-color: #fff;
}

.control-panel input[type="range"] {
  width: 100%;
  margin: 2px 0 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  height: 16px;
}

.control-panel input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: rgba(243, 245, 255, 0.72);
}

.control-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 2px;
  height: 16px;
  background: #fff;
  border: none;
  border-radius: 0;
  margin-top: -8px;
}

.control-panel input[type="range"]::-moz-range-track {
  height: 1px;
  background: rgba(243, 245, 255, 0.72);
  border: none;
}

.control-panel input[type="range"]::-moz-range-thumb {
  width: 2px;
  height: 16px;
  background: #fff;
  border: none;
  border-radius: 0;
}

.control-panel input[type="color"] {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  cursor: pointer;
}

.control-panel input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.control-panel input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.row {
  display: flex;
  gap: 6px;
  padding-top: 4px;
}

.save-actions {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  z-index: 3;
  max-width: min(420px, calc(100vw - 36px));
}

button {
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 7px 10px;
  min-width: 86px;
  font: 600 11px/1.1 "Pretendard", "Noto Sans KR", sans-serif;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

button:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

button:active {
  background: rgba(255, 255, 255, 0.16);
}

button:disabled {
  opacity: 0.42;
  cursor: default;
  border-color: var(--line-weak);
  background: transparent;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-top: 0;
  color: rgba(243, 245, 255, 0.9);
}

.toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #fff;
}

.shape-title {
  margin: 6px 0 0;
  font: 600 10px/1.2 "Pretendard", "Noto Sans KR", sans-serif;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: rgba(243, 245, 255, 0.82);
}

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

.shape-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.22px;
  color: rgba(243, 245, 255, 0.9);
}

.shape-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #fff;
}

.status {
  margin: 40px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line-weak);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: rgba(243, 245, 255, 0.95);
  min-height: 1.2em;
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
}

.help {
  position: fixed;
  left: 18px;
  bottom: 18px;
  margin: 0;
  z-index: 3;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-left: none;
  border-bottom: none;
  background: transparent;
  color: rgba(243, 245, 255, 0.9);
  padding: 8px 10px 0 10px;
  font: 600 10px/1.3 "Pretendard", "Noto Sans KR", sans-serif;
  letter-spacing: 0.16px;
  text-transform: uppercase;
  max-width: min(360px, calc(100vw - 36px));
}

.mode-hint {
  position: fixed;
  left: 18px;
  bottom: 74px;
  margin: 0;
  z-index: 3;
  color: rgba(243, 245, 255, 0.96);
  font: 700 10px/1.15 "Pretendard", "Noto Sans KR", sans-serif;
  letter-spacing: 0.22px;
  text-transform: uppercase;
}

@media (max-width: 920px) {
  .intro-gate {
    padding: 12px;
  }

  .intro-card {
    width: min(720px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    grid-template-columns: 1fr;
  }

  .intro-image-wrap img {
    min-height: 220px;
    max-height: 38vh;
  }

  .intro-content {
    padding: 16px 14px 14px;
    gap: 10px;
  }

  .intro-content h1 {
    font-size: 24px;
  }

  .control-panel {
    top: 52px;
    bottom: auto;
    left: 12px;
    width: min(320px, calc(100vw - 24px));
    max-height: min(68vh, 620px);
    overflow: auto;
  }

  .panel-toggle {
    top: 12px;
    left: 12px;
  }

  .panel-blur {
    width: min(360px, 86vw);
  }

  .save-actions {
    top: auto;
    bottom: 12px;
    right: 12px;
  }

  .help,
  .mode-hint {
    display: none;
  }
}
