:root {
  --bg: #ffffff;
  --tile: #f5f5f7;
  --tile2: #ededf0;
  --ink: #1d1d1f;
  --ink2: #6e6e73;
  --ink3: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --blue: #0071e3;
  --radius: 20px;
  --font: "Helvetica Neue", Helvetica, Arial, "Pretendard Variable", sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; letter-spacing: -0.005em; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--ink2); }
.grow { flex: 1; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: rgba(255, 255, 255, 0.8); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid transparent; transition: border-color 0.3s; }
.top.scrolled { border-color: var(--line); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 18px; letter-spacing: -0.03em; }
.logo svg { width: 30px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linejoin: round; }
.topnav { display: flex; align-items: center; gap: 22px; font-size: 13px; }
.topnav a { color: var(--ink2); transition: color 0.2s; }
.topnav a:hover, .topnav a.on { color: var(--ink); }
.conn { display: flex; align-items: center; gap: 7px; border: 0; background: var(--ink); color: #fff; border-radius: 99px; padding: 7px 15px; font-size: 13px; font-weight: 500; }
.conn i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.45); }
.conn.on { background: var(--tile); color: var(--ink); }
.conn.on i { background: #30d158; }

/* ---------- hero ---------- */
.hero { padding: 96px 28px 56px; max-width: 1180px; margin: 0 auto; text-align: center; }
.hero .eyebrow { font-size: 14px; font-weight: 500; color: var(--ink2); margin: 0 0 14px; }
.hero h1 { font-size: clamp(40px, 6.6vw, 84px); line-height: 1.04; letter-spacing: -0.03em; margin: 0; font-weight: 700; }
.hero h1 span { color: var(--ink3); }
.hero .lede { margin: 22px auto 0; max-width: 560px; color: var(--ink2); font-size: 19px; line-height: 1.45; letter-spacing: -0.015em; word-break: keep-all; text-wrap: balance; }
.hero h1, .dlg p, .ai .need { word-break: keep-all; }

.prompt { display: flex; gap: 6px; align-items: center; background: var(--tile); border-radius: 99px; padding: 6px 6px 6px 22px; margin: 36px auto 0; max-width: 640px; transition: box-shadow 0.25s var(--ease), background 0.25s; }
.prompt:focus-within { background: #fff; box-shadow: 0 0 0 1px var(--line), 0 12px 40px -12px rgba(0, 0, 0, 0.18); }
.prompt input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 15px; }
.prompt input::placeholder { color: var(--ink3); }
.btn { border: 0; border-radius: 99px; padding: 11px 20px; font-weight: 500; font-size: 14px; background: var(--ink); color: #fff; white-space: nowrap; transition: opacity 0.2s, transform 0.2s var(--ease); }
.btn:hover { opacity: 0.86; }
.btn:active { transform: scale(0.98); }
.btn.soft { background: var(--tile2); color: var(--ink); }
.btn.blue { background: var(--blue); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px; border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn.soft.busy::after { border-color: var(--ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.count { margin-top: 18px; font-size: 13px; color: var(--ink3); }

/* ---------- category chips ---------- */
.chips { position: sticky; top: 52px; z-index: 10; display: flex; justify-content: center; gap: 6px; padding: 14px 28px; overflow-x: auto; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 0; background: var(--tile); border-radius: 99px; padding: 8px 15px; font-size: 13px; font-weight: 500; color: var(--ink); transition: background 0.2s, color 0.2s; }
.chip:hover { background: var(--tile2); }
.chip sup { font-size: 10px; margin-left: 4px; color: var(--ink3); vertical-align: 3px; }
.chip.on { background: var(--ink); color: #fff; }
.chip.on sup { color: rgba(255, 255, 255, 0.55); }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 40px 22px; padding: 22px 28px 120px; max-width: 1480px; margin: 0 auto; }
.tcard { display: block; }
.tcard .thumb { position: relative; aspect-ratio: 5 / 4; border-radius: var(--radius); background: var(--tile); overflow: hidden; display: grid; place-items: center; }
.tcard canvas { display: block; max-width: 84%; max-height: 84%; border-radius: 8px; transition: transform 0.6s var(--ease); }
.tcard:hover canvas { transform: scale(1.025); }
.tcard .badge { position: absolute; left: 14px; top: 14px; font-size: 11px; font-weight: 500; color: var(--ink2); background: rgba(255, 255, 255, 0.9); border-radius: 99px; padding: 4px 9px; }
.tcard .play { display: none; }
.tcard .meta { padding: 14px 4px 0; }
.tcard .meta b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
.tcard .meta span { display: block; margin-top: 3px; font-size: 13px; color: var(--ink3); }
.empty { padding: 60px 28px; color: var(--ink2); }

/* ---------- editor ---------- */
.editor { display: grid; grid-template-columns: 1fr 360px; height: calc(100vh - 52px); }
.stagewrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0 0 0 24px; }
.stagebar { display: flex; align-items: baseline; gap: 12px; padding: 18px 0 14px; }
.stagebar a { font-size: 13px; color: var(--blue); }
.stagebar h2 { margin: 0 0 0 6px; font-size: 21px; font-weight: 600; letter-spacing: -0.025em; }
.stagebar .cat { font-size: 13px; color: var(--ink3); }
.stage { flex: 1; min-height: 0; display: grid; place-items: center; background: var(--tile); border-radius: 24px; padding: 20px; }
.stage canvas { display: block; border-radius: 6px; box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.35); }
.transport { display: flex; align-items: center; gap: 16px; padding: 16px 4px 22px; }
.transport .pp { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--ink); display: grid; place-items: center; flex: none; }
.transport .pp::after { content: ""; border-left: 10px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 3px; }
.transport .pp.playing::after { border: 0; width: 10px; height: 11px; margin: 0; background: linear-gradient(90deg, #fff 0 33%, transparent 33% 67%, #fff 67%); }
.transport .time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ink3); width: 86px; text-align: right; }
.transport .snd { border: 0; background: var(--tile); border-radius: 99px; padding: 8px 14px; font-size: 12px; font-weight: 500; }
.transport .snd.on { background: var(--ink); color: #fff; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; outline: none; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(var(--ink), var(--ink)) 0 / var(--fill, 0%) 100% no-repeat, #e3e3e8; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #fff; box-shadow: 0 0.5px 4px rgba(0, 0, 0, 0.25), 0 0 0 0.5px rgba(0, 0, 0, 0.06); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: #e3e3e8; }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--ink); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0.5px 4px rgba(0, 0, 0, 0.25); }
.scrub { flex: 1; }

.panel { overflow-y: auto; padding: 10px 24px 40px; }
.sec { padding: 20px 0; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec h4 { margin: 0 0 12px; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; display: flex; justify-content: space-between; align-items: baseline; }
.sec h4 span + span { font-size: 12px; font-weight: 400; color: var(--ink3); }
.field { display: grid; grid-template-columns: 76px 1fr 34px; align-items: center; gap: 12px; margin: 8px 0; font-size: 13px; color: var(--ink2); }
.field.wide { grid-template-columns: 76px 1fr; }
.field output { font-size: 12px; color: var(--ink3); text-align: right; font-variant-numeric: tabular-nums; }
.field input[type="text"], .ta { width: 100%; border: 0; border-radius: 10px; padding: 9px 12px; font-size: 13px; background: var(--tile); color: var(--ink); outline: none; transition: box-shadow 0.2s, background 0.2s; }
.field input[type="text"]:focus, .ta:focus { background: #fff; box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.25), 0 0 0 1px var(--blue); }
.seg { display: flex; background: #efeff2; border-radius: 9px; padding: 2px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 7px; padding: 6px 4px; font-size: 12px; font-weight: 500; color: var(--ink); transition: background 0.2s; }
.seg button.on { background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.swatches { display: flex; gap: 14px; flex-wrap: wrap; }
.sw { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink2); }
.sw input[type="color"] { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border: 0; border-radius: 50%; padding: 0; background: none; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.sw input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.sw input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.slot { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--tile) center / cover no-repeat; display: grid; place-items: center; font-size: 12px; color: var(--ink3); cursor: pointer; transition: background-color 0.2s; }
.slot:hover { background-color: var(--tile2); }
.slot .x { position: absolute; right: 5px; top: 5px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 11px; line-height: 18px; padding: 0; display: none; }
.slot.has .x { display: block; }
.slot input { display: none; }

.ai .box { background: var(--tile); border-radius: 16px; padding: 12px; }
.ai .ta { background: #fff; min-height: 70px; resize: vertical; line-height: 1.45; }
.ai .row { display: flex; gap: 8px; margin-top: 10px; }
.ai .row .btn { padding: 9px 16px; font-size: 13px; }
.ai .note { font-size: 12px; color: var(--ink2); margin: 10px 2px 0; min-height: 1em; line-height: 1.4; }
.ai .hints { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ai .hints button { border: 0; background: var(--tile); color: var(--ink); border-radius: 99px; padding: 6px 11px; font-size: 12px; transition: background 0.2s; }
.ai .hints button:hover { background: var(--tile2); }
.ai .need { font-size: 13px; color: var(--ink2); line-height: 1.5; margin: 0; }
.ai .need button { background: none; border: 0; color: var(--blue); padding: 0; font-weight: 500; }
.export .row { display: flex; gap: 8px; margin-top: 14px; }
.export .btn { flex: 1; padding: 12px 20px; }
.prog { height: 3px; background: var(--tile2); border-radius: 3px; overflow: hidden; margin-top: 12px; display: none; }
.prog.on { display: block; }
.prog i { display: block; height: 100%; width: 0; background: var(--blue); transition: width 0.15s; }

/* ---------- dialog ---------- */
.dlg { border: 0; border-radius: 22px; padding: 0; width: min(420px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.35); }
.dlg::backdrop { background: rgba(0, 0, 0, 0.25); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dlg form { padding: 28px; }
.dlg h3 { margin: 0 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -0.025em; }
.dlg p { font-size: 14px; line-height: 1.5; margin: 0 0 20px; }
.dlg label { display: grid; gap: 6px; font-size: 12px; font-weight: 500; color: var(--ink2); margin-bottom: 12px; }
.dlg input { border: 0; background: var(--tile); border-radius: 12px; padding: 12px 14px; font-size: 15px; outline: none; transition: box-shadow 0.2s, background 0.2s; }
.dlg input:focus { background: #fff; box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.25), 0 0 0 1px var(--blue); }
.dlg .row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.dlg .ghost { border: 0; background: none; padding: 10px 12px; font-size: 14px; color: var(--blue); }
.dlg .solid { border: 0; background: var(--ink); color: #fff; border-radius: 99px; padding: 10px 20px; font-weight: 500; font-size: 14px; }
.err { color: #e30000; font-size: 12px; min-height: 1em; margin: 0 0 4px !important; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); background: rgba(29, 29, 31, 0.92); backdrop-filter: blur(20px); color: #fff; padding: 12px 18px; border-radius: 99px; font-size: 13px; opacity: 0; pointer-events: none; transition: 0.35s var(--ease); z-index: 50; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .top { padding: 0 16px; }
  .topnav a { display: none; }
  .hero { padding: 56px 16px 32px; }
  .hero .lede { font-size: 17px; }
  .chips { justify-content: flex-start; padding: 12px 16px; }
  .grid { padding: 16px 16px 80px; gap: 30px 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .editor { grid-template-columns: 1fr; height: auto; }
  .stagewrap { padding: 0 16px; }
  .stage { height: 60vh; }
  .panel { padding: 0 16px 40px; }
}
.tcard .thumb.seamless canvas { border-radius: 0; }

/* ---------- bottom dock (same language as the portfolio site) ---------- */
.dock { position: fixed; left: 50%; bottom: 18px; z-index: 40; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(18, 18, 18, 0.12); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08); }
.dock a { position: relative; z-index: 1; padding: 0.62em 1.15em; font-size: 13px; border-radius: 999px; color: #6c6b66; transition: color 0.35s; white-space: nowrap; }
.dock a:hover { color: #121212; }
.dock a.on { color: #fbfbfb; }
.dock__ind { position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; background: #121212; transition: transform 0.6s cubic-bezier(0.2, 0.7, 0, 1), width 0.6s cubic-bezier(0.2, 0.7, 0, 1); }
.editor { height: calc(100vh - 52px - 76px); }
.grid { padding-bottom: 140px; }
.stage canvas.corners { cursor: grab; touch-action: none; }
@media (max-width: 900px) {
  .dock { width: calc(100% - 16px); bottom: 12px; gap: 0; }
  .dock a { flex: 1 1 auto; padding: 8px 7px; font-size: 12.5px; text-align: center; }
  .editor { height: auto; padding-bottom: 90px; }
}
/* gradient presets */
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.presets button { border: 0; background: none; padding: 0; text-align: left; font-size: 11px; color: var(--ink2); }
.presets i { display: block; aspect-ratio: 4 / 5; border-radius: 10px; background: center / cover; box-shadow: 0 0 0 1px var(--line); margin-bottom: 5px; transition: box-shadow 0.2s; }
.presets button.on i { box-shadow: 0 0 0 2px var(--ink); }
.presets button.on span { color: var(--ink); }

.sec h4 .link { color: var(--blue); cursor: pointer; font-size: 12px; font-weight: 500; }
.field select { width: 100%; border: 0; border-radius: 10px; padding: 9px 12px; font-size: 13px; background: var(--tile); color: var(--ink); outline: none; }
.stopbar { position: relative; height: 26px; border-radius: 8px; margin: 8px 0 4px; box-shadow: inset 0 0 0 1px var(--line); }
.stopbar .stop { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); cursor: ew-resize; touch-action: none; }
.stopbar .stop.sel { border-color: #3b82f6; }
.sw.sel input[type="color"] { box-shadow: 0 0 0 2px #3b82f6; }
.chipbtn { border: 0; background: var(--tile); border-radius: 99px; padding: 6px 11px; font-size: 12px; color: var(--ink); }
.chipbtn:hover { background: var(--tile2); }
.hint { font-size: 12px; color: var(--ink3); margin: 6px 0 0; }
#gcv { touch-action: none; }

/* ---------- family gate (glass) ---------- */
html.gated, html.gated body { overflow: hidden; }
.gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity 0.45s var(--ease); background: rgba(250, 250, 251, 0.18); backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }
.gate.on { opacity: 1; pointer-events: auto; backdrop-filter: blur(26px) saturate(140%); -webkit-backdrop-filter: blur(26px) saturate(140%); }
.gate.out { opacity: 0; pointer-events: none; }
.gate-card { width: min(420px, 100%); padding: 34px 30px 26px; border-radius: 28px; text-align: center; background: linear-gradient(160deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.38)); border: 1px solid rgba(255, 255, 255, 0.85); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.9); backdrop-filter: blur(30px) saturate(160%); -webkit-backdrop-filter: blur(30px) saturate(160%); transform: translateY(10px) scale(0.98); transition: transform 0.5s var(--ease); }
.gate.on .gate-card { transform: none; }
.gate-eyebrow { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.02em; color: var(--ink3); }
.gate-card h2 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.03em; }
.gate-lede { margin: 8px 0 22px; font-size: 14px; color: var(--ink2); }
.gate-field { display: flex; gap: 8px; padding: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.55); border: 1px solid rgba(255, 255, 255, 0.9); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06); }
.gate-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 0 14px; font-size: 15px; }
.gate-btn { border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 99px; padding: 11px 18px; font-size: 14px; font-weight: 500; color: #fff; background: linear-gradient(180deg, rgba(40, 40, 44, 0.82), rgba(10, 10, 12, 0.92)); box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform 0.2s var(--ease), opacity 0.2s; }
.gate-btn:hover { opacity: 0.9; }
.gate-btn:active { transform: scale(0.97); }
.gate-err { min-height: 18px; margin: 12px 0 0; font-size: 12px; color: #d23b2c; }
.shake { animation: shake 0.42s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
