:root {
  --page-bg: #f5f7fa;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #667085;
  --border: #d9dee7;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --code-bg: #f1f5f9;
  --success: #027a48;
  --error: #b42318;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 8px;
  --radius-large: 12px;
  --container: 1280px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.container {
  width: min(100% - 48px, var(--container));
  margin-inline: auto;
}

h2,
p {
  overflow-wrap: anywhere;
}

.generator-section {
  padding-block: 40px 12px;
}

.generator-shell {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--code-bg);
}

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  gap: 10px;
  padding: 14px 18px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.tab-button:last-child {
  border-right: 0;
}

.tab-button:hover {
  background: rgba(37, 99, 235, 0.06);
  color: var(--text);
}

.tab-button:focus-visible,
.button:focus-visible,
.output-link:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.tab-button.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: inset 0 -3px 0 var(--primary);
}

.tab-panel {
  padding: 40px;
}

.panel-header {
  max-width: 800px;
  margin-bottom: 30px;
}

.panel-header h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.75rem, 3vw, 2.45rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.panel-header p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.generator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 40px;
  align-items: start;
}

.form-column,
.output-column {
  min-width: 0;
}

.field-group {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

label,
.check-row {
  color: var(--text);
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfcfe;
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.95rem;
  line-height: 1.55;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

input,
textarea {
  padding: 12px 14px;
}

.anchor-input {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfcfe;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.anchor-input:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.anchor-input span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-family: "Courier New", Courier, monospace;
  font-weight: 700;
}

.anchor-input input {
  min-height: 46px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.anchor-input input:focus {
  box-shadow: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

#email-body {
  min-height: 180px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  gap: 10px;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 24px;
  color: var(--muted);
  font-weight: 600;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
  accent-color: var(--primary);
}

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

.button {
  min-width: 190px;
  padding: 12px 18px;
  border: 1px solid transparent;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--primary-hover);
}

.secondary-button {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.secondary-button:disabled,
.secondary-button[aria-disabled="true"] {
  opacity: 0.48;
  pointer-events: none;
}

.output-column {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--code-bg);
}

.output-column h3 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.3;
}

.output-column textarea {
  min-height: 215px;
  background: var(--surface);
  white-space: pre;
  overflow: auto;
}

.output-link {
  display: block;
  min-height: 44px;
  margin: 12px 0 20px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--primary);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.92rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.output-link:not([href]),
.output-link[href="#"] {
  color: var(--muted);
  pointer-events: none;
}

.output-actions {
  justify-content: flex-start;
}

.status-message {
  min-height: 24px;
  margin: 18px 0 0;
  font-weight: 700;
}

.status-message.is-success {
  color: var(--success);
}

.status-message.is-error {
  color: var(--error);
}

.site-footer {
  background: transparent;
  border-top: 0;
}

.site-footer .container {
  padding-block: 0 28px;
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 1023px) {
  .container {
    width: min(100% - 40px, var(--container));
  }

  .generator-section {
    padding-block: 50px 12px;
  }

  .tab-panel {
    padding: 30px;
  }

  .generator-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

@media (max-width: 767px) {
  .container {
    width: min(100% - 28px, var(--container));
  }

  .generator-section {
    padding-block: 30px 12px;
  }

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

  .tab-button {
    justify-content: flex-start;
    min-height: 54px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .tab-button:last-child {
    border-bottom: 0;
  }

  .tab-panel {
    padding: 24px 18px;
  }

  .panel-header {
    margin-bottom: 24px;
  }

  .panel-header h2 {
    font-size: 1.6rem;
  }

  .generator-grid {
    gap: 20px;
  }

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

  .button {
    width: 100%;
    min-width: 0;
  }

  .output-column {
    padding: 18px;
  }
}
