:root {
  color-scheme: light;
  --ink: #20242c;
  --muted: #6f7785;
  --line: #e5e8ef;
  --panel: #ffffff;
  --page: #f3f5f8;
  --blue: #1677ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked .shell {
  display: none;
}

.auth-screen {
  display: none;
}

body.auth-locked .auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--page);
}

.auth-card {
  width: min(100%, 380px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(38, 45, 58, 0.14);
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.2;
}

.auth-card > p {
  margin-bottom: 20px;
}

.auth-card button {
  width: 100%;
}

.auth-message {
  min-height: 22px;
  margin-top: 12px;
  color: #ef3b37;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(360px, 1fr);
  gap: 24px;
  max-width: 1260px;
  margin: 0 auto;
}

.editor {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  height: fit-content;
}

.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
}

p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  color: #3b414c;
  font-size: 14px;
  font-weight: 700;
}

.switch-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  cursor: pointer;
}

.switch-field span {
  color: #3b414c;
  font-size: 14px;
  font-weight: 700;
}

.switch-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-field b {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #c9d1df;
  transition: background 0.15s ease;
}

.switch-field b::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
  transition: transform 0.15s ease;
}

.switch-field input:checked + b {
  background: var(--blue);
}

.switch-field input:checked + b::after {
  transform: translateX(20px);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  color: var(--ink);
  outline: none;
  padding: 12px 13px;
}

select {
  cursor: pointer;
}

textarea {
  resize: vertical;
  line-height: 1.65;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.file-row {
  display: flex;
  gap: 12px;
}

.file-row button,
.file-button {
  flex: 1;
  text-align: center;
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  padding: 11px 16px;
  font-weight: 700;
  overflow: hidden;
}

.file-button:hover {
  border-color: #b7c0cf;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-status {
  min-height: 22px;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.draw-actions {
  margin-top: 12px;
}

.draw-actions button:first-child {
  border-color: #ef3b37;
}

.draw-actions button:first-child::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 999px;
  background: #ef3b37;
  vertical-align: 1px;
}

.draw-actions .active {
  background: #ef3b37;
  border-color: #ef3b37;
  color: #ffffff;
}

.draw-actions .active::before {
  background: #ffffff;
}

.status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  padding: 11px 16px;
  font-weight: 700;
}

button:hover {
  border-color: #b7c0cf;
}

.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.preview-wrap {
  display: grid;
  place-items: start center;
  overflow: auto;
  background: #dfe3ea;
  border: 1px solid #d7dce5;
  border-radius: 8px;
  padding: 24px;
  min-height: calc(100vh - 56px);
}

canvas {
  width: min(100%, 944px);
  height: auto;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(38, 45, 58, 0.18);
  touch-action: none;
}

canvas.drawing {
  cursor: crosshair;
}

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .preview-wrap {
    min-height: auto;
    padding: 12px;
  }
}
