:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --ink: #202326;
  --muted: #667071;
  --line: #d9ded9;
  --teal: #166c6a;
  --teal-2: #0f4f4d;
  --rose: #a33d57;
  --amber: #b77723;
  --soft: #eaf2ef;
  --shadow: 0 18px 42px rgba(38, 48, 48, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
textarea,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
}

.control-pane {
  border-right: 1px solid var(--line);
  padding: 28px;
  background: #fbfcfa;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-row h1,
.result-toolbar h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 750;
}

.brand-row p,
.result-toolbar p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.field-label {
  margin-top: 8px;
  color: #394043;
  font-size: 13px;
  font-weight: 700;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  outline: none;
}

textarea {
  min-height: 190px;
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
}

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

textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(22, 108, 106, 0.13);
}

button {
  height: 44px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--teal);
  cursor: pointer;
  font-weight: 800;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button-row button {
  min-width: 0;
}

#advancedBtn {
  background: #8c4f77;
}

#advancedBtn:hover:not(:disabled) {
  background: #713b60;
}

#advancedPrompt {
  min-height: 210px;
  font-size: 13px;
  line-height: 1.5;
}

button:hover:not(:disabled) {
  background: var(--teal-2);
}

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

.tag-panel {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.panel-title {
  color: #394043;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--teal-2);
  font-size: 13px;
  font-weight: 700;
}

.tag-chip b {
  color: var(--rose);
}

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

.result-pane {
  min-width: 0;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.result-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
}

.result-actions select {
  width: 140px;
  height: 44px;
}

.result-toolbar button {
  width: 84px;
  background: var(--amber);
  flex: 0 0 auto;
}

.word-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.word-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  padding: 13px 16px;
  border-bottom: 1px solid #eef1ed;
}

.word-row:last-child {
  border-bottom: 0;
}

.word {
  color: #111517;
  font-size: 17px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.translation {
  color: #40484a;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state {
  min-height: 420px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  textarea {
    min-height: 130px;
  }

  .word-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
