:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #16201f;
  --muted: #66706f;
  --line: #dce4e2;
  --brand: #0f8f8a;
  --brand-dark: #08736f;
  --accent: #f3b33f;
  --danger: #c84e42;
  --shadow: 0 18px 45px rgba(19, 46, 44, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    Arial,
    sans-serif;
  background:
    linear-gradient(135deg, rgba(15, 143, 138, 0.12), transparent 32%),
    linear-gradient(225deg, rgba(243, 179, 63, 0.16), transparent 36%),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.workspace {
  width: min(1440px, 100%);
  max-width: 100%;
  margin: 0 auto;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.status-pill {
  min-width: 112px;
  padding: 9px 14px;
  border: 1px solid rgba(15, 143, 138, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--brand-dark);
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.backend-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-dark);
}

.backend-link:hover {
  background: #eef8f7;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.85fr) minmax(0, 1.05fr);
  gap: 18px;
  align-items: stretch;
  min-width: 0;
}

.panel {
  min-width: 0;
  min-height: 680px;
  padding: 18px;
  border: 1px solid rgba(220, 228, 226, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-bottom: 14px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

textarea,
input {
  display: block;
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdfd;
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

textarea:focus,
input:focus {
  border-color: rgba(15, 143, 138, 0.72);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(15, 143, 138, 0.12);
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

#sourceText,
#resultText {
  min-height: 552px;
  padding: 15px;
  font-size: 15px;
}

#resultText {
  background: #f9fbfa;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: #33413f;
  font-size: 13px;
  font-weight: 800;
}

input {
  height: 42px;
  padding: 0 12px;
}

.wide-field {
  grid-column: 1 / -1;
}

.wide-field textarea {
  min-height: 94px;
  padding: 11px 12px;
}

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

.actions button,
.icon-button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 7px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 143, 138, 0.22);
}

.actions button:hover,
.icon-button:hover {
  background: var(--brand-dark);
}

.actions .secondary,
.icon-button.ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  box-shadow: none;
}

.actions .secondary:hover,
.icon-button.ghost:hover {
  border-color: rgba(15, 143, 138, 0.38);
  background: #eef8f7;
}

.notice {
  min-height: 42px;
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #fff8e8;
  color: #625234;
  font-size: 13px;
  line-height: 1.5;
}

.notice.warning {
  border-left-color: var(--danger);
  background: #fff0ee;
  color: #70403b;
}

.notice.success {
  border-left-color: var(--brand);
  background: #eef8f7;
  color: var(--brand-dark);
}

@media (max-width: 1180px) {
  .editor-grid {
    grid-template-columns: 1fr 1fr;
  }

  .fields-panel {
    grid-column: 1 / -1;
    min-height: 0;
    order: 3;
  }

  .output-panel {
    order: 2;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
    overflow-x: hidden;
  }

  .workspace {
    width: calc(100vw - 32px);
  }

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

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .editor-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .fields-panel {
    min-height: 0;
  }

  #sourceText,
  #resultText {
    min-height: 360px;
  }
}
