:root {
  --bg: #050607; --panel: rgba(8,12,16,0.88); --line: rgba(60,200,240,0.28); --line2: rgba(60,200,240,0.55);
  --cyan: #3CC8F0; --cyan2: #7FDDFB; --orange: #E66A1F; --text: #DCE3EA; --muted: #8A97A6; --white: #FFFFFF; --ok: #3CC8F0; --err: #FF7A6B;
  --mono: 'IBM Plex Mono', monospace; --sans: 'IBM Plex Sans KR', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background-color: var(--bg); background-image: linear-gradient(rgba(60,200,240,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(60,200,240,0.06) 1px, transparent 1px); background-size: 32px 32px; color: var(--text); font: 14px/1.5 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan2); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hide { display: none !important; }

.top { min-height: 56px; display: flex; align-items: center; gap: 8px 16px; padding: 8px 24px; border-bottom: 1px solid rgba(60,200,240,0.18); font: 12px var(--mono); flex-wrap: wrap; background: rgba(5,6,7,0.7); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; font-size: 14px; letter-spacing: 2px; color: var(--white); cursor: pointer; }
.brand b { color: var(--cyan); font-weight: 600; }
.top .grow { flex: 1; }
.top .pname { font: 600 14px var(--sans); color: var(--white); }

.btn { height: 36px; padding: 0 14px; border: 1px solid var(--line2); background: transparent; color: var(--cyan2); font: 500 12px var(--mono); letter-spacing: .5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn:hover { background: rgba(60,200,240,0.08); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #120803; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: rgba(138,151,166,0.4); color: var(--text); }
.btn.big { height: 48px; width: 100%; font-size: 13px; letter-spacing: 1px; }
.btn:disabled { opacity: .45; cursor: wait; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font: 500 11px var(--mono); color: var(--muted); letter-spacing: 1px; }
.input { height: 40px; padding: 0 12px; background: rgba(5,6,7,0.8); border: 1px solid var(--line); color: var(--white); outline: none; width: 100%; }
.input:focus { border-color: var(--cyan); }
.msg { min-height: 18px; font: 12px var(--mono); color: var(--err); }
.msg.ok { color: var(--cyan); }

.panel { border: 1px solid var(--line); background: var(--panel); padding: 18px; }
.kicker { font: 500 11px var(--mono); letter-spacing: 1.5px; color: var(--orange); }
.h1 { margin: 8px 0 6px; font: 700 20px var(--sans); color: var(--white); }
.p { margin: 0; font-size: 13px; color: #A9B4C0; line-height: 1.6; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth .panel { width: min(400px, 100%); padding: 32px; }
.auth .brand { font-size: 18px; margin-bottom: 22px; display: block; }

/* projects */
.wrap { padding: 28px 24px; max-width: 1400px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 18px; }
.card { border: 1px solid var(--line); background: var(--panel); cursor: pointer; display: flex; flex-direction: column; text-align: left; padding: 0; }
.card:hover { border-color: var(--cyan); }
.card .thumb { height: 150px; background: #0A0E12 center/cover no-repeat; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); font: 11px var(--mono); }
.card .meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.card .meta b { color: var(--white); font: 600 15px var(--sans); }
.card.new { border-style: dashed; align-items: center; justify-content: center; min-height: 230px; color: var(--cyan2); font: 500 13px var(--mono); gap: 8px; }
.card.new .plus { font-size: 34px; line-height: 1; }

/* studio */
.studio { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; padding: 16px 24px 24px; }
.stack { flex: 1 1 220px; max-width: 250px; display: flex; flex-direction: column; gap: 10px; }
.stack .list { flex: 1; display: flex; flex-direction: column-reverse; justify-content: flex-start; gap: 6px; }
.step { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 12px; cursor: pointer; background: transparent; border: 1px dashed rgba(138,151,166,0.4); text-align: left; }
.step .n { font: 600 12px var(--mono); color: var(--muted); }
.step .t { font-weight: 600; color: var(--muted); }
.step .s { font: 500 10px var(--mono); letter-spacing: 1px; color: var(--muted); }
.step.done { background: rgba(60,200,240,0.12); border: 1px solid var(--line2); }
.step.done .n, .step.done .s { color: var(--cyan); }
.step.done .t { color: var(--white); }
.step.cur { background: rgba(230,106,31,0.16); border: 1px solid var(--orange); box-shadow: 0 0 24px rgba(230,106,31,0.22); }
.step.cur .n, .step.cur .s { color: var(--orange); }
.step.cur .t { color: var(--white); }
.step.lock { cursor: not-allowed; opacity: .55; }

.stage { flex: 999 1 560px; min-width: 0; height: calc(100vh - 96px); min-height: 640px; display: flex; flex-direction: column; gap: 10px; }
.view { position: relative; flex: 1; min-height: 520px; border: 1px solid rgba(60,200,240,0.35); background: #0A0E12; overflow: hidden; }
.view iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.view .corner { position: absolute; width: 26px; height: 26px; border-color: var(--cyan); border-style: solid; border-width: 0; z-index: 2; pointer-events: none; }
.view .tl { left: 12px; top: 12px; border-left-width: 2px; border-top-width: 2px; }
.view .tr { right: 12px; top: 12px; border-right-width: 2px; border-top-width: 2px; }
.view .bl { left: 12px; bottom: 12px; border-left-width: 2px; border-bottom-width: 2px; }
.view .br { right: 12px; bottom: 12px; border-right-width: 2px; border-bottom-width: 2px; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; }
.empty .big { font: 600 13px var(--mono); letter-spacing: 2px; color: var(--cyan2); }
.film { display: flex; gap: 8px; overflow-x: auto; min-height: 20px; }
.film .f { flex: 0 0 140px; border: 1px solid var(--line); background: var(--panel); padding: 4px; font: 500 11px var(--mono); }
.film .f img, .film .f .ph { width: 100%; height: 66px; object-fit: cover; display: block; background: #0A0E12; }
.film .f div { display: flex; justify-content: space-between; padding: 5px 2px 0; gap: 6px; }

.side { flex: 1 1 300px; max-width: 360px; max-height: calc(100vh - 96px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.drop { display: block; border: 1px dashed var(--line2); background: rgba(5,6,7,0.6); padding: 18px; text-align: center; cursor: pointer; font: 12px var(--mono); color: var(--cyan2); }
.drop.over { background: rgba(60,200,240,0.1); border-color: var(--cyan); }
.drop .logo-prev { display: block; max-width: 100%; max-height: 90px; margin: 0 auto 10px; }
.drop small { display: block; color: var(--muted); margin-top: 4px; font-family: var(--sans); }
.rows { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 320px; overflow: auto; }
.row { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; font: 12px var(--mono); }
.row .input { height: 32px; font: 13px var(--sans); }
.row .x { width: 28px; height: 28px; border: 1px solid rgba(138,151,166,0.4); background: transparent; color: var(--muted); cursor: pointer; }
.row .sub { grid-column: 2 / 4; font-size: 11px; color: var(--muted); margin-top: -4px; }
.bar { height: 3px; background: rgba(60,200,240,0.18); margin: 10px 0 4px; }
.bar i { display: block; height: 100%; width: 0; background: var(--orange); transition: width .2s; }
.tag { font: 500 10px var(--mono); letter-spacing: 1px; }
.tag.ok { color: var(--cyan); } .tag.wait { color: var(--muted); } .tag.run { color: var(--orange); }
.queue li { margin: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { height: 28px; padding: 0 12px; border: 1px solid var(--line2); background: transparent; color: var(--text); font: 12px var(--sans); cursor: pointer; }
.chip.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.pmap { position: relative; overflow: hidden; border: 1px solid var(--line); background: #0A0E12; user-select: none; touch-action: none; cursor: grab; }
.pz { position: relative; transform-origin: 0 0; --k: 1; }
.pmap img { display: block; width: 100%; pointer-events: none; }
.pmap.aim { cursor: crosshair; outline: 2px solid var(--orange); }
.pm { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: #0c1014; border: 2px solid #fff; color: #fff; font: 600 10px var(--mono); display: flex; align-items: center; justify-content: center; cursor: move; box-shadow: 0 2px 6px rgba(0,0,0,.5); transform: scale(calc(1 / var(--k))); }
.pm.on { background: var(--orange); z-index: 2; }
.chk { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 12px; color: var(--muted); }
.aimrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.aimrow b { color: var(--cyan); }
.aimx { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; z-index: 3; pointer-events: none; border: 2px solid var(--orange); border-radius: 50%; }
.aimx:before, .aimx:after { content: ''; position: absolute; background: var(--orange); }
.aimx:before { left: 50%; top: -12px; bottom: -12px; width: 2px; margin-left: -1px; }
.aimx:after { top: 50%; left: -12px; right: -12px; height: 2px; margin-top: -1px; }

@media (max-width: 760px) {
  .stack { max-width: none; }
  .stack .list { flex-direction: row; flex-wrap: wrap; }
  .step { flex: 1 1 140px; }
  .side { max-width: none; }
  .stage, .side { height: auto; max-height: none; min-height: 0; }
  .view { flex: none; height: 62vh; min-height: 360px; }
  .top, .studio, .wrap { padding-left: 16px; padding-right: 16px; }
}
