:root {
  --workspace-width: 1240px;
  --page-gutter: 24px;
  --ink: #202020;
  --muted: #777;
  --line: #d8d8d4;
  --surface: #fff;
  --background: #efefec;
  --input-width: 360px;
  --canvas-size: clamp(340px, calc(100vh - 330px), 520px);
  --work-gap: 24px;
  --color-panel-width: 164px;
  --color-panel-gap: 16px;
  --tool-width: calc(var(--input-width) + var(--canvas-size) + var(--color-panel-width) + var(--work-gap) + var(--color-panel-gap));
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body.container {
  position: static !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  background:
    radial-gradient(circle at 8% 16%, rgba(221, 188, 127, 0.16), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(227, 104, 63, 0.09), transparent 25%),
    radial-gradient(circle at 78% 84%, rgba(25, 107, 102, 0.11), transparent 32%),
    radial-gradient(circle at 20% 88%, rgba(236, 222, 193, 0.4), transparent 34%),
    linear-gradient(135deg, #f7f4ec 0%, #f1eee5 48%, #edf2ed 100%);
  background-position:
    0% 0%,
    100% 0%,
    100% 100%,
    0% 100%,
    50% 50%;
  background-size:
    118% 118%,
    122% 122%,
    116% 116%,
    120% 120%,
    108% 108%;
  animation: background-drift 36s ease-in-out infinite alternate;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
textarea,
select {
  font: inherit;
}

.site-header--generator {
  display: block;
  position: relative;
  width: 100%;
  height: 84px;
  padding: 8px var(--page-gutter) 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  background:
    radial-gradient(circle at 18% -16%, rgba(230, 198, 137, 0.34), transparent 40%),
    radial-gradient(circle at 88% 118%, rgba(113, 181, 165, 0.27), transparent 42%),
    radial-gradient(circle at 63% -30%, rgba(235, 154, 118, 0.17), transparent 34%),
    linear-gradient(102deg, rgba(250, 246, 235, 0.82), rgba(232, 244, 238, 0.7));
  box-shadow: inset 0 -1px 0 rgba(32, 32, 32, 0.035);
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
}

.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(100%, var(--workspace-width));
  height: 100%;
  margin: 0 auto;
}

.site-header--generator .site-brand {
  grid-column: 2;
  justify-self: center;
}

.brand-wordmark {
  flex-direction: column;
  justify-content: center;
  line-height: 1;
}

.brand-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.brand-subtitle {
  margin-top: 6px;
  color: #777;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-header--generator .site-nav {
  grid-column: 3;
  justify-self: end;
  gap: 8px;
  white-space: nowrap;
}

.site-header--generator .site-nav a {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 14px rgba(35, 52, 48, 0.025);
  color: #3f4a47;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.01em;
  backdrop-filter: blur(9px) saturate(110%);
  -webkit-backdrop-filter: blur(9px) saturate(110%);
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.site-header--generator .site-nav a::after {
  display: none;
}

.site-header--generator .site-nav a:hover,
.site-header--generator .site-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 7px 18px rgba(35, 52, 48, 0.055);
  color: #26322f;
  transform: translateY(-1px);
}

.studio-shell {
  position: relative;
  width: min(calc(100% - (var(--page-gutter) * 2)), var(--workspace-width));
  margin: 8px auto 4px;
}

.style-section {
  position: relative;
  width: 100%;
  margin-right: auto;
  margin-bottom: 8px;
  padding-bottom: 58px;
  margin-left: auto;
}

.style-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.style-toolbar h1 {
  flex: 0 0 auto;
  margin: 0;
  padding: 7px 11px 6px;
  border: 1px solid rgba(111, 108, 98, 0.12);
  border-radius: 8px;
  background: rgba(221, 219, 210, 0.62);
  box-shadow:
    inset 0 2px 4px rgba(73, 69, 58, 0.12),
    inset 0 -1px 0 rgba(255, 255, 255, 0.66);
  color: #626159;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.style-tabs {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding-left: 8px;
  overflow-x: auto;
  border-bottom: 1px solid #d3d3d1;
  scrollbar-width: none;
}

.style-tooltip {
  position: relative;
  width: fit-content;
  margin: 0 0 8px 58px;
  padding: 8px 11px 8px 9px;
  border: 1px solid rgba(102, 132, 145, 0.32);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 5px 16px rgba(36, 50, 54, 0.04);
  color: #46565d;
  font-size: 10px;
  white-space: nowrap;
  backdrop-filter: blur(12px) saturate(108%);
  -webkit-backdrop-filter: blur(12px) saturate(108%);
  animation:
    tooltip-arrive 620ms cubic-bezier(.2,.9,.25,1.2) both,
    tooltip-float 3.8s ease-in-out 900ms infinite;
  transition: transform 160ms ease, background 160ms ease;
}

.style-tooltip::after {
  position: absolute;
  bottom: -6px;
  left: 22px;
  width: 11px;
  height: 11px;
  border-right: 1px solid rgba(102, 132, 145, 0.32);
  border-bottom: 1px solid rgba(102, 132, 145, 0.32);
  background: rgba(245, 249, 248, 0.42);
  content: "";
  transform: rotate(45deg);
}

.style-tooltip span {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border: 1px solid rgba(84, 105, 114, 0.28);
  border-radius: 50%;
  color: #586b73;
  font-size: 9px;
  vertical-align: -1px;
}

.style-tooltip:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-2px) scale(1.015);
}

