:root {
  color-scheme: dark;
  --bg: #0f1114;
  --surface: #171a1f;
  --border: #2a3038;
  --text: #e8eaed;
  --muted: #9aa3ad;
  --accent: #5b9fd4;
  --accent-hover: #7ab3de;
  --danger: #e57373;
  --sidebar-w: 280px;
  --font: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  overflow: hidden;
}

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.sidebar__header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.sidebar__header p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.panel {
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}

.panel__label {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.meta {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
}

.file-btn {
  display: block;
  text-align: center;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  cursor: pointer;
  font-size: 0.875rem;
  transition: border-color 0.15s, background 0.15s;
}

.file-btn:hover {
  border-color: var(--accent);
  background: rgba(91, 159, 212, 0.08);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.segmented__btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.segmented__btn.is-active {
  background: var(--accent);
  color: #0a0c0e;
  font-weight: 600;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.btn {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--muted);
}

.btn--primary {
  width: 100%;
  margin-top: 0.65rem;
  background: var(--accent);
  border-color: transparent;
  color: #0a0c0e;
  font-weight: 600;
  padding: 0.6rem;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
}

.field select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
}

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(91, 159, 212, 0.06), transparent 55%),
    var(--bg);
}

.stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.stage--empty .stage__placeholder {
  display: block;
}

.stage__placeholder {
  display: none;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  max-width: 22rem;
  line-height: 1.5;
}

.stage__inner {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.stage__canvas {
  display: block;
  vertical-align: top;
  max-width: 100%;
  max-height: calc(100vh - 2.5rem);
}

.stage__hit {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.stage__hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
