:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #161b22;
  --surface-control: #0d1117;
  --surface-hover: #21262d;
  --border: #30363d;
  --border-strong: #484f58;
  --text: #e6edf3;
  --text-mid: #c9d1d9;
  --text-muted: #8b949e;
  --text-faint: #6e7681;
  --blue: #58a6ff;
  --blue-strong: #1f6feb;
  --green: #2ea043;
  --green-strong: #238636;
  --red: #ff7b72;
  --focus: rgba(88, 166, 255, 0.32);
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --page-max: 1440px;
  --gutter: clamp(16px, 3vw, 48px);
  --radius: 4px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text-mid);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
}

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

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.topbar,
.page-shell,
.footer {
  width: min(100%, var(--page-max));
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--green);
}

.language-switch {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-control);
}

.language-option {
  min-width: 42px;
  min-height: 32px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.language-option:last-child {
  border-right: 0;
}

.language-option:hover,
.language-option:focus-visible,
.language-option.is-active {
  background: var(--surface-hover);
  color: var(--text);
  outline: none;
}

.page-shell {
  padding-top: 34px;
  padding-bottom: 52px;
}

.intro {
  padding-bottom: 26px;
}

.intro h1 {
  color: var(--text);
  font-size: 31px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0;
}

.lead {
  max-width: none;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 15px;
}

.brief-form,
.after-type {
  display: grid;
  gap: 16px;
}

.form-section,
.submit-panel {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.form-section {
  padding: clamp(20px, 2vw, 30px);
}

.section-heading {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.section-number,
.field label,
.field legend,
.button,
.form-status,
.footer {
  font-family: var(--font-mono);
}

.section-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--blue);
  font-size: 24px;
  font-weight: 650;
  line-height: 1;
}

.section-heading > div {
  display: flex;
  min-height: 44px;
  flex-direction: column;
  justify-content: center;
}

.section-heading h2 {
  color: var(--text);
  font-size: 22px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: 0;
}

.section-heading p {
  max-width: 860px;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px 20px;
  align-items: start;
}

.span-6 {
  grid-column: span 6;
}

.span-12 {
  grid-column: span 12;
}

.field {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field label,
.field legend {
  min-height: 18px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

input,
select,
textarea,
.select-trigger {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-control);
  color: var(--text);
  outline: none;
}

input,
.select-trigger {
  height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 132px;
  padding: 10px 12px;
  resize: vertical;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

input::placeholder,
textarea::placeholder {
  color: #565f6a;
}

input:hover,
select:hover,
textarea:hover,
.select-trigger:hover,
.option:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus,
.select-trigger:focus-visible,
.option:focus-within,
.button:focus-visible,
.telegram-link:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus);
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select,
.field.has-error .select-trigger {
  border-color: var(--red);
}

.field-error {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
}

.native-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.select-control {
  position: relative;
}

.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
}

.select-trigger::after {
  width: 7px;
  height: 7px;
  content: "";
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.9;
}

.select-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(320px, 50vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #161b22;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
}

.select-option {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text-mid);
  cursor: pointer;
  text-align: left;
}

.select-option:hover,
.select-option:focus-visible,
.select-option.is-selected {
  background: var(--surface-hover);
  color: var(--text);
  outline: none;
}

.select-option.is-placeholder {
  color: var(--text-muted);
}

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

.option {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-control);
  color: var(--text-mid);
  cursor: pointer;
}

.option input {
  flex: 0 0 auto;
  width: 15px;
  min-height: 15px;
  margin: 0;
  accent-color: var(--blue-strong);
}

.option span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.submit-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 16px;
  align-items: center;
  padding: 20px clamp(20px, 2vw, 30px);
}

.submit-actions {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.button {
  min-height: 40px;
  border-radius: var(--radius);
  padding: 0 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.button:active {
  transform: translateY(1px);
}

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

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

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

.button.secondary:hover {
  border-color: var(--border-strong);
  background: #30363d;
}

.form-status {
  grid-column: 1 / -1;
  min-height: 20px;
  color: var(--text-muted);
  font-size: 12px;
}

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

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

.footer {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

.telegram-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-mid);
}

.telegram-link:hover {
  border-color: var(--border);
  background: var(--surface);
  color: var(--blue);
}

.telegram-icon {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

@media (max-width: 900px) {
  .span-6 {
    grid-column: span 12;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 62px;
  }

  .page-shell {
    padding-top: 26px;
    padding-bottom: 40px;
  }

  .intro h1 {
    font-size: 26px;
  }

  .section-heading {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
  }

  .section-number {
    font-size: 20px;
  }

  .section-heading h2 {
    font-size: 20px;
  }

  .form-section,
  .submit-panel {
    padding: 18px;
  }

  .option-grid,
  .submit-panel {
    grid-template-columns: 1fr;
  }

  .submit-actions {
    grid-column: 1;
    width: 100%;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .footer {
    padding-top: 18px;
    padding-bottom: 18px;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 440px) {
  .brand {
    gap: 8px;
    font-size: 12px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }
}

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