.style-tooltip:hover::after {
  background: rgba(248, 251, 250, 0.58);
}

@keyframes tooltip-arrive {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tooltip-float {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-2px); }
  65% { transform: translateY(-1px); }
}

@keyframes background-drift {
  0% {
    background-position:
      0% 0%,
      100% 0%,
      100% 100%,
      0% 100%,
      50% 50%;
  }
  100% {
    background-position:
      4% 3%,
      96% 4%,
      97% 96%,
      3% 97%,
      52% 48%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.container,
  .style-tooltip,
  .canvas-empty::before,
  .canvas-empty::after,
  .canvas-empty span,
  .input-decoration::before,
  .input-decoration::after,
  .input-shell.is-cta-cued,
  .color-archive__cta::before,
  .color-archive__cta:hover,
  .color-archive__cta:focus-visible,
  .canvas-frame.is-revealing .result2,
  .style-menu-preview.is-switching .style-menu-preview__image,
  .style-menu-preview.is-switching .style-menu-preview__stage::after,
  .king-guide.is-reacting .king-character {
    animation: none;
  }

  .style-tab,
  .style-tab::after,
  .color-archive__cta,
  .color-archive__cta::before,
  .color-archive__cta span:last-child,
  .king-speech {
    transition-duration: 0.01ms;
  }

  .save-button:hover,
  .save-button:focus-visible {
    animation: none;
  }

  .color-archive__cta::before {
    animation: none;
    background-position: 50% 50%;
    filter: saturate(1.02);
    opacity: 0.78;
    transform: none;
  }
}

.style-tabs::-webkit-scrollbar,
.jamo-scroll::-webkit-scrollbar {
  display: none;
}

.style-tab {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 0 10px;
  border: 0;
  background: transparent;
  color: #8b8b8b;
  cursor: pointer;
  font-size: 13px;
  transition: color 180ms ease, transform 180ms ease;
  white-space: nowrap;
}

.style-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: var(--ink);
  content: "";
  opacity: 0;
  transform: scaleX(0.35);
  transform-origin: center;
  transition: opacity 220ms ease, transform 260ms cubic-bezier(.2,.8,.2,1);
}

.style-tab:hover,
.style-tab:focus-visible {
  color: #444;
  transform: translateY(-1px);
}

.style-tab[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
}

.style-tab[aria-selected="true"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.native-style-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
}

.style-menu-preview {
  position: absolute;
  bottom: 0;
  left: var(--preview-x, 0);
  display: grid;
  place-items: center;
  width: 96px;
  height: 50px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 8px 24px rgba(44, 51, 48, 0.025);
  backdrop-filter: blur(11px) saturate(108%);
  -webkit-backdrop-filter: blur(11px) saturate(108%);
  transition: left 240ms cubic-bezier(.2,.75,.25,1), background 180ms ease, box-shadow 180ms ease;
}

.style-menu-preview__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 3px;
}

.style-menu-preview__image {
  display: block;
  width: 100%;
  max-width: 90px;
  height: 100%;
  max-height: 44px;
  object-fit: contain;
  object-position: center;
}

.style-menu-preview.is-switching .style-menu-preview__image {
  animation: preview-arrive 300ms cubic-bezier(.2,.8,.25,1) both;
}

.style-menu-preview__stage::after {
  position: absolute;
  content: "";
  opacity: 0;
  pointer-events: none;
}

