* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 100% -20%, #efe7d3 0%, transparent 45%),
    radial-gradient(circle at -10% 120%, #d9e9e4 0%, transparent 42%),
    #f5f3ee;
  color: #21201d;
  min-height: 100vh;
  padding: 30px 16px;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  background: #fffaf0;
  border: 1px solid #d8d0be;
  border-radius: 20px;
  box-shadow: 0 14px 35px rgba(33, 32, 29, 0.08);
  padding: 24px;
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 2.7vw, 2.2rem);
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 0 0 24px;
  color: #666054;
  font-size: 0.97rem;
}

.section {
  margin-bottom: 18px;
}

.work-box {
  border: 1px solid #d8d0be;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 18px;
}

.input-work-box {
  background: linear-gradient(180deg, #fff8ea 0%, #fffdf7 100%);
}

.output-work-box {
  background: linear-gradient(180deg, #f4f9f7 0%, #fdfefe 100%);
  border-color: #c9d9d4;
}

.work-box .section:last-child {
  margin-bottom: 0;
}

.section h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

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

.controls-head {
  justify-content: flex-end;
  gap: 8px;
}

.control-change-status {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid #edc7bf;
  background: #fff4f1;
  color: #8f3b2e;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  visibility: hidden;
  opacity: 0;
  transition: opacity 140ms ease;
}

.control-change-status.is-visible {
  visibility: visible;
  opacity: 1;
}

.helper {
  margin: 0 0 10px;
  color: #666054;
  font-size: 0.9rem;
}

textarea,
input {
  width: 100%;
  border: 1px solid #d8d0be;
  border-radius: 10px;
  background: #ffffff;
  color: #21201d;
  font: inherit;
  padding: 11px 12px;
}

textarea {
  resize: none;
  overflow-y: hidden;
  min-height: 140px;
  line-height: 1.5;
}

#output {
  min-height: 160px;
}

textarea:focus,
input:focus,
button:focus {
  outline: 2px solid rgba(31, 106, 95, 0.25);
  outline-offset: 1px;
  border-color: #1f6a5f;
}

.replacement-panel {
  background: #f8f5ec;
  border: 1px solid #d8d0be;
  border-radius: 14px;
  padding: 14px;
}

.options-panel {
  background: linear-gradient(180deg, #f3efe2 0%, #f8f5ec 100%);
  border: 1px solid #c9bea8;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.replacement-head {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  margin-bottom: 8px;
  color: #666054;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.replacement-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.option-list {
  display: grid;
  gap: 8px;
}

.option-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  background: #ffffff;
  border: 1px solid #d8d0be;
  border-radius: 10px;
  padding: 10px;
}

.option-row.is-disabled {
  opacity: 0.65;
}

.option-label {
  font-size: 0.95rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
  transition: transform 100ms ease, box-shadow 140ms ease, background 140ms ease;
}

.btn-small {
  padding: 7px 12px;
  font-size: 0.9rem;
}

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

.btn-primary {
  background: #1f6a5f;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(31, 106, 95, 0.25);
}

.btn-secondary {
  background: #ece7da;
  color: #21201d;
  border-color: #d8cfbb;
}

.btn-toggle {
  background: #e6f2ef;
  color: #1f6a5f;
  border-color: #bcd8d1;
  min-width: 96px;
}

.option-row.is-disabled .btn-toggle {
  background: #f0eeea;
  color: #666054;
  border-color: #d8d0be;
}

.btn-danger {
  background: #fff4f1;
  color: #8f3b2e;
  border-color: #edc7bf;
  padding: 9px 10px;
  min-width: 38px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  margin-bottom: 20px;
}

.clean-toolbar {
  justify-content: center;
  margin: 0;
}

.clean-action-bridge {
  margin: 4px 0 20px;
}

.clean-action-bridge .clean-toolbar {
  margin-bottom: 0;
}

.clean-cta {
  width: min(100%, 560px);
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px 18px;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 24px rgba(31, 106, 95, 0.34);
}

.is-hidden {
  display: none;
}

.output-toolbar {
  margin-bottom: 8px;
}

.copy-status {
  align-self: center;
  color: #666054;
  font-size: 0.9rem;
  min-height: 1em;
}

.copy-status.is-success {
  color: #1f6a5f;
}

.copy-status.is-error {
  color: #8f3b2e;
}

.site-footer {
  max-width: 980px;
  margin: 20px auto 0;
  padding: 0 4px;
}

.site-footer p {
  margin: 0;
  padding-top: 14px;
  border-top: 1px dashed #d8d0be;
  color: #666054;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
}

.site-footer a {
  color: #1f6a5f;
  font-weight: 600;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

.site-footer a:hover {
  color: #15564d;
}

@media (max-width: 720px) {
  .app {
    padding: 18px;
  }

  .replacement-head {
    display: none;
  }

  .replacement-row {
    grid-template-columns: 1fr;
  }

  .option-row {
    grid-template-columns: 1fr;
  }

  .btn-danger {
    width: fit-content;
  }
}
