:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #1a1d22;
  --panel-2: #23272e;
  --line: #343a44;
  --text: #f3f0e8;
  --muted: #aab0ba;
  --accent: #23c3b6;
  --accent-2: #e45d6a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    var(--bg);
  background-size: 36px 36px;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 100vh;
}

.stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  min-width: 0;
  padding: 32px;
}

.preview-shell {
  display: grid;
  place-items: center;
  width: min(72vh, 74vw);
  max-width: 780px;
  aspect-ratio: 1;
  background: #d9d9d8;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sprite-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.status {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--muted);
}

.status span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(16, 17, 20, 0.68);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  padding: 28px;
  background: rgba(26, 29, 34, 0.96);
  border-left: 1px solid var(--line);
}

.brand h1,
.control-group h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 24px;
  line-height: 1.1;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.control-group {
  display: grid;
  gap: 12px;
}

.control-group h2 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.motion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.motion-button,
.icon-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.motion-button {
  text-align: left;
  padding: 10px 12px;
}

.motion-button[aria-pressed="true"] {
  border-color: rgba(35, 195, 182, 0.9);
  box-shadow: inset 3px 0 0 var(--accent);
}

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

.toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 0 8px;
  color: var(--muted);
  white-space: nowrap;
}

.align-toggle {
  justify-content: flex-start;
  padding: 0;
}

.slider-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.slider-row input {
  width: 100%;
  accent-color: var(--accent);
}

.sheet-preview {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #d9d9d8;
  border: 1px solid var(--line);
}

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

  .stage {
    min-height: 62vh;
    padding: 18px;
  }

  .preview-shell {
    width: min(92vw, 58vh);
  }

  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 18px;
  }
}