.style-menu-preview[data-style="0"].is-switching .style-menu-preview__stage::after {
  top: 18%;
  bottom: 18%;
  width: 24px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  animation: preview-band 420ms ease-out both;
}

.style-menu-preview[data-style="4"].is-switching .style-menu-preview__stage::after,
.style-menu-preview[data-style="5"].is-switching .style-menu-preview__stage::after {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(83, 144, 171, 0.28);
  border-radius: 50%;
  animation: preview-ripple 430ms ease-out both;
}

.style-menu-preview__image[hidden],
.style-menu-preview__fallback[hidden] {
  display: none !important;
}

.style-menu-preview__fallback {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid #606764;
  color: #343936;
  font-family: "Noto Serif KR", serif;
  font-size: 19px;
}

.studio-grid {
  display: grid;
  grid-template-columns: var(--input-width) var(--work-gap) var(--canvas-size) var(--color-panel-gap) var(--color-panel-width);
  align-items: stretch;
  width: min(100%, var(--tool-width));
  margin: 0 auto;
}

.studio-grid > .input-shell {
  grid-column: 1;
}

.creation-column {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.color-archive-column {
  grid-column: 5;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  height: var(--canvas-size);
}

.color-archive {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 14px 9px 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 10px 28px rgba(40, 48, 45, 0.035);
  backdrop-filter: blur(10px) saturate(108%);
  -webkit-backdrop-filter: blur(10px) saturate(108%);
}

.color-archive h2 {
  margin: 0 4px 8px;
  color: #4e5753;
  font-family: "Noto Serif KR", serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.color-archive__cta {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 32px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.32)) padding-box,
    linear-gradient(105deg, rgba(0, 130, 203, 0.58), rgba(145, 110, 147, 0.46), rgba(255, 189, 0, 0.52), rgba(242, 184, 202, 0.52), rgba(0, 130, 203, 0.58)) border-box;
  background-position: 0 0, 0% 50%;
  background-size: 100% 100%, 220% 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  color: #3f4945;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.015em;
  cursor: pointer;
  overflow: hidden;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  transition: color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.color-archive__cta::before {
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 7px;
  background: linear-gradient(
    118deg,
    rgba(105, 188, 210, 0.35) 0%,
    rgba(125, 201, 181, 0.31) 19%,
    rgba(255, 255, 255, 0.5) 34%,
    rgba(232, 196, 126, 0.34) 47%,
    rgba(232, 145, 127, 0.31) 66%,
    rgba(118, 195, 181, 0.33) 84%,
    rgba(105, 188, 210, 0.35) 100%
  );
  background-position: 0% 50%;
  background-size: 220% 170%;
  content: "";
  opacity: 0.78;
  filter: saturate(1.08) contrast(1.025);
  pointer-events: none;
  transform: translate3d(-1.5%, 0, 0) scale(1.025);
  transform-origin: center;
  animation: color-cta-fill-drift 10.5s ease-in-out infinite alternate;
  transition: filter 220ms ease, opacity 220ms ease;
  will-change: background-position, opacity, transform;
}

.color-archive__cta > span {
  position: relative;
  z-index: 1;
}

.color-archive__cta span:last-child {
  font-size: 14px;
  transition: transform 160ms ease;
}

.color-archive__cta:hover,
.color-archive__cta:focus-visible {
  background:
    linear-gradient(rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.25)) padding-box,
    linear-gradient(105deg, rgba(0, 130, 203, 0.76), rgba(145, 110, 147, 0.6), rgba(255, 189, 0, 0.7), rgba(242, 184, 202, 0.68), rgba(0, 130, 203, 0.76)) border-box;
  background-position: 0 0, 0% 50%;
  background-size: 100% 100%, 220% 100%;
  color: #222a27;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 5px 12px rgba(43, 59, 53, 0.055);
  outline: none;
  animation: color-cta-border-flow 520ms ease-out both;
  transform: translateY(-1px);
}

.color-archive__cta:hover::before,
.color-archive__cta:focus-visible::before {
  opacity: 0.9;
  animation-duration: 7.8s;
  filter: saturate(1.18) contrast(1.05);
}

.color-archive__cta:hover span:last-child,
.color-archive__cta:focus-visible span:last-child {
  transform: translateX(2px);
}

.color-archive__cta:active {
  transform: translateY(0);
}

