:root {
  --bg: #0b0e13; --bg2: #121722; --panel: #151b27; --card: #1a2231;
  --line: #27314455; --line2: #2c3850;
  --txt: #eef2f8; --mut: #8d9bb2; --acc: #f5c518; --acc-ink: #171204;
  --ok: #3ddc68; --err: #ff6b6b;
  --r: 10px;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--txt);
  font: 14.5px/1.5 "Inter", -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }

/* ---------- header ---------- */
header { display: flex; justify-content: space-between; align-items: center;
  height: 54px; padding: 0 22px; border-bottom: 1px solid var(--line2);
  background: linear-gradient(180deg, #161d2b, #10151f); }
.logo { font-family: "Anton", "Inter", sans-serif; font-size: 21px;
  letter-spacing: .8px; font-weight: 400; }
.logo span { color: var(--acc); }
.logo small { font-family: "Inter"; color: var(--mut); font-weight: 500;
  font-size: 11px; margin-left: 10px; letter-spacing: .4px; }
.tag { color: var(--mut); font-size: 12.5px; letter-spacing: .3px; }

/* ---------- layout ---------- */
#studio { display: flex; height: calc(100vh - 54px); }
#panel { width: 344px; min-width: 344px; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line2); }
#panel-body { flex: 1; overflow-y: auto; padding: 14px 14px 6px;
  scrollbar-width: thin; scrollbar-color: #2c3850 transparent; }
#panel-foot { padding: 12px 14px 14px; border-top: 1px solid var(--line2);
  background: linear-gradient(180deg, #141a26, #11161f);
  box-shadow: 0 -8px 20px #0007; }

/* ---------- sections ---------- */
.sect { background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 13px 14px 14px; margin-bottom: 12px; }
.sect-h { font-size: 11px; font-weight: 800; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--acc); margin-bottom: 10px; }
label { display: block; color: var(--mut); font-size: 11.5px; font-weight: 600;
  margin: 11px 0 5px; text-transform: uppercase; letter-spacing: .7px; }
label b { color: var(--txt); font-weight: 700; text-transform: none;
  letter-spacing: 0; float: right; font-size: 12px; }
.muted { color: var(--mut); text-transform: none; letter-spacing: 0; font-weight: 500; }
.hinttext { color: var(--mut); font-size: 12px; line-height: 1.55; margin-top: 9px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- inputs ---------- */
input[type=text], select {
  width: 100%; background: var(--bg2); color: var(--txt);
  border: 1px solid var(--line2); border-radius: var(--r);
  padding: 9px 11px; font-size: 14.5px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s; }
input[type=text]:focus, select:focus { outline: none; border-color: var(--acc);
  box-shadow: 0 0 0 3px #f5c51822; }
select { appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' stroke='%238d9bb2' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; }

input[type=range] { -webkit-appearance: none; width: 100%; height: 22px;
  background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 5px;
  border-radius: 3px; background: #2a3449; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%; margin-top: -5.5px;
  background: var(--acc); border: 2.5px solid #0b0e13;
  box-shadow: 0 0 0 1.5px var(--acc), 0 2px 6px #0008; }

input[type=color] { width: 100%; height: 34px; border: 1px solid var(--line2);
  border-radius: var(--r); background: var(--bg2); padding: 3px; cursor: pointer; }
input[type=file] { width: 100%; color: var(--mut); font-size: 12.5px; }

/* ---------- buttons ---------- */
.addrow { display: flex; gap: 9px; }
.add { flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 7px; background: #f5c5180e; border: 1.4px dashed #f5c51866;
  color: var(--acc); font-weight: 700; font-size: 13.5px; padding: 10px;
  border-radius: var(--r); cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s; }
.add:hover { background: #f5c51820; border-color: var(--acc); }
.ai { font-family: "Anton"; font-size: 15px; }
.mini { flex: 1; background: var(--bg2); border: 1px solid var(--line2);
  color: var(--txt); padding: 8px 10px; border-radius: 9px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; font-family: inherit; margin-top: 10px;
  transition: border-color .15s, background .15s; }
.mini:hover { border-color: var(--acc); background: #f5c51810; }
.mini.danger { color: var(--err); }
.mini.danger:hover { border-color: var(--err); background: #ff6b6b12; }

.cta { display: block; width: 100%; border: none; padding: 13px;
  border-radius: 12px; font-size: 15.5px; font-weight: 800; cursor: pointer;
  text-align: center; text-decoration: none; font-family: inherit;
  background: linear-gradient(180deg, #ffd64a, #f0ba0e); color: var(--acc-ink);
  box-shadow: 0 3px 14px #f5c51833, inset 0 1px 0 #fff5;
  transition: transform .1s, box-shadow .15s; }
.cta:hover { transform: translateY(-1px); box-shadow: 0 6px 20px #f5c51845, inset 0 1px 0 #fff5; }
.cta:disabled { opacity: .55; cursor: wait; transform: none; }
.cta.dl { background: linear-gradient(180deg, #52e87d, #2fc75b); color: #06230f;
  box-shadow: 0 3px 14px #3ddc6833; margin: 10px 0; }

/* ---------- object list ---------- */
#objlist { margin-top: 10px; }
.obj { display: flex; align-items: center; gap: 9px; padding: 7px 10px;
  border: 1px solid var(--line2); border-radius: 9px; margin-top: 6px;
  cursor: pointer; font-size: 13px; font-weight: 500; background: var(--bg2);
  transition: border-color .12s, background .12s; }
.obj:hover { border-color: #3d4c6b; }
.obj.sel { border-color: var(--acc); background: #f5c5180d;
  box-shadow: 0 0 0 1px #f5c51833; }
.obj .oicon { color: var(--acc); font-family: "Anton"; font-size: 13px;
  width: 20px; height: 20px; display: flex; align-items: center;
  justify-content: center; background: #f5c51815; border-radius: 6px; }
.obj .oname { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- border rows ---------- */
.brow { display: grid; grid-template-columns: 40px 1fr 56px 22px; gap: 8px;
  align-items: center; margin-top: 7px; font-size: 12px; color: var(--mut); }
.brow input[type=color] { height: 27px; padding: 2px; }
.brow input[type=number] { background: var(--bg2); color: var(--txt);
  border: 1px solid var(--line2); border-radius: 8px; padding: 5px 7px;
  width: 100%; font-size: 12.5px; font-family: inherit; }
.brow .bx { background: none; border: none; color: var(--mut); cursor: pointer;
  font-size: 15px; transition: color .12s; }
.brow .bx:hover { color: var(--err); }

/* ---------- font list ---------- */
#fontsearch { width: 100%; background: var(--bg2); color: var(--txt);
  border: 1px solid var(--acc); border-radius: var(--r); padding: 8px 11px;
  font-size: 13.5px; font-family: inherit; }
#fontlist { max-height: 200px; overflow-y: auto; border: 1px solid var(--line2);
  border-radius: var(--r); margin-top: 6px; background: var(--bg2); }
.frow { display: flex; justify-content: space-between; align-items: center;
  padding: 8px 11px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--line); }
.frow:last-child { border-bottom: none; }
.frow:hover { background: #f5c51812; }
.frow small { color: var(--mut); }

/* ---------- status / result ---------- */
#status { color: var(--mut); font-size: 12.5px; min-height: 18px;
  margin-bottom: 8px; }
#status.err { color: var(--err); }
.stat { color: var(--mut); font-size: 12.5px; margin-bottom: 4px; }
.stat span { color: var(--txt); font-weight: 600; }
#filaments { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 4px; }
.fil { display: flex; align-items: center; gap: 7px; background: var(--bg2);
  border: 1px solid var(--line2); border-radius: 9px; padding: 5px 9px;
  font-size: 12px; font-weight: 600; cursor: pointer; }
.fil:hover { border-color: var(--acc); }
.fil input[type=color] { width: 24px; height: 21px; padding: 0;
  border-radius: 6px; border: none; }

/* ---------- stage ---------- */
#stage { flex: 1; position: relative; display: flex; flex-direction: column;
  background:
    radial-gradient(1100px 500px at 50% 12%, #1b2434cc 0%, transparent 70%),
    var(--bg); }
#viewtabs { position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 5; display: flex; gap: 3px; background: #10151fd9;
  backdrop-filter: blur(8px); border: 1px solid var(--line2);
  border-radius: 12px; padding: 4px; box-shadow: 0 6px 24px #0008; }
.vt { background: none; border: none; color: var(--mut); font-weight: 700;
  font-size: 13px; font-family: inherit; padding: 7px 18px; border-radius: 9px;
  cursor: pointer; transition: color .12s; }
.vt:hover { color: var(--txt); }
.vt.on { background: var(--acc); color: var(--acc-ink); }

#edit2d, #editback, #viewport { flex: 1; position: relative; }
#edit2d, #editback {
  background-image: radial-gradient(#2a344933 1.1px, transparent 1.1px);
  background-size: 26px 26px; background-position: center; }
#edit2d svg, #editback svg { width: 100%; height: 100%; display: block;
  touch-action: none; }
#viewport canvas { display: block; }
#hint, #hint2d { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: var(--mut); font-size: 16.5px;
  pointer-events: none; letter-spacing: .2px; }
.spin { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; backdrop-filter: blur(3px); background: #0b0e1366;
  color: var(--acc); font-size: 17px; font-weight: 800; letter-spacing: .5px; }

/* canvas art */
#g-logo:hover, #g-art:hover { filter: drop-shadow(0 0 6px #f5c51866); }
.cobj { cursor: grab; }
.selbox { fill: none; stroke: #4da3ff; stroke-width: 1.4; stroke-dasharray: 6 4;
  pointer-events: none; }
.handlebox { fill: #ffffff; stroke: #4da3ff; stroke-width: 1.2; cursor: nwse-resize; }
.rotzone { fill: transparent; cursor: alias; }
.backart { fill: #242e41; }
.hw { fill: #f5c51822; stroke: var(--acc); stroke-width: 1.6; cursor: grab; }
.hw:hover { fill: #f5c51844; }
.hwlabel { fill: var(--acc); font-size: 9px; font-weight: 700;
  text-anchor: middle; pointer-events: none; font-family: "Inter", sans-serif; }
.backtag { fill: #8d9bb2; font-size: 11px; letter-spacing: 3px;
  text-anchor: middle; pointer-events: none; font-family: "Inter", sans-serif; }

/* ---------- narrow panes ---------- */
@media (max-width: 760px) {
  #studio { flex-direction: column; height: auto; min-height: calc(100vh - 54px); }
  #panel { width: 100%; min-width: 0; order: 2; }
  #panel-body { max-height: none; }
  #stage { order: 1; min-height: 58vh; }
  header { padding: 0 14px; }
  .tag { display: none; }
}

/* ---------- light canvas mode ---------- */
.vtsep { width: 1px; background: var(--line2); margin: 4px 2px; }
#stage.lightbg {
  background:
    radial-gradient(1100px 500px at 50% 12%, #ffffffaa 0%, transparent 70%),
    #dde2ea; }
#stage.lightbg #edit2d, #stage.lightbg #editback {
  background-image: radial-gradient(#9aa5b64d 1.1px, transparent 1.1px); }
#stage.lightbg #hint2d, #stage.lightbg #hint { color: #6b7688; }
#stage.lightbg .backart { fill: #c3cbd8; }
#stage.lightbg .backtag { fill: #6b7688; }
#stage.lightbg .hw { fill: #b8860b22; stroke: #a87b00; }
#stage.lightbg .hwlabel { fill: #a87b00; }
#stage.lightbg .selbox, #stage.lightbg .handlebox { stroke: #1f6fd6; }

/* ---------- rulers ---------- */
canvas.rulers { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

/* ---------- account widget ---------- */
#acct { display: flex; align-items: center; gap: 10px; }
.acct-hi { color: var(--mut); font-size: 13px; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn { background: var(--acc); color: var(--acc-ink); border: none;
  font: 700 13px/1 "Inter", sans-serif; padding: 9px 16px; border-radius: 9px;
  cursor: pointer; }
.acct-btn.alt { background: var(--bg2); color: var(--txt);
  border: 1px solid var(--line2); }
#acct-modal { position: fixed; inset: 0; z-index: 50; background: #0b0e13cc;
  backdrop-filter: blur(4px); display: flex; align-items: center;
  justify-content: center; }
.acct-card { background: var(--panel); border: 1px solid var(--line2);
  border-radius: 16px; padding: 22px; width: 330px; position: relative;
  box-shadow: 0 24px 60px #000a; }
.acct-x { position: absolute; top: 12px; right: 14px; background: none;
  border: none; color: var(--mut); font-size: 15px; cursor: pointer; }
.acct-tabs { display: flex; gap: 4px; background: var(--bg2); padding: 4px;
  border-radius: 10px; margin-bottom: 14px; }
.acct-tabs button { flex: 1; background: none; border: none; color: var(--mut);
  font: 700 13px/1 "Inter", sans-serif; padding: 9px; border-radius: 8px; cursor: pointer; }
.acct-tabs button.on { background: var(--acc); color: var(--acc-ink); }
#acct-form input { width: 100%; margin-bottom: 10px; background: var(--bg2);
  color: var(--txt); border: 1px solid var(--line2); border-radius: 9px;
  padding: 10px 11px; font: 14.5px "Inter", sans-serif; box-sizing: border-box; }
.acct-go { width: 100%; background: var(--acc); color: var(--acc-ink);
  border: none; padding: 11px; border-radius: 10px; font: 800 14.5px "Inter", sans-serif;
  cursor: pointer; }
#acct-err { color: var(--err); font-size: 12.5px; min-height: 16px; margin-top: 8px; }

/* ---------- plans: paywall + saved designs ---------- */
.acct-wrap { position: fixed; inset: 0; z-index: 50; background: #0b0e13cc;
  backdrop-filter: blur(3px); display: flex; align-items: center;
  justify-content: center; }
.acct-wrap.hidden { display: none; }
.acct-plan { background: var(--acc); color: var(--acc-ink); font-size: 11px;
  font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  border-radius: 999px; padding: 3px 9px; }
.pw-card { width: min(560px, 92vw); }
.pw-card h3 { margin: 0 0 14px; font-size: 18px; }
.pw-p { color: var(--mut); font-size: 13.5px; margin: 0 0 14px; }
.pw-cols { display: flex; gap: 12px; align-items: stretch; }
.pw-cols.hidden { display: none; }
.pw-opt { flex: 1; background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 12px; padding: 14px; position: relative;
  display: flex; flex-direction: column; }
.pw-opt.hidden { display: none; }
.pw-opt.best { border-color: var(--acc); }
.pw-best { position: absolute; top: -9px; right: 12px; background: var(--acc);
  color: var(--acc-ink); font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .4px; border-radius: 999px;
  padding: 2px 8px; }
.pw-name { font-weight: 700; font-size: 14px; }
.pw-price { font-family: Anton, sans-serif; font-size: 26px; margin: 6px 0; }
.pw-price small { font-size: 13px; color: var(--mut); font-family: Inter, sans-serif; }
.pw-opt ul { margin: 0 0 12px; padding-left: 18px; color: var(--mut);
  font-size: 12.5px; flex: 1; }
.pw-opt li { margin-bottom: 4px; }
.pw-opt .acct-go { margin-top: auto; }
.pw-note { color: var(--mut); font-size: 12px; margin-top: 12px;
  text-align: center; min-height: 14px; }
.dm-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px;
  border-bottom: 1px solid var(--line2); }
.dm-name { flex: 1; font-weight: 600; font-size: 13.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.dm-date { color: var(--mut); font-size: 12px; }
#dm-list { max-height: 50vh; overflow-y: auto; }
@media (max-width: 560px) { .pw-cols { flex-direction: column; } }
.sv-input { width: 100%; margin-bottom: 12px; background: var(--bg2);
  border: 1px solid var(--line2); border-radius: 9px; color: var(--txt);
  padding: 10px 12px; font: 500 14px Inter, sans-serif; }
.sv-input:focus { outline: none; border-color: var(--acc); }
