:root {
  color-scheme: dark;
  --bg: #07090d;
  --panel: #0d1118;
  --panel-raised: #121822;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .15);
  --text: #f4f7fb;
  --muted: #8d98a8;
  --accent: #65f4d1;
  --accent-dim: rgba(101, 244, 209, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
label,
input { font: inherit; }

button:focus-visible,
label:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: #090c11;
}

.brand { display: flex; align-items: center; gap: 12px; }

.mark,
.empty-mark {
  width: 32px;
  height: 32px;
  border: 2px solid var(--accent);
  border-radius: 9px;
  transform: rotate(45deg);
  box-shadow: 0 0 24px rgba(101, 244, 209, .18);
}

h1 { margin: 0; font-size: 1.05rem; letter-spacing: -.01em; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: .76rem; }
.actions { display: flex; gap: 8px; }

button,
.primary {
  border: 1px solid var(--line);
  background: #111722;
  color: var(--text);
  border-radius: 9px;
  padding: 9px 12px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, opacity .16s ease;
}

button:hover:not(:disabled) { border-color: var(--line-strong); background: #151d29; }

.primary {
  background: var(--accent);
  color: #04110d;
  font-weight: 750;
  border-color: var(--accent);
}

button:disabled { opacity: .35; cursor: default; }

main {
  height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

aside {
  position: relative;
  z-index: 2;
  padding: 17px;
  border-right: 1px solid var(--line);
  background: linear-gradient(#0d1118, #090c11);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #29323e transparent;
}

.eyebrow {
  display: block;
  color: #748093;
  font-size: .65rem;
  font-weight: 850;
  letter-spacing: .14em;
  margin-bottom: 9px;
}

.upload {
  display: grid;
  gap: 4px;
  padding: 15px;
  border: 1px dashed rgba(101, 244, 209, .38);
  border-radius: 12px;
  background: rgba(101, 244, 209, .035);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.upload:hover { border-color: var(--accent); background: rgba(101, 244, 209, .07); }
.upload strong { font-size: .86rem; }
.upload span { color: var(--muted); font-size: .73rem; line-height: 1.4; }

.model-tools { margin-top: 12px; transition: opacity .16s ease; }

.model-tools-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #748093;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
}

.model-tools-head .text-button {
  color: var(--accent);
  font-size: .64rem;
  font-weight: 650;
  letter-spacing: 0;
}

.rotate-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.rotate-buttons[aria-disabled="true"] { opacity: .38; }

.rotate-buttons button {
  padding: 7px 4px;
  color: #9ba7b7;
  font-size: .64rem;
}

.rotate-buttons b { color: var(--text); font-size: .68rem; }

aside section {
  margin-top: 17px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.section-head {
  height: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.text-button {
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: .68rem;
}

.text-button:hover:not(:disabled) { color: var(--accent); background: transparent; }

.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 57px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-raised);
}

.status div { min-width: 0; display: grid; gap: 3px; }
.status strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.status small { color: var(--muted); font-size: .67rem; }

#dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: 10px;
  border-radius: 50%;
  background: #444d5a;
}

#dot.active { background: var(--accent); box-shadow: 0 0 14px rgba(101, 244, 209, .75); }

.mini-control { margin-top: 11px; }

.mini-control label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .68rem;
}

.mini-control output {
  min-width: 40px;
  color: #c6cfd9;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 3px;
  display: block;
  appearance: none;
  border-radius: 99px;
  background: #2a3340;
  accent-color: var(--accent);
}

input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  appearance: none;
  border: 2px solid #0e131a;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(101, 244, 209, .35);
  cursor: ew-resize;
}

input[type="range"]:disabled { opacity: .35; }

.patterns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.pattern {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px 9px;
  color: #a6b0be;
  font-size: .69rem;
  text-align: left;
}

.pattern.active {
  border-color: rgba(101, 244, 209, .58);
  background: var(--accent-dim);
  color: var(--text);
}

.pattern i {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: block;
  color: currentColor;
}

.pattern i::before,
.pattern i::after { content: ""; position: absolute; inset: 2px; border: 1.25px solid currentColor; }
.pattern .honeycomb::before { clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.pattern .honeycomb::after { inset: 5px -2px 5px 10px; clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.pattern .circles::before { border-radius: 50%; }
.pattern .circles::after { inset: 7px -1px -1px 7px; border-radius: 50%; }
.pattern .slots::before { inset: 3px 0 7px 0; border-radius: 8px; }
.pattern .slots::after { inset: 9px 3px 1px 3px; border-radius: 8px; }
.pattern .diamonds::before { inset: 3px; transform: rotate(45deg); }
.pattern .diamonds::after { inset: 9px -1px -1px 9px; transform: rotate(45deg); }

.pattern-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 14px;
}

.pattern-controls .mini-control:first-child { grid-column: 1 / -1; }

.preview-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 0;
  color: #6f7b8b;
  font-size: .64rem;
}

.preview-note span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.disabled { opacity: .34; pointer-events: none; }
.disabled button:disabled,
.disabled input:disabled { opacity: 1; }

.cut-status {
  min-height: 2.5em;
  margin: 11px 0 9px;
  color: var(--muted);
  font-size: .66rem;
  line-height: 1.4;
}

.cut-status.ready { color: #b7c4cf; }
.cut-status.success { color: var(--accent); }
.cut-status.error { color: #ff8e8e; }

.cut-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.cut-actions button { padding: 8px 7px; font-size: .68rem; }

.cut-actions .cut-primary {
  grid-column: 1 / -1;
  border-color: rgba(101, 244, 209, .55);
  background: var(--accent-dim);
  color: var(--text);
  font-weight: 700;
}

.cut-actions .cut-primary.busy { color: var(--muted); }

#stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, rgba(78, 99, 110, .14), transparent 32%), #080b10;
}

#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }

#empty {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  pointer-events: none;
}

#empty > * { pointer-events: auto; }
#empty.hidden { display: none; }
.empty-mark { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 10px; }
#empty h2 { margin: 0; font-size: 1.32rem; }
#empty p { margin: 0 0 12px; color: var(--muted); font-size: .84rem; }

#drop {
  position: absolute;
  z-index: 4;
  inset: 14px;
  display: none;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  background: rgba(5, 12, 12, .92);
  font-size: 1.15rem;
  color: var(--accent);
}

#drop.visible { display: grid; }

.tip {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 16, 22, .82);
  color: #929ead;
  font-size: .68rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  backdrop-filter: blur(8px);
}

.tip.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.hud {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  justify-content: space-between;
  color: #8290a1;
  font-size: .69rem;
  pointer-events: none;
}

@media (max-width: 760px) {
  header { height: 64px; padding: 10px 12px; }
  main { height: calc(100vh - 64px); grid-template-columns: 1fr; }
  aside {
    position: absolute;
    top: 74px;
    left: 10px;
    width: min(282px, calc(100vw - 20px));
    max-height: calc(100vh - 84px);
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .32);
  }
  #stage { grid-area: 1 / 1; }
  .brand p { display: none; }
  .actions button { padding: 8px 9px; font-size: .74rem; }
  #empty { display: none; }
  .tip { display: none; }
}
