:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #172033;
  --muted: #647084;
  --line: #d9dee8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

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

.toolbar,
.workspace,
.list-section {
  margin-bottom: 20px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

.toolbar p {
  margin-top: 8px;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
}

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

.upload-panel {
  padding: 18px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 258px;
  padding: 28px;
  border: 1px dashed #9aa6b8;
  border-radius: 8px;
  background: #fbfcfe;
  text-align: center;
  cursor: pointer;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #eefaf7;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: #dff3ef;
  color: var(--accent-strong);
  font-size: 28px;
  line-height: 1;
}

.drop-zone strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.drop-zone small {
  margin-top: 8px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.primary-button {
  flex: 1;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  padding: 0 18px;
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  background: #fff;
  border-color: var(--line);
  color: var(--text);
  font-size: 20px;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.status.is-error {
  color: var(--danger);
}

.result-panel {
  min-width: 0;
  padding: 18px;
}

.result-head,
.list-head,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.url-field {
  width: 100%;
  height: 42px;
  margin: 14px 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fbfcfe;
}

.preview {
  display: grid;
  place-items: center;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f4f8;
  color: var(--muted);
}

.preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 340px;
  object-fit: contain;
}

.list-section {
  padding: 18px;
}

.list-head {
  margin-bottom: 14px;
}

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

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.empty {
  padding: 28px 0;
  color: var(--muted);
}

.image-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.thumb-link {
  display: block;
  aspect-ratio: 4 / 3;
  background: #f1f4f8;
}

.thumb-link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 12px;
}

.card-body strong {
  display: block;
  min-height: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-body input {
  width: 100%;
  height: 36px;
  margin: 10px 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fbfcfe;
}

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

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

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

  h1 {
    font-size: 24px;
  }

  .drop-zone {
    min-height: 210px;
  }
}
