:root {
  color-scheme: dark;
  --bg: #101417;
  --panel: #181f23;
  --panel-strong: #202a2f;
  --text: #edf4f2;
  --muted: #9fb0aa;
  --line: #344147;
  --accent: #28d39a;
  --accent-strong: #18b57f;
  --danger: #ff6f61;
  --field: #0f1518;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}
button,
input,
select {
  font: inherit;
}
button,
.file-button {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
button:hover,
.file-button:hover {
  border-color: var(--accent);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 100vh;
}
.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}
.topbar {
  border-bottom: 1px solid var(--line);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: 22px;
  line-height: 1.15;
}
h2 {
  font-size: 15px;
  line-height: 1.2;
}
#imageMeta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.file-button input {
  display: none;
}
.drop-zone {
  position: relative;
  min-height: 420px;
  margin: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #0b0f11;
}
.drop-zone.dragging {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
canvas {
  max-width: 100%;
  max-height: calc(100vh - 118px);
  display: block;
}
.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.empty-state strong {
  color: var(--text);
  font-size: 18px;
}
.empty-state.hidden {
  display: none;
}
.panel {
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
  overflow-y: auto;
}
.panel-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
}
.panel-section:first-child {
  padding-top: 0;
}
.panel-section:last-child {
  border-bottom: 0;
}
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.section-title span {
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
}
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}
input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  padding: 0 10px;
}
input[type="color"] {
  padding: 4px;
  cursor: pointer;
}
input[type="range"] {
  padding: 0;
}
.axis-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
}
.nudge {
  display: grid;
  grid-template-columns: 38px 38px;
  gap: 6px;
}
.icon-button {
  padding: 0;
  min-width: 38px;
  font-weight: 700;
}
.toggle {
  grid-template-columns: 18px 1fr;
  align-items: center;
}
.toggle input {
  min-height: auto;
  width: 18px;
  height: 18px;
}
.preset-save {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.preset-list {
  display: grid;
  gap: 8px;
}
.preset-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--field);
}
.preset-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.preset-row button {
  min-height: 32px;
  padding: 0 10px;
}
.preset-row .delete {
  color: var(--danger);
}
.empty-presets {
  color: var(--muted);
  font-size: 13px;
}
dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(420px, calc(100vw - 28px));
  background: transparent;
  color: var(--text);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
}
.dialog-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 14px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
}
.dialog-card p {
  color: var(--muted);
  font-size: 13px;
}
menu {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
#confirmExport,
#exportZip,
#saveFolder {
  background: var(--accent);
  color: #07100d;
  border-color: var(--accent-strong);
  font-weight: 700;
}
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }
  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .actions {
    justify-content: flex-start;
  }
  canvas {
    max-height: 62vh;
  }
}
@media (max-width: 520px) {
  .topbar {
    padding: 14px;
  }
  .drop-zone {
    margin: 12px;
    min-height: 320px;
  }
  .actions {
    width: 100%;
  }
  .actions > * {
    flex: 1 1 145px;
  }
}
