:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #74716d;
  --line: #e4e2dd;
  --line-strong: #d4d1ca;
  --soft: #f1f0ec;
  --accent: #111111;
  --focus: #4d7cfe;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
}

.mark {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--ink);
  box-shadow: inset 0 0 0 5px #d7f4e8;
}

.account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.account span {
  min-width: 34px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 650;
}

.account button,
.templates button,
.claim button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .82fr);
  gap: 12px;
  margin-top: 10px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.composer {
  min-height: 620px;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

h1,
h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
  font-weight: 650;
}

.panel-head span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

textarea {
  width: 100%;
  min-height: 398px;
  display: block;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfbfa;
  color: var(--ink);
  line-height: 1.65;
  outline: none;
}

textarea:focus,
select:focus,
input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(77, 124, 254, .12);
}

.templates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.templates button {
  padding: 0 11px;
  color: var(--muted);
}

.templates button:hover,
.account button:hover,
.claim button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
}

select,
input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fbfbfa;
  color: var(--ink);
  outline: none;
}

.primary,
.download {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 650;
}

.primary:hover,
.download:hover {
  background: #2b2b2b;
}

.result {
  display: flex;
  flex-direction: column;
  padding: 10px;
}

.canvas {
  position: relative;
  flex: 1;
  min-height: 560px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: var(--soft);
}

#image {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.empty {
  width: min(78%, 380px);
  opacity: .92;
}

.empty img {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.download {
  display: none;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
}

.lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .82fr);
  gap: 12px;
  margin-top: 12px;
}

.billing {
  padding: 16px;
}

.plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.plan {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfbfa;
  color: var(--ink);
  text-align: left;
}

.plan:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.plan span {
  color: var(--muted);
}

.plan strong {
  font-size: 18px;
}

.claim {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr) 72px;
  gap: 8px;
  margin-top: 12px;
}

.samples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.samples img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.history-panel {
  margin-top: 12px;
  padding: 16px;
}

.history {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.history:empty::before {
  content: "暂无历史";
  color: var(--muted);
  font-size: 13px;
}

.history a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.history img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

button[disabled] {
  opacity: .55;
  cursor: wait;
}

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

  .composer {
    min-height: 0;
  }

  .canvas {
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .app {
    width: min(100vw - 24px, 1180px);
    padding-top: 10px;
  }

  .bar {
    height: 50px;
  }

  .workspace {
    margin-top: 6px;
  }

  textarea {
    min-height: 300px;
  }

  .actions,
  .plans,
  .claim,
  .samples,
  .history {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) and (min-width: 641px) {
  .history {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
