:root {
  color-scheme: dark;
  --bg: #050706;
  --surface: #0d1110;
  --surface-2: #141917;
  --surface-3: #1a211d;
  --line: #26302b;
  --line-strong: #3d4a43;
  --text: #edf3ee;
  --muted: #97a59d;
  --soft: #c2cec7;
  --accent: #65c8a3;
  --accent-2: #e0896e;
  --danger: #ee7c74;
  --warn: #e4b46d;
  --ok: #7ad38f;
  --code: #070a08;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--sans);
  background:
    linear-gradient(135deg, rgb(101 200 163 / 0.08), transparent 30%),
    linear-gradient(315deg, rgb(224 137 110 / 0.055), transparent 35%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 28px;
}

.topbar,
.panel,
.code-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 24px 90px rgb(0 0 0 / 0.45);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
}

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

h1 {
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  letter-spacing: 0;
}

h3 {
  font-size: 13px;
  letter-spacing: 0;
}

p,
.hint,
label span,
.notice,
.preview span,
.metric span {
  color: var(--muted);
  font-size: 13px;
}

.topbar p {
  margin-top: 5px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 14px;
  margin-top: 14px;
}

.panel,
.code-panel {
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.form {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.row {
  display: grid;
  gap: 12px;
}

.row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.row.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #090d0b;
  color: var(--text);
  outline: none;
  padding: 0 11px;
}

input::placeholder {
  color: #65736b;
}

input:focus,
select:focus {
  border-color: color-mix(in srgb, var(--accent) 72%, #ffffff 0%);
  box-shadow: 0 0 0 3px rgb(101 200 163 / 0.12);
}

.section {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auto-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip,
.badge,
.count {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--soft);
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1;
  padding: 0 10px;
  white-space: nowrap;
}

.badge.ok,
.chip.ok {
  border-color: rgb(122 211 143 / 0.45);
  color: var(--ok);
  background: rgb(122 211 143 / 0.08);
}

.badge.warn,
.chip.warn {
  border-color: rgb(228 180 109 / 0.45);
  color: var(--warn);
  background: rgb(228 180 109 / 0.08);
}

.badge.danger,
.chip.danger,
.notice.danger {
  border-color: rgb(238 124 116 / 0.45);
  color: var(--danger);
  background: rgb(238 124 116 / 0.08);
}

.btn {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0 14px;
}

.btn:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  border-color: color-mix(in srgb, var(--accent) 65%, #ffffff 0%);
  background: var(--accent);
  color: #03100b;
  font-weight: 800;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.wide {
  width: 100%;
}

.filebox {
  min-height: 78px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #090d0b;
  color: var(--soft);
  text-align: center;
}

.filebox input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.side {
  display: grid;
  align-content: start;
  gap: 14px;
  padding-bottom: 14px;
}

.side > label,
.metric,
.notice,
.preview,
.result,
.side > .btn {
  margin-inline: 14px;
}

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.metric b {
  font-size: 28px;
  line-height: 1;
}

.notice,
.result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.notice.ok {
  border-color: rgb(122 211 143 / 0.45);
  color: var(--ok);
  background: rgb(122 211 143 / 0.08);
}

.preview {
  display: grid;
  gap: 7px;
}

code,
pre {
  font-family: var(--mono);
}

.preview code {
  display: block;
  min-height: 40px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #080b09;
  color: var(--text);
  padding: 10px;
  font-size: 12px;
  white-space: nowrap;
}

.code-panel {
  margin-top: 14px;
}

pre {
  max-height: 440px;
  margin: 0;
  overflow: auto;
  background: var(--code);
  padding: 16px;
}

pre code {
  display: block;
  min-width: 760px;
  color: #dce8df;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
}

.result {
  color: var(--soft);
  font-size: 13px;
  white-space: pre-wrap;
}

@media (max-width: 1120px) {
  .grid,
  .row.four {
    grid-template-columns: 1fr;
  }

  .side {
    order: -1;
  }
}

@media (max-width: 740px) {
  .shell {
    width: min(100% - 20px, 1540px);
    padding-top: 10px;
  }

  .topbar,
  .row.two,
  .row.three {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions .btn {
    width: 100%;
  }
}
