@font-face {
  font-family: "MTS Compact";
  src: url("fonts/MTSCompact-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "MTS Compact";
  src: url("fonts/MTSCompact-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

:root {
  --ink: #1c1c1c;
  --muted: #5e5e5e;
  --line: #e3e3e3;
  --bg: #f3f3f4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px 0;
}

header .btn {
  flex: none;
}

h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 650;
}

header p {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  padding: 20px 24px 32px;
  align-items: start;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

legend {
  padding: 0;
  font-size: 13px;
  font-weight: 650;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

input[type="text"],
input[type="number"] {
  font: inherit;
  font-size: 15px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

input:focus {
  outline: 2px solid #111;
  border-color: #111;
}

.file {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.btn {
  font: inherit;
  font-size: 15px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #111;
  cursor: pointer;
}

.btn.primary {
  background: #111;
  color: #fff;
}

.btn.ghost {
  background: #fff;
  color: #111;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.stage {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  background: #141414;
  border-radius: 8px;
  touch-action: none;
}

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

@media (min-width: 901px) {
  .panel { position: sticky; top: 12px; }
}

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