:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --text: #13201d;
  --muted: #5f6f6a;
  --line: #d7e0dd;
  --accent: #0c7c6d;
  --accent-strong: #07594f;
  --danger: #b42318;
  --success: #087443;
  --shadow: 0 18px 50px rgba(22, 42, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

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

.intro {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.12;
}

.intro p:last-child {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 0;
}

.input-area {
  padding: 32px;
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 154px;
  border: 2px dashed #9db0ab;
  border-radius: 8px;
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 700;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.upload-zone:hover {
  background: #eef7f5;
  border-color: var(--accent);
}

.upload-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.field-label {
  display: block;
  margin: 24px 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
  font: 14px/1.55 Consolas, "Courier New", monospace;
}

textarea:focus,
.clear-button:focus,
.install-link:focus {
  outline: 3px solid rgba(12, 124, 109, 0.22);
  outline-offset: 2px;
}

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

.install-link,
.clear-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 12px 18px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
}

.install-link {
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
}

.install-link:hover {
  background: var(--accent-strong);
}

.install-link.is-disabled {
  background: #cbd8d4;
  color: #62726d;
  cursor: not-allowed;
  pointer-events: none;
}

.clear-button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text);
  cursor: pointer;
}

.clear-button:hover {
  border-color: #9db0ab;
}

.status {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.status[data-tone="success"] {
  color: var(--success);
}

.status[data-tone="error"] {
  color: var(--danger);
}

.preview-area {
  display: grid;
  place-items: center;
  min-height: 480px;
  padding: 32px;
  background: #e8efed;
  border-left: 1px solid var(--line);
}

canvas {
  display: block;
  width: min(100%, 360px);
  max-height: 420px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(22, 42, 36, 0.15);
}

canvas[hidden] {
  display: none;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 620px);
    padding: 16px 0;
  }

  .intro,
  .input-area,
  .preview-area {
    padding: 22px;
  }

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

  .preview-area {
    min-height: 260px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .install-link,
  .clear-button {
    width: 100%;
    text-align: center;
  }
}