@keyframes color-cta-border-flow {
  from { background-position: 0 0, 0% 50%; }
  to { background-position: 0 0, 100% 50%; }
}

@keyframes color-cta-fill-drift {
  0% {
    background-position: 0% 46%;
    opacity: 0.7;
    transform: translate3d(-1.5%, 0, 0) scale(1.025);
  }
  38% {
    background-position: 42% 54%;
    opacity: 0.86;
    transform: translate3d(0.4%, -0.35px, 0) scale(1.04);
  }
  68% {
    background-position: 72% 48%;
    opacity: 0.76;
    transform: translate3d(1.1%, 0.3px, 0) scale(1.03);
  }
  100% {
    background-position: 100% 55%;
    opacity: 0.84;
    transform: translate3d(1.6%, 0, 0) scale(1.025);
  }
}

.input-shell.is-cta-cued {
  animation: input-cta-cue 620ms ease-out both;
}

@keyframes input-cta-cue {
  0% {
    border-color: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 6px 22px rgba(0, 0, 0, 0.035);
  }
  42% {
    border-color: rgba(91, 155, 165, 0.48);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.98), 0 0 0 3px rgba(91, 155, 165, 0.075), 0 8px 24px rgba(0, 0, 0, 0.04);
  }
  100% {
    border-color: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 6px 22px rgba(0, 0, 0, 0.035);
  }
}

.color-archive__list {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1px 4px 14px 0;
  scrollbar-color: rgba(76, 89, 84, 0.28) transparent;
  scrollbar-width: thin;
  mask-image: linear-gradient(to bottom, transparent 0, #000 8px, #000 calc(100% - 12px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 8px, #000 calc(100% - 12px), transparent 100%);
}

.color-archive__list::-webkit-scrollbar {
  width: 5px;
}

.color-archive__list::-webkit-scrollbar-track {
  background: transparent;
}

.color-archive__list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(76, 89, 84, 0.22);
}

.color-swatch {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 7px 4px;
  border-radius: 8px;
  transition: background 160ms ease, transform 160ms ease;
}

.color-swatch + .color-swatch {
  margin-top: 3px;
}

.color-swatch:hover {
  background: rgba(255, 255, 255, 0.44);
  transform: translateX(1px);
}

.color-swatch__chip {
  display: block;
  width: 58px;
  height: 43px;
  border: 1px solid rgba(35, 39, 37, 0.09);
  border-radius: 7px;
  background: var(--swatch-color);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.color-swatch__text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.color-swatch__text strong {
  color: #242927;
  font-family: "Noto Serif KR", serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
}

.color-swatch__text span {
  overflow: hidden;
  color: #757d79;
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.03),
    0 12px 32px rgba(0, 0, 0, 0.045);
}

.canvas-measure {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  pointer-events: none;
}

#captureArea {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden;
  background: #fff;
  text-align: center;
}

.canvas-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #aaa;
  font-size: 12px;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.canvas-empty::before {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(86, 143, 166, 0.2);
  border-radius: 50%;
  content: "";
  animation: empty-ring-breathe 3.8s ease-in-out infinite;
  z-index: 1;
}

.canvas-empty::after {
  position: absolute;
  z-index: 0;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(117, 174, 186, 0.09) 0%, rgba(219, 174, 127, 0.045) 42%, transparent 70%);
  content: "";
  animation: empty-glow-breathe 5.6s ease-in-out infinite;
}

.canvas-empty span {
  position: relative;
  z-index: 1;
  transform: translateY(28px);
  animation: empty-copy-float 3.8s ease-in-out infinite;
}

#captureArea:has(.result2:not(:empty)) .canvas-empty {
  display: none;
}

.result2 {
  position: relative !important;
  z-index: 2;
  display: inline-block;
  max-width: 100%;
  height: auto !important;
  min-height: 1px;
  text-align: center;
}

.canvas-frame.is-generating .result2 {
  filter: blur(0.6px);
  opacity: 0.48;
  transition: filter 110ms ease, opacity 110ms ease;
}

.canvas-frame.is-revealing .result2 {
  animation: result-gather 460ms cubic-bezier(.2,.78,.25,1) both;
  transform-origin: center;
}

