:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, 0.82);
  --text: #161617;
  --muted: #6e6e73;
  --line: #d9d9de;
  --accent: #2f7d55;
  --accent-dark: #1f5f3f;
  --danger: #c9342f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.10);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 14%, rgba(47, 125, 85, 0.16), transparent 28%),
    radial-gradient(circle at 88% 0%, rgba(255, 191, 73, 0.14), transparent 30%),
    var(--bg);
}

.shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 28px 20px;
}

.protocol-gate {
  display: none;
}

.https-mode .protocol-gate {
  display: block;
  max-width: 620px;
  margin: 70px auto;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}

.https-mode .hero,
.https-mode .panel {
  display: none;
}

.protocol-gate h1 {
  margin-top: 26px;
  font-size: clamp(34px, 6vw, 56px);
}

.protocol-gate p {
  margin: 0 auto 24px;
  max-width: 460px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.protocol-gate a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.hero {
  max-width: 720px;
  margin: 0 auto 26px;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.mark {
  width: 12px;
  height: 20px;
  display: inline-block;
  background: var(--accent);
  clip-path: polygon(36% 0, 94% 0, 63% 42%, 100% 42%, 28% 100%, 46% 56%, 0 56%);
}

h1 {
  margin: 18px 0 10px;
  font-size: clamp(36px, 5.6vw, 64px);
  line-height: 1;
  letter-spacing: 0;
}

.hero p {
  margin: 0 auto;
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.panel {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.panel-header {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.step-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 16px;
  background: #e6f1eb;
  color: var(--accent);
  font-size: 24px;
  box-shadow: inset 0 0 0 1px rgba(47, 125, 85, 0.08);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: 28px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e7eb;
}

.progress span {
  display: block;
  width: 16.66%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #8fb36f);
  transition: width 220ms ease;
}

.step {
  display: none;
  min-height: 230px;
}

.step.active {
  display: grid;
  gap: 16px;
  align-content: start;
}

.instruction {
  display: flex;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.instruction.success {
  border-color: rgba(47, 125, 85, 0.28);
  background: #f2faf5;
}

.instruction h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.instruction p,
.hint,
.field-note,
.status {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.full-width {
  width: 100%;
}

.setup-steps {
  display: grid;
  gap: 12px;
}

.settings-menu {
  display: grid;
  gap: 12px;
}

.menu-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 5px;
  min-height: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  color: var(--text);
  text-align: left;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.menu-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #e8f3ed;
  color: var(--accent);
  font-size: 20px;
  font-weight: 900;
}

.menu-card strong {
  font-size: 20px;
}

.menu-card small {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.menu-card:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 125, 85, 0.36);
  background: #f8fcf9;
}

.section-intro {
  padding: 2px 2px 6px;
}

.section-intro h3 {
  margin: 0 0 5px;
  font-size: 22px;
}

.section-intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.setup-steps div {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 700;
}

.setup-steps strong {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: rgba(47, 125, 85, 0.12);
  color: var(--accent);
}

.setup-steps b {
  color: var(--text);
}

.button-note {
  margin: 14px 2px 0;
  padding: 12px 14px;
  border: 1px solid rgba(47, 125, 85, 0.14);
  border-radius: 16px;
  background: rgba(47, 125, 85, 0.06);
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.numbered-form-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.numbered-form-step > strong {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: rgba(47, 125, 85, 0.12);
  color: var(--accent);
}

.numbered-form-step label {
  margin: 0 0 12px;
}

.numbered-form-step button {
  width: 100%;
}

.compact-status {
  margin-top: -6px;
}

.field-note {
  margin-top: -8px;
  font-size: 15px;
}

.help {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.help summary {
  cursor: pointer;
  font-weight: 800;
}

.help ol {
  margin: 12px 0 8px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.help p {
  margin: 0;
  color: var(--muted);
}

.icon.power {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #e6f1eb;
  position: relative;
}

.icon.power::after {
  content: "";
  position: absolute;
  inset: 8px 11px;
  background: var(--accent);
  clip-path: polygon(36% 0, 94% 0, 63% 42%, 100% 42%, 28% 100%, 46% 56%, 0 56%);
}

label {
  display: grid;
  gap: 8px;
  color: #303033;
  font-size: 14px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  outline: none;
}

select {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 17px;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 125, 85, 0.12);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 54px;
}

.icon-button {
  position: absolute;
  top: 26px;
  right: 8px;
  width: 40px;
  min-width: 0;
  height: 40px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  transform: translateY(-50%);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button[aria-pressed="true"] svg {
  stroke: var(--accent);
}

.icon-button:hover {
  background: rgba(47, 125, 85, 0.08);
  transform: translateY(-50%);
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-actions .status {
  flex: 1 1 220px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-group {
  display: grid;
  gap: 10px;
}

.field-title {
  margin: 0;
  font-weight: 800;
  color: var(--text);
}

.check {
  grid-template-columns: 20px 1fr;
  align-items: center;
  font-weight: 600;
}

.check input {
  min-height: auto;
  width: 18px;
  height: 18px;
}

.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice.two .radio-card {
  min-height: 76px;
}

.radio-card {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  cursor: pointer;
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 125, 85, 0.12);
}

.radio-card input {
  min-height: auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.radio-card strong,
.radio-card small {
  display: block;
}

.radio-card small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
}

button {
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.button-link {
  min-height: 50px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

button.secondary:hover {
  background: #f0f0f2;
}

button.link-button {
  min-height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

button.link-button:hover {
  background: transparent;
  color: var(--accent-dark);
}

.text-link {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fallback-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 12px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.fallback-details {
  margin-top: 12px;
  color: var(--muted);
  font-weight: 700;
}

.fallback-details summary {
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.fallback-details p {
  margin: 10px 0 0;
  color: var(--muted);
}

.status.ok {
  color: var(--accent);
  font-weight: 700;
}

.status.error {
  color: var(--danger);
  font-weight: 700;
}

.success-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 34px 22px;
  text-align: center;
}

.success-badge {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 36px;
  font-weight: 900;
  box-shadow: 0 18px 36px rgba(47, 125, 85, 0.22);
}

.success-card h3 {
  margin: 0;
  font-size: 26px;
}

.success-card p {
  margin: 0;
  max-width: 440px;
  color: var(--muted);
  line-height: 1.45;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(22, 22, 23, 0.38);
  backdrop-filter: blur(12px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 28px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: rgba(201, 52, 47, 0.10);
  color: var(--danger);
  font-size: 26px;
  font-weight: 900;
}

.modal-card h3 {
  margin: 0;
  font-size: 26px;
}

.modal-card p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}

.modal-card button {
  margin-top: 6px;
  min-width: 140px;
}

@media (max-width: 620px) {
  .shell {
    padding: 20px 14px;
  }

  .hero {
    margin-bottom: 18px;
  }

  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .grid,
  .actions {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column-reverse;
  }

  button {
    width: 100%;
  }

  .inline-actions {
    display: grid;
  }

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