:root {
  --bg: #f4f2ee;
  --personal-photo-width: 220px;
  --personal-columns-gap: 30px;
  --panel: rgba(255, 255, 255, 0.9);
  --line: #ddd8cf;
  --line-strong: #cbc4b7;
  --text: #2f312d;
  --muted: #7c7a73;
  --accent: #6f7b72;
  --danger: #b05050;
  --success: #4f7a59;
  --shadow: 0 24px 54px rgba(52, 52, 48, 0.12), 0 10px 22px rgba(52, 52, 48, 0.06);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --page-width: 820px;
  --field-height: 44px;
  --pad-x: 15px;
  --font-ui: Inter, "Segoe UI", Roboto, Arial, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.9), rgba(255,255,255,0) 38%),
    linear-gradient(180deg, #f1eee9 0%, #f6f3ef 40%, #f3f0eb 100%);
  line-height: 1.45;
}
.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 28px 16px 52px;
}
.hero {
  padding: 4px 2px 14px;
  text-align: center;
}
h1 {
  margin: 0;
  font-size: clamp(23px, 3.5vw, 28px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 640;
  color: #43483f;
}
form {
  display: grid;
  gap: 18px;
}
.section-card,
.result-card {
  border: 1px solid rgba(221, 216, 207, 0.92);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.section-head {
  padding: 22px 24px 18px;
}
.section-head h2 {
  margin: 0;
  padding-left: var(--pad-x);
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(221, 216, 207, 0.95);
  font-size: 14px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  color: #60655d;
}
.section-body {
  padding: 8px 24px 18px;
}

#personal .section-body {
  padding-top: 12px;
  padding-bottom: 12px;
}
.fields-grid,
.repeat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}
.field,
.field-full {
  display: grid;
  gap: 4px;
  min-width: 0;
  align-content: start;
}
.field-full { grid-column: 1 / -1; }
label {
  padding-left: var(--pad-x);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 620;
  color: var(--text);
}
input[type="text"],
select,
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.96);
  color: var(--text);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
  outline: none;
}
input[type="text"],
select {
  height: var(--field-height);
  min-height: var(--field-height);
  padding: 0 var(--pad-x);
}
textarea {
  min-height: 188px;
  padding: 14px var(--pad-x);
  resize: vertical;
}

.photo-subsection {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
}

.personal-intro {
  position: relative;
  display: grid;
  grid-template-columns: var(--personal-photo-width) minmax(0, 1fr);
  column-gap: var(--personal-columns-gap);
  row-gap: 12px;
  align-items: start;
  margin-bottom: 4px;
}

.personal-intro::after {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: calc(var(--personal-photo-width) + (var(--personal-columns-gap) / 2));
  width: 1px;
  background: rgba(221, 216, 207, 0.96);
}
.personal-name-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-width: 0;
}

