/* ==========================================================================
   学术自检 (Writing Check) — 极简双栏版面
   ========================================================================== */

:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-soft: #fbfbfa;
  --ink: #2c2a29;
  --muted: #73706c;
  --line: #e6e2db;
  --teal: #2c5e43;
  --teal-deep: #1b3d2b;
  --amber: #c07c1e;
  --red: #b42318;
  --indigo: #2c4263;
  --shadow: 0 16px 40px rgba(44, 40, 36, 0.04);
  --border-radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Serif SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.privacy-badge {
  font-size: 13px;
  color: var(--teal);
  background: rgba(44, 94, 67, 0.06);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 500;
}

/* App Shell */
.app-workspace {
  flex: 1;
  width: min(1360px, calc(100% - 32px));
  margin: 24px auto;
  display: flex;
  flex-direction: column;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: stretch;
}

@media (max-width: 1024px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.editor-panel,
.report-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.panel-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

/* View Toggle */
.view-toggle {
  display: flex;
  background: var(--bg);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.view-toggle .toggle-btn {
  background: transparent;
  border: none;
  height: 28px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.view-toggle .toggle-btn.active {
  background: #fff;
  color: var(--teal);
  box-shadow: 0 2px 4px rgba(44, 40, 36, 0.05);
  font-weight: 600;
}

.clear-button {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 6px;
}

.clear-button:hover {
  color: var(--ink);
}

/* Form elements */
.options-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.option-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.option-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.option-field select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
  outline: none;
  font-size: 14px;
  cursor: pointer;
}

/* Input textareas */
.input-area-wrapper {
  position: relative;
  flex: 1;
  min-height: 360px;
  margin-bottom: 18px;
}

#paper-input,
.paper-markup-preview {
  width: 100%;
  height: 100%;
  min-height: 360px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  outline: none;
  resize: vertical;
}

#paper-input:focus {
  border-color: var(--teal);
}

.paper-markup-preview {
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--surface-soft);
}

.hidden {
  display: none !important;
}

/* Buttons */
.actions-bar {
  display: flex;
  gap: 12px;
}

.button {
  height: 42px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.button--primary {
  background: var(--teal);
  color: #fff;
  flex: 1;
}

.button--primary:hover {
  background: var(--teal-deep);
}

.button--secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.button--secondary:hover {
  background: var(--surface-soft);
}

.button--small {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.button--dark {
  background: var(--ink);
  color: #fff;
}

.button--dark:hover {
  background: #000;
}

/* Score section */
.status-indicator {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 4px;
}

.diagnostic-score-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.score-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--muted);
  flex-shrink: 0;
  transition: all 0.3s;
}

.score-meta h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}

.score-meta p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

/* Results Content */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.report-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.signal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signal-list li {
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--surface-soft);
  border-left: 3px solid var(--teal);
  color: var(--ink);
}

.empty-placeholder {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: 6px;
}

/* Suggestions & Modules */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.module-item {
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.module-item strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.module-item p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

/* Revised output */
.revised-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 4px;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.revised-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  min-height: 140px;
}

.revised-box.is-loading {
  border-color: rgba(44, 94, 67, 0.35);
  background: rgba(44, 94, 67, 0.04);
}

.revised-box.is-error {
  border-color: rgba(180, 35, 24, 0.35);
  background: rgba(180, 35, 24, 0.04);
}

.revised-placeholder {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.revised-output {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.revised-summary {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.button--primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Markup Tooltip styles */
.markup-tag {
  position: relative;
  border-bottom: 2px dashed var(--amber);
  cursor: help;
  background-color: rgba(192, 124, 30, 0.08);
  padding: 0 2px;
  border-radius: 2px;
}

.markup-tag::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  background-color: #1c1c1a;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease, transform 0.1s ease;
}

.markup-tag:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* Toast alert */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 9999;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Footer */
.app-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 18px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.footer-container {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.footer-container a {
  color: inherit;
  text-decoration: none;
}
