:root {
  color-scheme: light;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #f4f6f2;
  color: #17211c;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f4f6f2;
}

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

button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  color: #ffffff;
  background: #226b55;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #185844;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bdcbc4;
  border-radius: 6px;
  background: #ffffff;
  color: #17211c;
}

input,
select {
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  min-height: 132px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2d7f64;
  outline: 3px solid rgba(45, 127, 100, 0.16);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.25rem;
  line-height: 1.2;
}

h2 {
  font-size: 1rem;
}

code {
  overflow-wrap: anywhere;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 20px;
  border-bottom: 1px solid #d7e2dc;
  background: #ffffff;
}

.topbar p,
.tools p,
.message {
  color: #5b6a62;
}

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

.sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 96px);
  overflow: auto;
}

.workspace {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding-bottom: 260px;
}

.panel {
  border: 1px solid #d7e2dc;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  box-shadow: 0 12px 28px rgba(28, 51, 39, 0.08);
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 650;
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.inline input {
  width: 18px;
  min-height: 18px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button-row button {
  flex: 1 1 88px;
}

.result-drawer {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 332px;
  z-index: 3;
  overflow: hidden;
  border: 1px solid #26352d;
  border-radius: 8px;
  background: #17211c;
  color: #eaf4ef;
  box-shadow: 0 18px 48px rgba(28, 51, 39, 0.28);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #33423a;
}

.result-head h2 {
  color: #ffffff;
}

#result-meta {
  color: #9ecdbd;
  font-size: 0.86rem;
}

#result-output {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  white-space: pre-wrap;
}

@media (max-width: 860px) {
  .topbar,
  .tools,
  .operation-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .sidebar {
    position: static;
    max-height: none;
  }

  .result-drawer {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}