.personal-name-grid .under-input-check {
  min-height: 16px;
  margin-top: -1px;
}
.personal-rest-grid {
  margin-top: 0;
}
.photo-subsection {
  justify-self: start;
  align-self: start;
  width: 100%;
}
.photo-field {
  width: 100%;
  max-width: var(--personal-photo-width);
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 6px;
  align-content: start;
}
.photo-upload-card {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 0;
  height: auto;
  padding: 10px;
  border: 1px solid #c7bfaf;
  border-radius: 10px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 10px 24px rgba(52, 52, 48, 0.08);
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .16s ease;
}
.photo-upload-card:hover,
.photo-upload-card:focus-visible {
  border-color: #aa9c86;
  box-shadow: 0 14px 28px rgba(52, 52, 48, 0.11);
  background: #fff;
  outline: none;
}
.has-error .photo-upload-card {
  border-color: rgba(176, 80, 80, 0.82);
  box-shadow: 0 0 0 4px rgba(176, 80, 80, 0.10);
}
.photo-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 9px;
  background: linear-gradient(180deg, #f6f2ec 0%, #f0ebe4 100%);
}
.photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.btn-photo {
  width: 100%;
  align-self: start;
}
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 46px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23807b73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
}
input::placeholder,
textarea::placeholder { color: #a09a8d; }
input:focus,
select:focus,
textarea:focus {
  border-color: #a8ab9e;
  box-shadow: 0 0 0 4px rgba(168, 171, 158, 0.16);
  background: #fff;
}
input[disabled],
textarea[disabled],
select[disabled] {
  background: #efede8;
  color: #8b887f;
  cursor: not-allowed;
}
.under-input-check {
  min-height: 16px;
  display: flex;
  align-items: center;
  margin-top: 0;
}
.under-input-check--wide {
  min-height: 20px;
  margin-top: 4px;
}
.plain-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 20px;
  padding: 2px var(--pad-x);
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 580;
  color: #68665f;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.plain-check input {
  margin: 0;
  inline-size: 16px;
  block-size: 16px;
  accent-color: #7d877f;
}
.plain-check--wide {
  width: 100%;
  min-height: 26px;
}
.error-text {
  min-height: 4px;
  padding-left: var(--pad-x);
  font-size: 12px;
  line-height: 1.3;
  color: var(--danger);
}
.field-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 14px;
}
.char-counter {
  flex: 0 0 auto;
  min-width: 84px;
  text-align: right;
  font-size: 12px;
  line-height: 1.4;
  color: var(--success);
}
.char-counter.is-limit { color: var(--danger); }
.has-error input,
.has-error select,
.has-error textarea {
  border-color: rgba(176, 80, 80, 0.82);
  box-shadow: 0 0 0 4px rgba(176, 80, 80, 0.10);
}
.radio-toggle {
  display: grid;
  grid-template-columns: repeat(2, 112px);
  gap: 8px;
  align-items: center;
  justify-content: start;
  min-height: var(--field-height);
}
.toggle-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 112px;
  min-height: var(--field-height);
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #c7bfaf;
  background: #f8f5ef;
  box-shadow: 0 8px 18px rgba(52, 52, 48, 0.07);
  font-size: 14px;
  font-weight: 620;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  text-align: center;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.toggle-item input {
  margin: 0;
  inline-size: 16px;
  block-size: 16px;
  accent-color: #7d877f;
}
.conditional { display: none; }
.conditional.is-visible { display: contents; }
.repeat-list {
  display: grid;
  gap: 12px;
}
.repeat-item {
  border: 1px solid rgba(221, 216, 207, 0.95);
  border-radius: 12px;
  background: rgba(251, 250, 247, 0.9);
  box-shadow: 0 16px 30px rgba(52, 52, 48, 0.08);
  padding: 16px;
  display: grid;
  gap: 12px;
}
.repeat-head,
.repeat-actions,
.form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.repeat-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #6f756c;
  text-transform: uppercase;
}
.repeat-actions {
  margin-top: 10px;
}
.section-error {
  min-height: 0;
  padding-top: 6px;
}
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: var(--field-height);
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
}
.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  outline: none;
}
.btn-primary {
  background: #6f7b72;
  color: #fff;
  box-shadow: 0 10px 20px rgba(111, 123, 114, 0.18);
}
.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: #c7bfaf;
  box-shadow: 0 10px 22px rgba(52, 52, 48, 0.07);
}
.btn-ghost {
  background: #f1ece4;
  color: #4f584f;
  border-color: #c8bead;
  box-shadow: 0 10px 22px rgba(52, 52, 48, 0.07);
}
.btn-danger {
  background: #fff9f9;
  color: var(--danger);
  border-color: #ebcfcf;
}
.btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--field-height);
}
.btn-wide {
  width: 100%;
}
.toggle-block-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--field-height);
  padding: 0 16px;
  margin-bottom: 10px;
  border: 1px solid #c8bead;
  border-radius: 10px;
  background: #f1ece4;
  box-shadow: 0 10px 22px rgba(52, 52, 48, 0.07);
  color: #4f584f;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
}
.toggle-block-btn input {
  margin: 0;
  inline-size: 16px;
  block-size: 16px;
  accent-color: #7d877f;
}
.toggle-block-btn.is-active {
  background: #e7dfd2;
  border-color: #a99b85;
  box-shadow: 0 14px 28px rgba(52, 52, 48, 0.10);
}
.plain-check:hover,
.plain-check:focus-within {
  background: rgba(241, 236, 228, 0.78);
  color: #4f584f;
}
.toggle-item:hover,
.toggle-item:focus-within,
.toggle-block-btn:hover,
.toggle-block-btn:focus-within,
.btn-secondary:hover,
.btn-secondary:focus-visible,
.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: #aa9c86;
  box-shadow: 0 14px 28px rgba(52, 52, 48, 0.11);
}
.toggle-item:has(input:checked) {
  background: #e7dfd2;
  border-color: #a99b85;
  box-shadow: 0 14px 28px rgba(52, 52, 48, 0.10);
}
.is-disabled {
  opacity: .56;
}
.is-hidden {
  display: none !important;
}
.form-footer {
  justify-content: flex-start;
  padding-top: 2px;
}
.result-card { display: none; }
.result-card.is-visible { display: block; }
pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: #333530;
}
@media (max-width: 760px) {
  .personal-intro {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 0;
  }
  .personal-intro::after {
    display: none;
  }
  .photo-subsection {
    justify-self: center;
    min-height: auto;
    width: 100%;
  }
  .personal-name-grid {
    gap: 8px;
  }
  .page {
    padding-inline: 12px;
    padding-bottom: 34px;
  }
  .section-head,
  .section-body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .photo-field {
    max-width: 100%;
    min-height: auto;
  }
  .photo-upload-card {
    height: auto;
  }
  .photo-frame {
    aspect-ratio: 3 / 4;
    height: auto;
    min-height: 0;
  }
  .fields-grid,
  .repeat-grid {
    grid-template-columns: 1fr;
  }
  .radio-toggle {
    grid-template-columns: repeat(2, minmax(0, 112px));
  }
  .form-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .form-footer .btn {
    width: 100%;
  }
}
