:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #17211b;
  --muted: #647067;
  --line: #d8ded6;
  --panel: #ffffff;
  --accent: #176f63;
  --accent-strong: #0d5148;
  --warn: #a85b16;
  --soft: #edf4ef;
}

* {
  box-sizing: border-box;
}

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

button,
textarea,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

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

.public-shell {
  min-height: 100vh;
  display: grid;
  align-content: start;
  gap: 16px;
  padding-top: 48px;
}

.public-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px 16px;
}

.public-header .eyebrow,
.public-header h1 {
  grid-column: 1;
}

.public-header .status {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.public-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.public-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto auto;
  align-items: end;
  justify-content: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
  box-shadow: 0 16px 40px rgba(23, 33, 27, 0.06);
}

.public-toolbar label {
  margin-top: 0;
}

.public-card {
  min-height: 520px;
}

.public-card textarea {
  min-height: 430px;
}

.public-card pre {
  min-height: 430px;
  margin-top: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(23, 33, 27, 0.06);
}

.brand,
.output-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

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

h2 {
  font-size: 22px;
}

.status {
  flex: 0 0 auto;
  min-width: 76px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  padding: 8px 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 310px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  line-height: 1.55;
  outline: none;
}

textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 111, 99, 0.14);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

select[multiple] {
  min-height: 94px;
}

.actions {
  margin-top: 20px;
  justify-content: flex-start;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

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

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

pre {
  min-height: 520px;
  margin: 20px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 16px;
  line-height: 1.55;
  color: var(--ink);
}

.reference {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.phrase-panel {
  margin-top: 16px;
}

.phrase-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
}

.phrase-grid-single {
  grid-template-columns: 1fr;
}

.phrase-text-field textarea {
  min-height: 120px;
}

.phrase-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  max-height: 360px;
  overflow: auto;
}

.phrase-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 12px;
  outline: none;
}

.phrase-item:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 111, 99, 0.14);
}

.phrase-meta {
  min-width: 0;
}

.phrase-meta strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.phrase-item span {
  display: inline-block;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.language-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.language-tags span {
  border-radius: 999px;
  background: var(--soft);
  padding: 4px 8px;
}

.phrase-preview {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(100% + 8px);
  z-index: 5;
  display: none;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(23, 33, 27, 0.16);
  color: var(--ink);
  line-height: 1.55;
  padding: 12px;
  white-space: pre-wrap;
}

.phrase-item:hover .phrase-preview,
.phrase-item:focus-within .phrase-preview,
.phrase-item:focus .phrase-preview {
  display: block;
}

.phrase-item p,
.empty {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.small {
  padding: 7px 10px;
  font-size: 13px;
}

.danger {
  color: #9d2b1f;
}

.danger:hover {
  background: #fff1ee;
}

.reference > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
}

.reference p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

code {
  color: var(--warn);
  font-weight: 800;
}

@media (max-width: 840px) {
  .workspace,
  .public-grid,
  .public-toolbar,
  .controls,
  .phrase-grid,
  .reference {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100vw - 20px, 680px);
    padding: 10px 0;
  }

  .panel {
    padding: 16px;
  }

  .public-shell {
    padding-top: 16px;
  }

  .public-header {
    grid-template-columns: 1fr;
  }

  .public-header .status {
    grid-column: 1;
    grid-row: auto;
    width: max-content;
  }

  .public-card {
    min-height: auto;
  }

  .public-card textarea,
  .public-card pre {
    min-height: 300px;
  }

  .brand,
  .output-head {
    align-items: flex-start;
  }

  textarea {
    min-height: 230px;
  }

  pre {
    min-height: 360px;
  }

  .phrase-item {
    grid-template-columns: 1fr;
  }

  .phrase-actions {
    justify-content: flex-start;
  }
}
