.code-textarea {
  min-height: 180px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.section-margin {
  margin-bottom: 18px;
}

.io-section-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
}

.io-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.inputbox-shell {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface), white 2%);
  border-radius: 16px;
  padding: 13px 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}

.output-shell {
  display: grid;
  gap: 12px;
}

.outputbox-shell {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface), white 2%);
  border-radius: 16px;
  padding: 13px 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}

.output-toggle-btn {
  display: none;
  width: 100%;
  margin-top: 10px;
}

.inputbox-shell:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}

.outputbox-shell:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}

.inputbox-shell .code-textarea {
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
  border-radius: 0;
}

.inputbox-shell .code-textarea:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.outputbox-shell .code-textarea {
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
  border-radius: 0;
}

.outputbox-shell .code-textarea:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.calculator-action-buttons,
.utility-row {
  display: grid;
  gap: 10px;
}

.calculator-action-buttons {
  grid-template-columns: repeat(2, minmax(0, 180px));
  width: 100%;
  justify-content: end;
  margin-top: 6px;
}

.calculator-action-buttons > button,
.utility-row > button {
  width: 100%;
}

.utility-row {
  grid-template-columns: repeat(2, minmax(0, 180px));
  justify-content: end;
  margin-top: 6px;
}

.utility-row > button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  border-color: color-mix(in oklab, var(--line), white 18%);
  background: color-mix(in oklab, var(--surface), var(--panel) 68%);
  color: var(--muted);
  box-shadow: none;
}

.utility-row > button:disabled:hover {
  border-color: color-mix(in oklab, var(--line), white 18%);
  background: color-mix(in oklab, var(--surface), var(--panel) 68%);
  color: var(--muted);
  transform: none;
}

.inputbox-shell .calculator-error,
#formError {
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid color-mix(in oklab, #d97706, white 28%);
  border-radius: 12px;
  background: color-mix(in oklab, #d97706, white 90%);
  color: #9a3412;
}

[data-theme="dark"] .inputbox-shell .calculator-error,
[data-theme="dark"] #formError {
  border-color: color-mix(in oklab, #f59e0b, black 35%);
  background: color-mix(in oklab, #7c2d12, black 55%);
  color: #fdba74;
}

.code-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in oklab, var(--surface), white 4%);
  padding: 14px;
}

[data-theme="dark"] .code-card {
  background: color-mix(in oklab, var(--surface), black 2%);
}

.code-card strong,
.code-card p {
  margin: 0;
}

.code-card p {
  color: var(--muted);
  margin-top: 6px;
}

.code-preview {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.94rem;
  line-height: 1.6;
}

.scenario-output {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 320px;
}

.plain-icon-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 auto;
  margin-inline-start: 6px;
}

.plain-icon-btn:hover {
  color: var(--brand);
}

.plain-icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

@media (max-width: 720px) {
  .output-toggle-btn.is-visible {
    display: inline-flex !important;
    justify-content: center;
  }

  .outputbox-shell.is-collapsed-mobile .code-textarea {
    overflow: hidden;
  }

  .calculator-action-buttons,
  .utility-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .utility-row {
    justify-content: stretch;
  }
}
