:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #182338;
  background: #f4f7fb;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 90% 0%, #e1eeff 0, transparent 32%), #f4f7fb; }
.page { width: min(100% - 32px, 720px); margin: 0 auto; padding: 34px 0 28px; }
.hero { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.hero-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; color: #fff; font-size: 28px; background: linear-gradient(135deg, #247cff, #64b4ff); box-shadow: 0 12px 24px #247cff35; }
.eyebrow { margin: 0 0 3px; color: #6c7b93; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(28px, 7vw, 40px); letter-spacing: -.04em; }
.subtitle { margin: 5px 0 0; color: #6c7b93; font-size: 15px; }
.settings-list { display: grid; gap: 14px; }
.setting-card { padding: 18px; border: 1px solid #e4eaf2; border-radius: 20px; background: #fff; box-shadow: 0 8px 24px #24344d0c; }
.setting-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.setting-title { margin: 0; font-size: 17px; font-weight: 700; }
.setting-description { margin: 6px 0 16px; color: #8290a5; font-size: 13px; line-height: 1.4; }
.number-control { display: flex; align-items: center; gap: 10px; }
.stepper { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border: 0; border-radius: 12px; color: #247cff; background: #edf5ff; font-size: 24px; cursor: pointer; }
.stepper:active { transform: scale(.96); }
input[type=number] { width: 100%; min-width: 0; height: 42px; border: 1px solid #dce4ef; border-radius: 12px; outline: none; padding: 0 12px; color: #182338; background: #f9fbfd; font: inherit; font-size: 17px; font-weight: 700; text-align: center; }
input[type=number]:focus { border-color: #247cff; box-shadow: 0 0 0 3px #247cff1c; }
input[type=number].invalid { border-color: #e05260; background: #fff6f6; }
.range-label { margin-top: 9px; color: #a1adbd; font-size: 11px; }
.status { margin: -8px 0 16px; padding: 12px 14px; border-radius: 12px; color: #245a37; background: #e9f8ed; font-size: 14px; }
.status.error { color: #8a2e36; background: #fff0f0; }
.actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; margin-top: 22px; }
.validate-button { min-height: 54px; padding: 12px 14px; border: 1px solid #cfe0f7; border-radius: 16px; color: #247cff; background: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.validate-button:disabled { opacity: .55; cursor: wait; }
.save-button { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 16px 18px; border: 0; border-radius: 16px; color: #fff; background: #247cff; box-shadow: 0 10px 20px #247cff35; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.save-button:disabled { opacity: .55; cursor: wait; }
.save-arrow { font-size: 23px; line-height: 1; }
.footer-note { margin: 14px 8px 0; color: #9aa7b8; font-size: 12px; line-height: 1.4; text-align: center; }
@media (max-width: 420px) { .page { width: min(100% - 24px, 720px); padding-top: 24px; } .hero { margin-bottom: 22px; } .hero-icon { width: 48px; height: 48px; font-size: 23px; } .actions { grid-template-columns: 1fr; } }

.profile-panel { margin-bottom: 16px; padding: 16px 18px; border: 1px solid #dce8f7; border-radius: 18px; background: #eef6ff; }
.field-label { display: block; margin-bottom: 7px; color: #6c7b93; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.profile-select { width: 100%; height: 42px; border: 1px solid #cbdcf2; border-radius: 12px; padding: 0 12px; color: #182338; background: #fff; font: inherit; font-weight: 700; }
.field-hint { margin: 7px 0 0; color: #8290a5; font-size: 12px; }
.setting-section { overflow: hidden; border: 1px solid #e4eaf2; border-radius: 20px; background: #fff; box-shadow: 0 8px 24px #24344d0c; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px 12px; border-bottom: 1px solid #edf1f6; cursor: pointer; list-style: none; }
.section-heading::-webkit-details-marker { display: none; }
.section-heading::after { content: '⌄'; flex: 0 0 auto; color: #247cff; font-size: 22px; line-height: 1; transform: rotate(-90deg); transition: transform .18s ease; }
.setting-section[open] > .section-heading::after { transform: rotate(0deg); }
.section-heading-text { min-width: 0; flex: 1; }
.section-heading h2 { margin: 0; font-size: 19px; }
.section-heading p { margin: 5px 0 0; color: #8290a5; font-size: 12px; line-height: 1.4; }
.section-body { padding: 4px 18px 18px; }
.range-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(220px, 1.1fr); align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid #eef2f6; }
.range-row:last-child { border-bottom: 0; }
.range-title { font-size: 14px; font-weight: 700; }
.range-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.range-controls > .setting-input { flex: 1; min-width: 0; }
.range-dash { color: #a1adbd; }
.setting-input, .text-input { width: 100%; min-width: 0; height: 40px; border: 1px solid #dce4ef; border-radius: 10px; outline: none; padding: 0 10px; color: #182338; background: #f9fbfd; font: inherit; font-size: 14px; }
.setting-input:focus, .text-input:focus, .profile-select:focus { border-color: #247cff; box-shadow: 0 0 0 3px #247cff1c; }
.text-row { display: block; padding: 13px 0; border-bottom: 1px solid #eef2f6; }
.text-row > span { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; }
.text-row small { display: block; margin-top: 5px; color: #9aa7b8; font-size: 11px; }
.text-input { display: block; }
textarea.text-input { height: auto; min-height: 72px; padding-top: 10px; resize: vertical; }
.toggle-row { display: flex; align-items: center; gap: 9px; padding: 13px 0; border-bottom: 1px solid #eef2f6; font-size: 14px; font-weight: 700; }
.toggle-row input { width: 18px; height: 18px; accent-color: #247cff; }
.map-editor { padding: 13px 0; border-bottom: 1px solid #eef2f6; }
.map-editor:last-child { border-bottom: 0; }
.map-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.map-heading h3 { margin: 0; font-size: 15px; }
.map-heading span { color: #9aa7b8; font-size: 11px; }
.map-row { display: grid; grid-template-columns: minmax(155px, .8fr) minmax(210px, 1fr) 28px; align-items: center; gap: 9px; margin: 7px 0; }
.map-key { display: flex; align-items: center; gap: 7px; min-width: 0; color: #36445a; font-size: 13px; font-weight: 600; }
.map-key > span { overflow: hidden; text-overflow: ellipsis; }
.line-input { max-width: 100px; }
.map-key .line-input { flex: 0 1 100px; }
.map-key > span:last-child { color: #9aa7b8; font-size: 11px; font-weight: 400; }
.remove-row { width: 28px; height: 28px; border: 0; border-radius: 8px; color: #d15360; background: #fff0f0; font-size: 20px; line-height: 1; cursor: pointer; }
.add-row { margin-top: 7px; padding: 8px 10px; border: 1px dashed #b8d2f3; border-radius: 9px; color: #247cff; background: #f7fbff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.stats-rule-row { display: grid; grid-template-columns: 1.2fr 1.2fr .75fr minmax(120px, 1fr) 28px; align-items: center; gap: 7px; margin: 9px 0; }
.rule-select { width: 100%; min-width: 0; height: 38px; border: 1px solid #dce4ef; border-radius: 9px; padding: 0 8px; color: #182338; background: #f9fbfd; font: inherit; font-size: 12px; }
.rule-select:focus { border-color: #247cff; outline: none; box-shadow: 0 0 0 3px #247cff1c; }
.rule-select:disabled, .setting-input:disabled { opacity: .55; }
.rule-values { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rule-values .rule-value { min-width: 0; }
.between-label { color: #8290a5; font-size: 12px; }
.rule-value2[hidden], .between-label[hidden] { display: none; }
.rule-hint { margin: 10px 0 0; color: #9aa7b8; font-size: 11px; line-height: 1.4; }
.review-view { display: grid; gap: 14px; }
.review-view[hidden], #editor-view[hidden] { display: none; }
.review-header { display: flex; align-items: center; gap: 12px; margin-bottom: 2px; }
.review-header h2 { margin: 0; font-size: clamp(23px, 6vw, 30px); letter-spacing: -.03em; }
.back-button { flex: 0 0 auto; min-height: 38px; padding: 8px 11px; border: 1px solid #cfe0f7; border-radius: 11px; color: #247cff; background: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.back-button:active { transform: scale(.97); }
.review-profile { margin: -4px 0 2px; color: #8290a5; font-size: 13px; }
.review-content { display: grid; gap: 12px; }
.review-card { padding: 16px 18px; border: 1px solid #e4eaf2; border-radius: 18px; background: #fff; box-shadow: 0 8px 24px #24344d0c; }
.review-card h3 { margin: 0 0 8px; font-size: 17px; }
.review-line { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid #eef2f6; color: #526078; font-size: 13px; line-height: 1.4; }
.review-line:last-child { border-bottom: 0; }
.review-line-label { min-width: 0; }
.review-line strong { flex: 0 0 auto; color: #182338; font-size: 13px; text-align: right; }
.review-empty { margin: 0; color: #9aa7b8; font-size: 13px; font-style: italic; }
@media (max-width: 560px) { .range-row, .map-row { grid-template-columns: 1fr; gap: 8px; } .map-row { position: relative; padding-right: 35px; } .map-row .remove-row { position: absolute; right: 0; top: 3px; } .map-key { min-height: 30px; } }
@media (max-width: 640px) { .stats-rule-row { grid-template-columns: 1fr 1fr; padding-right: 35px; position: relative; } .stats-rule-row .rule-values { grid-column: 1 / -1; } .stats-rule-row .remove-row { position: absolute; right: 0; top: 4px; } }
