:root {
  --bg: #fff;
  --ink: #111;
  --muted: #666;
  --line: #d7d7d7;
  --soft: #f7f7f7;
  --focus: #b8871f;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  letter-spacing: 0;
}
button, select, textarea { font: inherit; letter-spacing: 0; }
a { color: #0645ad; }

header, main {
  width: min(100% - 24px, 1120px);
  margin: 0 auto;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 8px;
}

.brand {
  color: var(--ink);
  font-size: 24px;
  font-weight: 400;
  text-decoration: none;
}

nav a {
  color: #0645ad;
  font-size: 13px;
  text-decoration: none;
}
nav a:hover, nav a:focus-visible { text-decoration: underline; }

main { padding: 8px 0 12px; }

.tool {
  border: 1px solid var(--line);
  background: #fff;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(220px, 1fr) auto auto minmax(210px, auto);
  gap: 8px;
  align-items: end;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.title-block {
  min-width: 0;
}

h1 {
  margin: 0 0 2px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
}

.title-block p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

label {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

label > span { line-height: 1; }

select, button, textarea {
  border: 1px solid #aaa;
  border-radius: 0;
  color: var(--ink);
}

select, button {
  min-height: 30px;
  padding: 5px 8px;
  background: #fff;
}

select { width: 100%; }
button { cursor: pointer; font-weight: 700; }
button:hover, button:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  border-color: var(--focus);
  outline: 2px solid rgba(184, 135, 31, 0.22);
  outline-offset: 1px;
}

.status {
  margin: 0 0 6px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - 112px);
}

.grid label {
  color: var(--ink);
  font-size: 12px;
  padding: 7px;
}
.grid label + label { border-left: 1px solid var(--line); }

textarea {
  width: 100%;
  height: calc(100vh - 165px);
  min-height: 360px;
  padding: 8px;
  resize: none;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.4;
}
textarea[readonly] { background: #fbfbfb; }

.related { display: none; }

@media (max-width: 860px) {
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .title-block, .tool-choice, .status { grid-column: 1 / -1; }
  .status { text-align: left; }
  .grid { grid-template-columns: 1fr; min-height: 0; }
  .grid label + label { border-left: 0; border-top: 1px solid var(--line); }
  textarea { height: 34vh; min-height: 220px; resize: vertical; }
}

@media (max-width: 520px) {
  header, main { width: min(100% - 14px, 1120px); }
  .toolbar { grid-template-columns: 1fr; }
  button { width: 100%; }
}
