:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: #f6f7f9;
  color: #202124;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

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

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

.topbar,
.url-form,
.ai-panel,
.status,
.log-list,
.workspace {
  max-width: 1800px;
  margin-left: auto;
  margin-right: auto;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.2;
}

p {
  margin: 0;
  color: #5f6368;
}

.url-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 140px 110px;
  gap: 10px;
  margin-bottom: 12px;
}

.ai-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) minmax(180px, 0.8fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.secret-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

label,
.pane-title {
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d8dde4;
  border-radius: 8px;
  background: #fff;
  color: #202124;
  outline: none;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  padding: 14px;
  resize: none;
  line-height: 1.55;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

button {
  height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: #0f766e;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.summary-actions {
  display: flex;
  gap: 8px;
}

.status {
  min-height: 24px;
  margin-top: 6px;
  margin-bottom: 10px;
  color: #475569;
  font-size: 14px;
}

.log-list {
  height: 118px;
  margin-top: 0;
  margin-bottom: 12px;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid #d8dde4;
  border-radius: 8px;
  background: #111827;
  color: #d1d5db;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  list-style: none;
}

.log-line {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.log-info {
  color: #d1d5db;
}

.log-warn {
  color: #fbbf24;
}

.log-error {
  color: #fca5a5;
}

.log-success {
  color: #86efac;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

#markdownInput,
#summaryOutput,
.markdown-preview {
  height: calc(100vh - 355px);
  min-height: 460px;
}

.markdown-preview {
  overflow: auto;
  padding: 16px;
  border: 1px solid #d8dde4;
  border-radius: 8px;
  background: #fff;
  line-height: 1.7;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
  line-height: 1.3;
}

.markdown-preview img {
  max-width: 100%;
  height: auto;
}

.markdown-preview pre {
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #f1f5f9;
}

@media (max-width: 1280px) {
  .ai-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }

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

  #markdownInput,
  #summaryOutput,
  .markdown-preview {
    height: 420px;
    min-height: 420px;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .url-form,
  .ai-panel {
    grid-template-columns: 1fr;
  }
}
