:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --line: #dde5f0;
  --text: #162033;
  --muted: #657189;
  --accent: #1d67d3;
  --danger: #c23737;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 10% 0%, #edf4ff, #f7f9fc 45%, #eef2f8 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", "PingFang SC", "Noto Sans SC", sans-serif;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, #ffffff, #f3f7ff);
  padding: 14px 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
}

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

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px;
  min-height: calc(100vh - 84px);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
}

.panel section {
  margin-bottom: 18px;
}

h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

label,
.hint,
li,
.workspace-meta {
  font-size: 0.86rem;
}

label {
  display: block;
  margin: 10px 0 5px;
}

input[type="text"],
input[type="number"],
select,
input[type="file"],
button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

button {
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
  font-weight: 600;
}

button:hover {
  background: #f0f5ff;
}

button:active {
  transform: translateY(1px);
}

.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.primary:hover {
  background: #155cc4;
}

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

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

.tool-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(29, 103, 211, 0.14);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.checkline input[type="checkbox"] {
  width: auto;
  margin: 0;
}

ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.workspace-wrap {
  min-width: 0;
}

.workspace-meta {
  color: var(--muted);
  margin-bottom: 8px;
}

.workspace {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(45deg, #ffffff 25%, #f2f6fc 25%, #f2f6fc 50%, #ffffff 50%, #ffffff 75%, #f2f6fc 75%, #f2f6fc);
  background-size: 18px 18px;
  padding: 10px;
  height: calc(100vh - 146px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

#editorCanvas {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(17, 29, 52, 0.16);
  background: #fff;
}

.empty-state {
  position: absolute;
  color: var(--muted);
  font-weight: 600;
  pointer-events: none;
}

.inline-text-editor {
  position: absolute;
  min-width: 140px;
  max-width: 360px;
  width: 220px;
  z-index: 10;
  border: 2px solid #1d67d3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 24px rgba(19, 40, 80, 0.18);
  padding: 6px 8px;
  outline: none;
}

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

  .workspace {
    height: 62vh;
  }
}
