:root {
  color-scheme: dark;
  --ink: #f7f2ff;
  --muted: #c8bdd8;
  --panel: rgba(12, 12, 20, 0.9);
  --line: rgba(255, 255, 255, 0.16);
  --pink: #ff77b7;
  --mint: #66f2c8;
  --gold: #ffd86b;
  --danger: #ff5b63;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 119, 183, 0.16), transparent 24rem),
    linear-gradient(145deg, #101019 0%, #21162f 42%, #221a20 100%);
  color: var(--ink);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.editor-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 18px;
}

.editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 13px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0;
}

p,
.status,
.hint {
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav a,
button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

nav a,
nav button {
  min-width: 112px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  text-decoration: none;
}

#exportButton {
  background: linear-gradient(135deg, var(--pink), var(--gold));
  color: #170d17;
}

#importInput {
  display: none;
}

.editor-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 300px;
  gap: 14px;
}

.tool-panel,
.inspector-panel {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
}

.panel-block {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  padding: 0 8px;
}

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

.tool {
  height: 38px;
}

.tool.active {
  border-color: var(--gold);
  background: rgba(255, 216, 107, 0.2);
}

.tool.danger {
  color: #ffd6d9;
  border-color: rgba(255, 91, 99, 0.45);
}

.stage-area {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: rgba(5, 5, 10, 0.82);
  overflow: hidden;
}

.canvas-wrap {
  width: 100%;
  height: calc(100vh - 122px);
  overflow: auto;
}

canvas {
  display: block;
  background: #080912;
  image-rendering: auto;
}

.selection-title {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: white;
  font-weight: 900;
}

.inspector-fields {
  display: grid;
  gap: 8px;
}

.field-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.field-row span {
  color: var(--muted);
  font-size: 12px;
}

.field-row input,
.field-row select {
  height: 32px;
}

.hint {
  line-height: 1.5;
}

@media (max-width: 1080px) {
  .editor-top,
  .editor-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .editor-top {
    align-items: stretch;
  }

  nav {
    justify-content: stretch;
  }

  nav a,
  nav button {
    flex: 1 1 140px;
  }

  .canvas-wrap {
    height: 58vh;
  }
}
