:root {
  --bg: #0d1017;
  --panel: #141925;
  --panel-2: #1a2130;
  --line: #232c3f;
  --text: #e8ecf4;
  --muted: #8b95a9;
  --accent: #6d8dff;
  --accent-2: #8b6dff;
  --good: #3ecf8e;
  --warn: #f0b45a;
  --radius: 10px;
  font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.mark { color: var(--accent); font-size: 20px; }
.name { font-weight: 600; letter-spacing: 0.2px; }
.tag { color: var(--muted); font-size: 12.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 13px;
}
.chip:hover { border-color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--good); }
.dot.off { background: var(--warn); }

.studio {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  padding: 18px 22px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.field-label { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 6px; }
.field-label:first-child { margin-top: 0; }

textarea {
  width: 100%; resize: vertical;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 10px 12px; font: inherit; font-size: 14px;
}
textarea:focus { outline: none; border-color: var(--accent); }

.sizes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.size {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 9px 6px; cursor: pointer; font-size: 13px;
  display: flex; flex-direction: column; gap: 2px; align-items: center;
}
.size small { color: var(--muted); font-size: 11px; }
.size.active { border-color: var(--accent); background: rgba(109, 141, 255, 0.10); }

.primary {
  width: 100%; margin-top: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none; border-radius: 8px;
  padding: 11px 16px; font-size: 14.5px; font-weight: 600; cursor: pointer;
}
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: 0.55; cursor: default; }

.hint { color: var(--muted); font-size: 12px; margin-top: 8px; min-height: 16px; }

.divider { height: 1px; background: var(--line); margin: 18px 0 14px; }
.steps-title { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.steps { padding-left: 18px; color: var(--muted); font-size: 12.5px; display: grid; gap: 5px; }

.stage-wrap { display: flex; flex-direction: column; }
.stage {
  position: relative; flex: 1; min-height: 420px;
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-conic-gradient(#171d2a 0% 25%, #131824 0% 50%) 0 / 22px 22px;
  border-radius: 8px; overflow: hidden;
}
.empty { text-align: center; color: var(--muted); }
.empty-mark { font-size: 40px; color: var(--line); display: block; margin-bottom: 8px; }
#preview { max-width: 100%; max-height: 62vh; display: block; }

.busy {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  background: rgba(13, 16, 23, 0.82); backdrop-filter: blur(2px);
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.actionbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.action {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 9px 14px; font-size: 13.5px; cursor: pointer;
}
.action:hover { border-color: var(--accent); }
.action:disabled { opacity: 0.5; cursor: default; }
.action.canva {
  background: linear-gradient(135deg, #00c4cc, #7d2ae8);
  border: none; color: #fff; font-weight: 600;
}

.result-note { color: var(--muted); font-size: 12.5px; margin-top: 10px; min-height: 16px; }
.result-note a { color: var(--accent); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 20;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; width: min(560px, 92vw); max-height: 88vh; overflow: auto;
}
.modal h3 { font-size: 16px; margin-bottom: 12px; }
.svg-holder {
  background: repeating-conic-gradient(#171d2a 0% 25%, #131824 0% 50%) 0 / 22px 22px;
  border-radius: 8px; padding: 10px; display: flex; justify-content: center;
}
.svg-holder svg { max-width: 100%; max-height: 40vh; height: auto; }
.modal-note { color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions .primary { width: auto; margin: 0; }

.foot {
  border-top: 1px solid var(--line);
  padding: 12px 22px; color: var(--muted); font-size: 12px; text-align: center;
}

@media (max-width: 860px) {
  .studio { grid-template-columns: 1fr; }
  .tag { display: none; }
}
