:root {
  color-scheme: dark;
  --bg: #050914;
  --surface: #0b1424;
  --surface-soft: #111e31;
  --surface-strong: #17263d;
  --border: rgba(125, 215, 255, 0.22);
  --border-strong: rgba(125, 215, 255, 0.44);
  --text: #eef7ff;
  --muted: #98aac2;
  --cyan: #28d7ff;
  --blue: #4794ff;
  --green: #55df9c;
  --amber: #ffd166;
  --red: #ff6b7a;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(40, 215, 255, 0.08), transparent 34%),
    linear-gradient(225deg, rgba(85, 223, 156, 0.08), transparent 30%),
    radial-gradient(circle at center top, rgba(71, 148, 255, 0.12), transparent 40%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 18px 0;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-icon {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 18px rgba(40, 215, 255, 0.42));
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.install-panel {
  display: grid;
  justify-items: end;
  gap: 8px;
  max-width: 360px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 30, 49, 0.94), rgba(9, 17, 30, 0.96));
  box-shadow: var(--shadow);
  padding: 18px;
  animation: riseIn 360ms ease both;
}

.result-card,
.info-card {
  grid-column: 1 / -1;
}

.card-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.step {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--cyan);
  background: rgba(40, 215, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 800;
}

.card-description,
.info-card p {
  color: var(--muted);
  line-height: 1.55;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field label {
  display: flex;
  align-items: center;
  min-height: 34px;
  gap: 8px;
  color: #d9e9f7;
  font-size: 0.93rem;
  font-weight: 700;
  line-height: 1.25;
}

.field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(152, 170, 194, 0.22);
  border-radius: var(--radius);
  outline: none;
  padding: 0 12px;
  color: var(--text);
  background: #07111f;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(40, 215, 255, 0.15);
}

.help-button {
  display: inline-grid;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--cyan);
  background: rgba(40, 215, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 900;
}

.example-chip {
  display: inline-flex;
  align-items: center;
  margin-top: 14px;
  border: 1px solid rgba(85, 223, 156, 0.24);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: #ccffe7;
  background: rgba(85, 223, 156, 0.08);
  font-size: 0.88rem;
}

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

.segmented-control label,
.radio-stack label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(152, 170, 194, 0.22);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(7, 17, 31, 0.9);
  cursor: pointer;
}

.segmented-control input,
.radio-stack input {
  accent-color: var(--cyan);
}

.segmented-control label:has(input:checked),
.radio-stack label:has(input:checked) {
  border-color: var(--cyan);
  color: var(--text);
  background: rgba(40, 215, 255, 0.1);
}

.manual-options {
  margin-top: 16px;
}

.radio-stack {
  display: grid;
  gap: 8px;
}

.status-list {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(152, 170, 194, 0.12);
  padding-bottom: 8px;
}

.status-list dt {
  color: var(--muted);
}

.status-list dd {
  margin: 0;
  color: var(--text);
  font-weight: 800;
  text-align: right;
}

.message-box,
.warning-box,
.formula-box,
.tip-band {
  border-radius: var(--radius);
  padding: 12px;
}

.message-box {
  margin-bottom: 0;
  color: #d8edff;
  background: rgba(71, 148, 255, 0.1);
  line-height: 1.5;
}

.warning-box {
  margin: 12px 0 0;
  border: 1px solid rgba(255, 209, 102, 0.3);
  color: #ffe8a3;
  background: rgba(255, 209, 102, 0.1);
  line-height: 1.5;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(40, 215, 255, 0.2);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(7, 17, 31, 0.75);
}

.metric span {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric strong {
  color: var(--cyan);
  font-size: 2rem;
}

.final-result {
  margin: 16px 0;
  border: 1px solid rgba(85, 223, 156, 0.26);
  border-radius: var(--radius);
  padding: 18px;
  color: #eafff4;
  background: linear-gradient(90deg, rgba(85, 223, 156, 0.14), rgba(40, 215, 255, 0.1));
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1.25;
}

.formula-box {
  margin-bottom: 16px;
  color: #d8edff;
  background: rgba(7, 17, 31, 0.86);
  line-height: 1.65;
}

.formula-line {
  display: block;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  padding: 0 15px;
  color: var(--text);
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #03101c;
}

.secondary-button,
.ghost-button {
  border: 1px solid var(--border-strong);
  background: rgba(40, 215, 255, 0.08);
}

.danger-button {
  border: 1px solid rgba(255, 107, 122, 0.35);
  background: rgba(255, 107, 122, 0.12);
}

.copy-feedback {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--green);
  font-weight: 700;
}

.tip-band {
  margin-top: 16px;
  border: 1px solid rgba(255, 209, 102, 0.24);
  background: rgba(255, 209, 102, 0.08);
}

.tip-band p {
  margin-bottom: 0;
  color: #ffecc0;
}

.help-modal {
  width: min(460px, calc(100% - 32px));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.help-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.modal-content {
  position: relative;
  padding: 22px;
}

.modal-content p {
  color: var(--muted);
  line-height: 1.55;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  min-height: 36px;
  color: var(--muted);
  background: transparent;
  font-size: 1.4rem;
}

.help-example {
  display: grid;
  gap: 4px;
  margin: 16px 0;
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(40, 215, 255, 0.08);
}

.help-example span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.help-example strong {
  color: var(--cyan);
  font-size: 1.2rem;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 840px) {
  .app-shell {
    width: min(100% - 24px, 720px);
    padding-top: 18px;
  }

  .hero,
  .layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .install-panel {
    justify-items: start;
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .field-grid,
  .result-grid,
  .segmented-control {
    grid-template-columns: 1fr;
  }

  .brand-icon {
    width: 52px;
    height: 52px;
  }

  h1 {
    font-size: 1.55rem;
  }

  .card {
    padding: 14px;
  }

  .status-list div {
    display: grid;
  }

  .status-list dd {
    text-align: left;
  }

  .final-result {
    font-size: 1.25rem;
  }

  .metric strong {
    font-size: 1.55rem;
  }

  .action-bar > button {
    flex: 1 1 100%;
  }
}
