:root {
  color-scheme: dark;
  --nyu-violet: #57068c;
  --deep-violet: #330662;
  --violet-50: #ab82c5;
  --pink: #e00f78;
  --teal: #00a99d;
  --light: #f2f2f2;
  --panel: #1d1426;
  --panel-2: #261633;
  --line: rgba(242, 242, 242, 0.16);
  --line-strong: rgba(242, 242, 242, 0.28);
  --shadow: rgba(0, 0, 0, 0.32);
  font-family: "NYU Perstare", Inter, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  min-width: 1180px;
  margin: 0;
  overflow: hidden;
  background: #130d19;
  color: var(--light);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(242, 242, 242, 0.08);
  color: var(--light);
  cursor: pointer;
}

button:hover {
  border-color: var(--violet-50);
  background: rgba(171, 130, 197, 0.16);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: default;
  opacity: 0.36;
  transform: none;
}

.shell {
  display: grid;
  gap: 16px;
  height: 100vh;
  padding: 18px;
  grid-template-rows: auto minmax(560px, 1fr) 250px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(51, 6, 98, 0.88), rgba(29, 20, 38, 0.92));
  box-shadow: 0 14px 40px var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--pink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 4px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

h2 {
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.topbar-actions,
.export-actions,
.preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.14);
  color: var(--violet-50);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--pink);
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(560px, 1fr) 330px;
  gap: 16px;
  min-height: 0;
  overflow: hidden;
}

.panel,
.preview-panel,
.export-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 40px var(--shadow);
}

.panel {
  display: flex;
  flex-direction: column;
}

.panel-head,
.preview-head,
.export-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.filter {
  width: 116px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--light);
}

.palette,
.stack-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.group {
  margin-bottom: 16px;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
  color: var(--violet-50);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.group-title::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.component-card {
  width: 100%;
  margin: 0 0 8px;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.component-card strong,
.stack-name {
  display: block;
  color: var(--light);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
}

.component-card span,
.stack-file,
#previewMeta,
#scriptMeta {
  display: block;
  margin-top: 5px;
  color: var(--violet-50);
  font-size: 12px;
  line-height: 1.25;
}

.preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.preview-wrap {
  display: grid;
  align-items: center;
  justify-items: center;
  min-height: 0;
  padding: 16px;
  background:
    linear-gradient(45deg, rgba(242, 242, 242, 0.03) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(242, 242, 242, 0.03) 25%, transparent 25%),
    #0f0b14;
  background-size: 22px 22px;
  background-position: 0 0, 0 11px;
}

.preview-svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(0, 169, 157, 0.75);
  background: var(--deep-violet);
}

.stack-list {
  list-style: decimal-leading-zero;
  margin: 0;
  padding-left: 44px;
}

.stack-list li {
  position: relative;
  margin: 0 0 10px;
  padding: 10px 10px 10px 0;
}

.stack-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.stack-item > div:first-child {
  min-width: 0;
}

.stack-file {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stack-actions {
  display: grid;
  grid-template-columns: 42px 42px;
  gap: 6px;
}

.stack-actions button {
  min-width: 42px;
  min-height: 30px;
  padding: 0;
  font-size: 12px;
  font-weight: 900;
}

.count {
  min-width: 34px;
  height: 26px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: rgba(224, 15, 120, 0.18);
  color: var(--pink);
  font-size: 13px;
  font-weight: 900;
}

.empty-state {
  padding: 20px 10px;
  color: var(--violet-50);
  font-size: 14px;
  line-height: 1.35;
}

.export-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.export-actions button,
.preset-bar button {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 900;
}

#scriptOutput {
  width: 100%;
  height: 100%;
  resize: none;
  border: 0;
  outline: 0;
  padding: 14px 16px;
  background: #0d0a12;
  color: #f6f1fb;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
}

.toast {
  color: var(--teal) !important;
}