@keyframes result-gather {
  0% {
    filter: blur(0.8px);
    opacity: 0.28;
    transform: scale(0.985);
  }
  62% {
    filter: blur(0);
    opacity: 1;
    transform: scale(1.012);
  }
  100% {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes empty-ring-breathe {
  0%, 100% {
    opacity: 0.34;
    transform: scale(0.82);
  }
  50% {
    opacity: 0.76;
    transform: scale(1.08);
  }
}

@keyframes empty-copy-float {
  0%, 100% {
    opacity: 0.62;
    transform: translateY(28px);
  }
  50% {
    opacity: 0.9;
    transform: translateY(25px);
  }
}

@keyframes empty-glow-breathe {
  0%, 100% {
    opacity: 0.28;
    transform: scale(0.78);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.08);
  }
}

p.result {
  position: absolute !important;
  right: 10%;
  bottom: 18px !important;
  left: 10% !important;
  width: 80%;
  margin: 0;
  color: #b2b2b2;
  font-family: "Noto Serif KR", serif;
  font-size: 11px;
  text-align: center;
}

.input-shell {
  align-self: stretch;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  margin-top: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 6px 22px rgba(0, 0, 0, 0.035);
  backdrop-filter: blur(12px) saturate(112%);
  -webkit-backdrop-filter: blur(12px) saturate(112%);
}

.input-shell > label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.input-decoration {
  position: relative;
  width: 100%;
  height: 18px;
  overflow: hidden;
}

.input-decoration::before {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(76, 122, 123, 0.1), rgba(76, 122, 123, 0.38) 26%, rgba(201, 150, 104, 0.31) 63%, rgba(93, 145, 132, 0.2) 82%, rgba(76, 122, 123, 0.08));
  content: "";
  opacity: 0.82;
  transform-origin: center;
  animation: input-signal-pulse 5.6s ease-in-out infinite;
}

