:root {
  color-scheme: light dark;
  --bg: #170a24;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-2: rgba(255, 255, 255, 0.12);
  --text: #f4f7fb;
  --muted: rgba(255, 255, 255, 0.68);
  --line: rgba(255, 255, 255, 0.18);
  --accent: #ff9a5c;
  --accent-2: #b98cff;
  --danger: #ff6b7a;
}

@font-face {
  font-family: "Uncut Sans";
  src: url("/fonts/Uncut-Sans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Uncut Sans";
  src: url("/fonts/Uncut-Sans-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 80% 10%, rgba(185, 140, 255, 0.2), transparent 26%),
    linear-gradient(178deg, #241038 0%, #331843 28%, #5a2b50 58%, #a75352 84%, #e59a6d 100%);
  color: var(--text);
  font: 14px/1.45 "Uncut Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
.file-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
}

button:hover,
.file-button:hover {
  border-color: var(--accent);
}

button.active {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel-2));
  border-color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  padding: 6px 7px;
}

textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

input[type="range"] {
  padding: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 600;
}

h2 {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.app {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.topbar p {
  max-width: 850px;
  margin-top: 4px;
  color: var(--muted);
}

.file-button input {
  display: none;
}

.drop-zone {
  display: grid;
  min-height: 56px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
}

.drop-zone.dragging {
  border-color: var(--accent);
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
}

.panel,
.canvas-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 14px;
}

.controls section {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.check {
  grid-template-columns: 18px 1fr;
  align-items: center;
  color: var(--text);
}

.check input {
  width: auto;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.color-row {
  display: grid;
  grid-template-columns: auto 34px 1fr;
  gap: 8px;
  align-items: center;
}

.swatch {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: repeating-conic-gradient(#777 0% 25%, #bbb 0% 50%) 50% / 12px 12px;
}

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

.padding-readout span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  padding: 6px 7px;
}

.padding-readout strong {
  color: var(--text);
  font-weight: 600;
}

.tile-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.tile-actions input {
  display: none;
}

.nudge-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.nudge-pad button:first-child {
  grid-column: 2;
}

.nudge-pad button:nth-child(2) {
  grid-column: 1;
}

.nudge-pad button:nth-child(3) {
  grid-column: 3;
}

.nudge-pad button:nth-child(4) {
  grid-column: 2;
}

.stage {
  display: grid;
  gap: 14px;
}

.canvas-card {
  min-width: 0;
  padding: 12px;
}

.canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #8a8a8a;
  background-image:
    linear-gradient(45deg, #a8a8a8 25%, transparent 25%),
    linear-gradient(-45deg, #a8a8a8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #a8a8a8 75%),
    linear-gradient(-45deg, transparent 75%, #a8a8a8 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  image-rendering: auto;
}

#previewCanvas {
  width: 100%;
  aspect-ratio: 1;
}

output {
  color: var(--muted);
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
}
