* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: #111; color: #eee; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom));
}
main { max-width: 560px; margin: 0 auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }

.stage {
  position: relative;
  min-height: 150px; max-height: 34dvh;
  border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  background-color: #2a2a2a;
  background-image:
    linear-gradient(45deg, #333 25%, transparent 25%), linear-gradient(-45deg, #333 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #333 75%), linear-gradient(-45deg, transparent 75%, #333 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.stage canvas { max-width: 100%; max-height: calc(34dvh - 28px); width: auto; height: auto; display: block; }
.hint { position: absolute; margin: 0; color: #888; font-size: 14px; pointer-events: none; }

textarea {
  width: 100%; resize: none; border: 0; border-radius: 12px;
  background: #222; color: #fff; padding: 12px 14px;
  font: 17px/1.4 inherit; font-family: inherit;
}
textarea:focus { outline: 2px solid #555; }

.row { display: flex; align-items: center; gap: 10px; }
.row[hidden] { display: none; }
.label { flex: 0 0 44px; font-size: 13px; color: #999; }
.row input[type=range] { flex: 1; accent-color: #fff; }

.scroll { overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px; }
.scroll::-webkit-scrollbar { display: none; }
.font-chip {
  flex: 0 0 auto; border: 1.5px solid #333; background: #1c1c1c; color: #eee;
  border-radius: 12px; padding: 8px 14px; font-size: 20px; white-space: nowrap;
}
.font-chip small { display: block; font: 10px -apple-system, sans-serif; color: #888; margin-top: 2px; }
.font-chip.on { border-color: #fff; background: #2b2b2b; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid #444; padding: 0;
  position: relative; overflow: hidden;
}
.sw.on { outline: 2.5px solid #fff; outline-offset: 2px; }
.sw.custom { background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red); }
.sw.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; border: 0; padding: 0; }

.seg { display: flex; background: #222; border-radius: 10px; padding: 3px; flex: 1; }
.seg button {
  flex: 1; border: 0; background: none; color: #aaa; padding: 8px 0; border-radius: 8px; font-size: 14px;
}
.seg button.on { background: #444; color: #fff; }

footer {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, #111 30%);
  max-width: 560px; margin: 0 auto;
}
footer button {
  flex: 1; height: 50px; border-radius: 14px; border: 0; font-size: 17px; font-weight: 700;
  background: #2b2b2b; color: #fff;
}
footer button.primary { background: #fff; color: #111; }
footer button:active { transform: scale(0.98); }
button { font-family: inherit; cursor: pointer; }

.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px); opacity: 0; transition: .2s;
  background: #fff; color: #111; padding: 10px 16px; border-radius: 20px; font-size: 14px;
  pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
