:root {
  color-scheme: light;
  --bg: #f4f3f0;
  --panel: #ffffff;
  --panel-soft: #fbfaf8;
  --text: #171b22;
  --muted: #69717f;
  --line: #e3dfd7;
  --primary: #141a24;
  --primary-hover: #263143;
  --champagne: #c8a968;
  --champagne-soft: #f4eddd;
  --danger: #b54747;
  --danger-soft: #f8eaea;
  --success: #287a54;
  --success-soft: #e8f3ed;
  --shadow: 0 18px 40px rgba(24, 27, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

.auth-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-brand {
  margin-bottom: 22px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  padding: 0 13px;
  color: var(--text);
  background: white;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--champagne);
  box-shadow: 0 0 0 3px rgba(200, 169, 104, 0.14);
}

.shell {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 24px 20px;
  width: min(1220px, calc(100% - 34px));
  height: 100vh;
  margin: 0 auto;
  padding: 14px 0 10px;
}

.header {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 14px;
  background: var(--primary);
  color: var(--champagne);
  font-weight: 850;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.translator {
  display: grid;
  grid-template-columns: minmax(0, 45fr) 38px minmax(0, 55fr);
  gap: 10px;
  align-items: stretch;
  min-height: 0;
}

.input-panel,
.output-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.input-panel {
  display: grid;
  grid-template-rows: 50px 228px auto;
  min-height: 0;
}

.output-panel {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: 0;
}

.panel-head,
.target-row,
.result-actions,
.input-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
}

.target-row {
  align-items: end;
}

.input-panel .panel-head {
  align-items: start;
  padding: 8px 14px 6px;
}

.panel-head,
.target-row,
.result-actions {
  border-bottom: 1px solid var(--line);
}

.input-foot {
  min-height: 44px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.label,
label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

h2 {
  font-size: 15px;
  line-height: 1.25;
}

h3 {
  font-size: 15px;
  line-height: 1.25;
}

textarea {
  width: 100%;
  height: 228px;
  min-height: 210px;
  max-height: 240px;
  resize: none;
  border: 10px solid #fff;
  outline: 0;
  padding: 10px 12px;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff 0%, #fffdf9 100%);
  font-size: 16px;
  line-height: 1.55;
  box-shadow: inset 0 1px 0 rgba(200, 169, 104, 0.12);
}

textarea::placeholder {
  color: #9ca3af;
}

.arrow {
  display: grid;
  place-items: center;
  color: var(--champagne);
  font-size: 28px;
  font-weight: 850;
}

.target-row label {
  min-width: 168px;
  flex: 1 1 0;
}

select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--text);
  padding: 0 38px 0 13px;
}

button {
  height: 36px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 780;
  white-space: nowrap;
}

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

.primary {
  min-width: 132px;
  padding: 0 20px;
  background: var(--primary);
  color: white;
}

.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.ghost {
  min-width: 78px;
  padding: 0 15px;
  background: var(--champagne-soft);
  color: #5d4a22;
  border-color: #eadfca;
}

.ghost:hover:not(:disabled) {
  border-color: var(--champagne);
}

.result-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-list {
  display: grid;
  grid-auto-rows: min-content;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
  background: var(--panel-soft);
}

.result-list.single {
  grid-auto-rows: minmax(0, 1fr);
}

.result-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 92px;
  max-height: 150px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(24, 27, 34, 0.04);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 7px 10px 7px 13px;
  border-bottom: 1px solid var(--line);
}

.result-head h3::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--champagne);
  vertical-align: 1px;
}

.result-text {
  min-height: 0;
  overflow: auto;
  padding: 10px 13px 12px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.error-card {
  border-color: #f0caca;
  background: #fff7f7;
}

.error-card .result-text {
  color: var(--danger);
}

.result-text.empty {
  color: #9ca3af;
}

.hidden {
  display: none;
}

.status {
  min-height: 26px;
  margin: 0;
  padding: 6px 4px 0;
  color: var(--muted);
  font-size: 14px;
}

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

.status.success {
  color: var(--success);
}

.health-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
}

@media (max-width: 980px) {
  body {
    height: auto;
    overflow: auto;
  }

  .shell {
    width: min(100% - 24px, 760px);
    height: auto;
    min-height: 100vh;
    display: block;
    padding: 20px 0;
  }

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

  .arrow {
    height: 24px;
    transform: rotate(90deg);
  }

  .target-row,
  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .target-row label {
    min-width: 0;
  }

  .primary,
  .result-actions .ghost {
    width: 100%;
  }
}
