:root {
  color-scheme: light;
  --bg: #eef4f1;
  --bg-deep: #dfe9e5;
  --ink: #101828;
  --muted: #667085;
  --soft: #8a95a3;
  --line: rgba(16, 24, 40, 0.11);
  --line-strong: rgba(16, 24, 40, 0.17);
  --paper: #fffdf8;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --accent: #087f73;
  --accent-strong: #075f56;
  --accent-soft: rgba(8, 127, 115, 0.12);
  --gold: #b7791f;
  --gold-soft: rgba(183, 121, 31, 0.15);
  --danger: #b42318;
  --success: #147a4f;
  --shadow-sm: 0 10px 28px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 80px rgba(16, 24, 40, 0.15);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(8, 127, 115, 0.18), transparent 28rem),
    radial-gradient(circle at 92% 12%, rgba(183, 121, 31, 0.18), transparent 26rem),
    linear-gradient(180deg, #f7faf8 0%, var(--bg) 46%, var(--bg-deep) 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(16, 24, 40, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 40, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 70%);
}

button,
input,
textarea {
  font: inherit;
}

button,
input[type="range"] {
  touch-action: manipulation;
}

.app-shell {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0 56px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(380px, 0.96fr);
  gap: 22px;
  align-items: start;
}

.intro {
  grid-column: 1 / -1;
  max-width: 920px;
  padding: 22px 2px 14px;
}

.section-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 16px;
  font-size: clamp(2.85rem, 6.6vw, 6.45rem);
  line-height: 0.93;
  letter-spacing: 0;
}

.intro p {
  max-width: 760px;
  margin-bottom: 0;
  color: #4f5b67;
  font-size: 1.12rem;
  line-height: 1.75;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.trust-row span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(8, 127, 115, 0.18);
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.62);
  color: #255e58;
  box-shadow: 0 8px 22px rgba(8, 127, 115, 0.07);
  font-size: 0.9rem;
  font-weight: 700;
  backdrop-filter: blur(18px);
}

.editor,
.result-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
}

.editor {
  padding: 24px;
}

.panel-heading,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  margin-bottom: 20px;
}

.panel-heading h2,
.result-header h2 {
  margin: 4px 0 0;
  font-size: 1.16rem;
  line-height: 1.2;
}

.step-pill {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(8, 127, 115, 0.22);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 900;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

label,
fieldset {
  min-width: 0;
}

label span,
legend > span {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-size: 0.88rem;
  font-weight: 800;
}

legend small {
  display: block;
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid rgba(16, 24, 40, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition:
    border-color 170ms ease,
    box-shadow 170ms ease,
    background-color 170ms ease;
}

input[type="text"] {
  height: 48px;
  padding: 0 13px;
}

textarea {
  resize: vertical;
  min-height: 116px;
  padding: 14px;
  line-height: 1.65;
}

input::placeholder,
textarea::placeholder {
  color: #848d9a;
}

input[type="text"]:focus,
textarea:focus {
  border-color: rgba(8, 127, 115, 0.76);
  background: var(--panel-solid);
  box-shadow:
    0 0 0 4px rgba(8, 127, 115, 0.14),
    var(--shadow-sm);
}

.wide-field,
.tone-panel {
  display: block;
  margin-top: 18px;
}

.tone-panel {
  padding: 18px;
  border: 1px solid rgba(8, 127, 115, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.52)),
    var(--accent-soft);
}

.tone-row {
  display: grid;
  grid-template-columns: 116px minmax(120px, 1fr) 40px;
  gap: 14px;
  align-items: center;
  min-height: 44px;
}

.tone-row + .tone-row {
  margin-top: 9px;
}

.tone-row label {
  color: #182230;
  font-size: 0.94rem;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  accent-color: var(--accent);
  cursor: pointer;
}

output {
  display: grid;
  place-items: center;
  width: 40px;
  height: 30px;
  border: 1px solid rgba(8, 127, 115, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent-strong);
  box-shadow: 0 6px 14px rgba(8, 127, 115, 0.08);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 0 20px;
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    opacity 160ms ease;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(8, 127, 115, 0.24);
  outline-offset: 3px;
}

button[type="submit"] {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 14px 28px rgba(8, 127, 115, 0.26);
}

button[type="submit"]:hover {
  box-shadow: 0 18px 34px rgba(8, 127, 115, 0.32);
  transform: translateY(-1px);
}

button[type="button"] {
  border: 1px solid rgba(16, 24, 40, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: #243142;
}

button[type="button"]:hover:not(:disabled) {
  background: var(--panel-solid);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
  transform: none;
}

.status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.status[data-type="error"] {
  color: var(--danger);
}

.status[data-type="success"] {
  color: var(--success);
}

.result-panel {
  position: sticky;
  top: 24px;
  overflow: hidden;
}

.result-header {
  min-height: 76px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

pre {
  min-height: 590px;
  max-height: 72vh;
  margin: 0;
  padding: 26px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #26313d;
  background:
    linear-gradient(90deg, rgba(8, 127, 115, 0.045) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(180deg, #fffdf9, #fffaf0);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.03rem;
  line-height: 1.9;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 28px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.site-footer a,
.back-link {
  color: var(--accent-strong);
  text-decoration: none;
}

.site-footer a:hover,
.back-link:hover {
  text-decoration: underline;
}

.policy-shell {
  width: min(900px, calc(100% - 40px));
}

.policy-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 52px);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
}

.policy-card h1 {
  max-width: 760px;
  margin: 10px 0 12px;
  font-size: clamp(2.6rem, 7vw, 5.2rem);
}

.policy-card h2 {
  margin: 0 0 10px;
  color: #182230;
  font-size: 1.25rem;
}

.policy-card section {
  padding-top: 26px;
  margin-top: 26px;
  border-top: 1px solid var(--line);
}

.policy-card p {
  margin-bottom: 0;
  color: #4f5b67;
  font-size: 1rem;
  line-height: 1.75;
}

.policy-updated {
  color: var(--muted);
  font-weight: 700;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-bottom: 24px;
  border: 1px solid rgba(8, 127, 115, 0.18);
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 8px 22px rgba(8, 127, 115, 0.07);
  font-size: 0.9rem;
  font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 940px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

  pre {
    min-height: 400px;
    max-height: none;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 28px, 720px);
    padding: 28px 0 40px;
  }

  .intro {
    padding-top: 10px;
  }

  h1 {
    font-size: clamp(2.45rem, 14vw, 4.2rem);
  }

  .editor {
    padding: 18px;
  }

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

  .panel-heading,
  .result-header {
    align-items: flex-start;
  }

  .tone-row {
    grid-template-columns: 1fr 40px;
    gap: 8px 12px;
  }

  .tone-row label {
    grid-column: 1 / -1;
  }

  input[type="range"] {
    min-height: 32px;
  }

  .actions button {
    width: 100%;
  }
}
