:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #16202a;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #256f8f;
  --accent-strong: #155a75;
  --shadow: 0 18px 50px rgba(20, 32, 45, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  display: grid;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #2fb344;
}

.status-dot.busy {
  background: #c98219;
}

.tool-row,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  flex-wrap: wrap;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented-control button {
  width: 42px;
  height: 38px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
}

.segmented-control button + button {
  border-left: 1px solid var(--line);
}

.segmented-control button.active {
  background: var(--accent);
  color: #ffffff;
}

.brush-size {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  color: var(--muted);
  font-size: 14px;
}

.brush-size input {
  width: 150px;
  accent-color: var(--accent);
}

.brush-size output {
  min-width: 42px;
  color: var(--ink);
}

.command {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  background: #e9eef4;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.command.primary {
  background: var(--accent);
  color: #ffffff;
}

.command:hover:not(:disabled) {
  filter: brightness(0.96);
}

.command:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.drawing-canvas {
  display: block;
  width: 100%;
  height: clamp(260px, 42vh, 420px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  touch-action: none;
}

.result-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.result-panel label {
  color: var(--muted);
  font-size: 14px;
}

.result-panel textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.5;
}

.result-panel textarea:focus {
  outline: 2px solid rgba(37, 111, 143, 0.24);
  border-color: var(--accent);
}

.action-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
  }

  .brush-size {
    width: 100%;
  }

  .brush-size input {
    flex: 1;
    width: auto;
  }

  .drawing-canvas {
    height: 320px;
  }
}