.input-decoration::after {
  position: absolute;
  top: 3px;
  left: 6%;
  width: 48%;
  height: 12px;
  background: linear-gradient(90deg, #628d94 0%, #77a59f 32%, #c48e69 61%, #78a6a0 82%, #628d94 100%);
  background-size: 180% 100%;
  clip-path: polygon(0 52%, 7% 52%, 11% 18%, 16% 83%, 21% 38%, 27% 63%, 34% 51%, 46% 51%, 51% 29%, 57% 73%, 62% 42%, 68% 59%, 76% 51%, 100% 51%);
  content: "";
  opacity: 0.46;
  transform-origin: center;
  animation: input-signal-rhythm 7.6s cubic-bezier(.42, 0, .32, 1) infinite;
}

@keyframes input-signal-pulse {
  0% {
    opacity: 0.64;
    transform: scaleX(0.985);
  }
  50% {
    opacity: 0.9;
    transform: scaleX(1);
  }
  100% {
    opacity: 0.64;
    transform: scaleX(0.985);
  }
}

@keyframes input-signal-rhythm {
  0% {
    background-position: 0% 50%;
    opacity: 0.3;
    transform: translate(-4%, 0) scale(0.88, 0.9);
  }
  18% {
    opacity: 0.48;
    transform: translate(14%, -0.7px) scale(0.94, 1.04);
  }
  37% {
    background-position: 44% 50%;
    opacity: 0.58;
    transform: translate(36%, 0.6px) scale(1, 0.96);
  }
  56% {
    opacity: 0.43;
    transform: translate(55%, -1px) scale(0.96, 1.08);
  }
  76% {
    background-position: 82% 50%;
    opacity: 0.55;
    transform: translate(77%, 0.5px) scale(0.92, 1.02);
  }
  100% {
    background-position: 100% 50%;
    opacity: 0.32;
    transform: translate(98%, 0) scale(0.86, 0.92);
  }
}

.input-content {
  align-self: center;
  width: 100%;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
}

textarea.input {
  --input-min-height: 58px;
  --input-max-height: 118px;
  --input-display-height: var(--input-min-height);
  position: static !important;
  width: 100% !important;
  height: var(--input-display-height) !important;
  min-height: var(--input-min-height);
  max-height: var(--input-max-height);
  padding: 8px 0 10px;
  border: 0;
  border-bottom: 1px solid #bcbcbc;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: "Noto Serif KR", serif;
  font-size: 24px !important;
  line-height: 1.38;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-break: break-all;
  white-space: pre-wrap;
  resize: none;
}

textarea.input:focus {
  border-color: var(--ink);
}

.input-guide {
  margin: 18px 0 0;
  color: #7a817d;
  font-size: 12px;
  line-height: 1.55;
  word-break: keep-all;
}

.result3 {
  position: static !important;
  width: auto !important;
  height: auto !important;
  margin: 0 0 8px !important;
  color: #333 !important;
  font-size: 13px !important;
  line-height: 1;
  white-space: nowrap;
}

.result3 div {
  position: static !important;
  display: inline !important;
  float: none !important;
  color: inherit !important;
}

@keyframes preview-arrive {
  from {
    opacity: 0.25;
    transform: translateY(4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes preview-band {
  from {
    left: 20%;
    opacity: 0;
  }
  35% {
    opacity: 0.8;
  }
  to {
    left: 76%;
    opacity: 0;
  }
}

@keyframes preview-ripple {
  from {
    opacity: 0.62;
    transform: scale(0.4);
  }
  to {
    opacity: 0;
    transform: scale(2.2);
  }
}
.save-button {
  display: block;
  align-self: end;
  width: 100%;
  min-height: 40px;
  padding: 8px 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(rgba(247, 246, 241, 0.84), rgba(247, 246, 241, 0.72)) padding-box,
    linear-gradient(105deg, rgba(93, 136, 151, 0.72), rgba(216, 162, 112, 0.66), rgba(115, 164, 143, 0.7), rgba(93, 136, 151, 0.72)) border-box;
  background-size: 100% 100%, 220% 100%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 7px 18px rgba(48, 51, 54, 0.055);
  color: #464b50;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  backdrop-filter: blur(9px) saturate(112%);
  -webkit-backdrop-filter: blur(9px) saturate(112%);
  transition: color 150ms ease, transform 180ms cubic-bezier(.2,.8,.2,1), box-shadow 150ms ease;
}

.save-button:hover,
.save-button:focus-visible {
  color: #303b38;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 10px 22px rgba(48, 51, 54, 0.09);
  transform: translateY(-1px);
  animation: save-border-flow 1.8s ease-in-out infinite;
}

.save-button:active {
  box-shadow: 0 3px 10px rgba(48, 51, 54, 0.06);
  transform: translateY(1px) scale(0.985);
}

@keyframes save-border-flow {
  from { background-position: 0 0, 0% 50%; }
  to { background-position: 0 0, 100% 50%; }
}

.jamo-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #d3d3d1;
}

.jamo-scroll {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.jamo-item {
  position: relative;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
}

.jamo-item button,
.jamo-item span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #d4d4d4;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  color: #444;
  font-size: 15px;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.jamo-item button {
  cursor: pointer;
}

.jamo-item button:hover {
  border-color: #777;
  background: #fff;
  transform: translateY(-1px);
}

.jamo-item span {
  z-index: 2;
  display: none;
  border-color: var(--jamo-color, #555);
  background: var(--jamo-color, #555);
  color: var(--jamo-contrast, #fff);
  line-height: 40px;
  text-align: center;
  pointer-events: none;
}

.king-guide {
  position: absolute;
  left: -76px;
  bottom: 54px;
  width: 62px;
}

.king-character {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.82;
}

.king-guide.is-reacting .king-character {
  animation: king-nod 480ms cubic-bezier(.2,.8,.3,1);
  transform-origin: 50% 90%;
}

.king-speech {
  position: absolute;
  bottom: 46px;
  left: 54px;
  z-index: 5;
  width: max-content;
  max-width: 190px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 7px 22px rgba(31, 37, 36, 0.08);
  color: #444;
  font-size: 11px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px) scale(0.98);
  transition: opacity 180ms ease, transform 220ms ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.king-speech::before {
  position: absolute;
  bottom: 9px;
  left: -5px;
  width: 9px;
  height: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.72);
  border-left: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.72);
  content: "";
  transform: rotate(45deg);
}

.king-speech.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@keyframes king-nod {
  0%, 100% { transform: rotate(0) translateY(0); }
  38% { transform: rotate(-2deg) translateY(-3px); }
  70% { transform: rotate(1deg) translateY(-1px); }
}

.site-footer {
  margin: 8px auto 0;
  color: rgba(54, 61, 58, 0.62);
  font-size: 11px;
  letter-spacing: 0.015em;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 1120px) {
  :root {
    --page-gutter: 20px;
    --input-width: 300px;
    --canvas-size: clamp(340px, calc(100vw - 604px), 520px);
    --work-gap: 20px;
    --color-panel-width: 150px;
    --color-panel-gap: 14px;
  }

  .king-guide {
    display: none;
  }
}

@media (max-width: 960px) and (min-width: 821px) {
  :root {
    --input-width: 260px;
    --canvas-size: 340px;
    --work-gap: 18px;
    --color-panel-width: 140px;
    --color-panel-gap: 12px;
  }
}

@media (max-width: 820px) and (min-width: 721px) {
  :root {
    --input-width: 220px;
    --canvas-size: 340px;
    --work-gap: 18px;
    --color-panel-width: 132px;
    --color-panel-gap: 12px;
  }

  .site-header--generator {
    height: 70px;
  }

  .studio-shell {
    margin-top: 12px;
  }

  .jamo-scroll {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .style-tooltip {
    margin-left: 0;
  }

  .style-tabs {
    justify-content: flex-start;
    gap: 22px;
  }

  .color-archive {
    padding-right: 7px;
    padding-left: 9px;
  }

  .color-swatch {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 7px;
    padding-right: 2px;
    padding-left: 2px;
  }

  .color-swatch__chip {
    width: 48px;
    height: 38px;
  }

}

@media (max-width: 720px) {
  :root {
    --canvas-size: min(100%, 330px);
    --tool-width: min(100%, 360px);
  }

  .site-header--generator {
    height: 70px;
  }

  .studio-grid {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .studio-grid > .input-shell,
  .creation-column,
  .color-archive-column {
    grid-column: 1;
  }

  .input-shell {
    grid-template-rows: auto auto auto;
    min-height: 0;
    padding: 10px 14px;
  }

  .input-shell > label {
    margin: -1px !important;
  }

  .input-decoration {
    height: 12px;
  }

  textarea.input {
    --input-min-height: 34px;
    --input-max-height: 88px;
    padding: 6px 0 7px;
    font-size: 18px !important;
    line-height: 1.38;
  }

  .input-guide {
    display: none;
  }

  .input-content {
    align-self: auto;
  }

  .save-button {
    width: min(100%, 210px);
    margin: 8px auto 0;
  }

  .creation-column {
    grid-row: 2;
  }

  .color-archive-column {
    grid-row: 3;
    width: var(--canvas-size);
    height: 240px;
    margin: 0 auto;
    gap: 12px;
  }

  .color-archive {
    padding: 12px 9px 8px 12px;
  }

  .color-archive__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    column-gap: 8px;
  }

  .color-swatch,
  .color-swatch + .color-swatch {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 7px;
    margin-top: 0;
    padding: 5px 3px;
  }

  .color-swatch__chip {
    width: 44px;
    height: 34px;
  }

  .canvas-frame {
    width: var(--canvas-size);
    margin: 0 auto;
  }

  .jamo-scroll {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .style-tooltip {
    margin-left: 0;
  }

  .style-tabs {
    justify-content: flex-start;
    gap: 22px;
    padding-right: 104px;
  }
}

@media (max-width: 560px) {
  :root {
    --page-gutter: 16px;
  }

  .site-header--generator {
    height: 70px;
    padding: 6px 16px 3px;
  }

  .site-header__inner {
    grid-template-columns: 1fr auto;
  }

  .site-header--generator .site-brand {
    grid-column: 1;
    justify-self: start;
  }

  .brand-title {
    font-size: 23px;
  }

  .brand-subtitle {
    display: none;
  }

  .site-header--generator .site-nav {
    grid-column: 2;
    gap: 6px;
  }

  .site-header--generator .site-nav a {
    padding: 6px 8px;
    font-size: 12px;
  }

  .studio-shell {
    width: calc(100% - 32px);
    margin-top: 12px;
  }

  .style-toolbar {
    gap: 14px;
  }

  .canvas-frame {
    width: 100%;
    border-radius: 8px;
  }

  .input-shell {
    padding: 10px 14px;
    border-radius: 8px;
  }

  .style-menu-preview {
    left: var(--preview-x, 0);
    width: 96px;
    height: 50px;
    border-radius: 9px;
  }

  .style-menu-preview__stage {
    padding: 3px;
  }

  .style-menu-preview__image {
    max-width: 90px;
    max-height: 42px;
  }

  .jamo-section {
    margin-top: 14px;
  }

  .jamo-item,
  .jamo-item button,
  .jamo-item span {
    width: 40px;
    height: 40px;
  }

  .jamo-item {
    flex-basis: 40px;
  }

  .site-footer {
    margin-top: 14px;
    font-size: 10px;
  }
}
