:root {
  --main-bg-color: url("/assets/background.jpg");
  --main-text-color: #eeeeee;
  --muted-text-color: rgba(255, 255, 255, 0.72);
  --gradient: linear-gradient(120deg, #bd34fe, #e0321b 34%, #41d1ff 68%);
  --item-bg-color: rgba(0, 0, 0, 0.34);
  --item-hover-color: rgba(30, 36, 44, 0.46);
  --line-color: rgba(255, 255, 255, 0.76);
  --line-dim-color: rgba(255, 255, 255, 0.22);
  --accent: #747bff;
  --accent-2: #41d1ff;
  --success: #aaffcd;
  --warning: #ffd08a;
  --danger: #ff9d9d;
  --card-filter: 15px;
  --back-filter: 18px;
  --back-filter-color: rgba(0, 0, 0, 0.34);
  --mono: "SF Mono", "Cascadia Mono", ui-monospace, monospace;
  --sans: "Ubuntu", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--main-text-color);
  background: var(--main-bg-color);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--back-filter-color);
  backdrop-filter: blur(var(--back-filter));
  -webkit-backdrop-filter: blur(var(--back-filter));
}

body.bg-clear::before {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

button,
input {
  font: inherit;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 34px));
  height: 100dvh;
  margin: 0 auto;
  padding: 14px 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 8px;
  flex: 0 0 auto;
}

.eyebrow,
.node-kicker {
  margin: 0 0 5px;
  color: var(--accent-2);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  width: fit-content;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  line-height: 1;
  letter-spacing: 0;
  background: var(--gradient);
  background-size: 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientMove 10s ease-in-out infinite;
}

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

p {
  line-height: 1.55;
}

.lead {
  max-width: 560px;
  margin: 6px 0 0;
  color: var(--muted-text-color);
  font-size: 0.82rem;
}

.sponsor {
  flex: 0 0 auto;
  padding: 0 0 8px;
  text-align: center;
}

.sponsor a {
  display: inline-block;
  width: fit-content;
  font-size: 1.08rem;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
  background: var(--gradient);
  background-size: 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientMove 10s ease-in-out infinite;
  text-decoration: none;
  transition: transform 0.22s ease, opacity 0.2s ease;
}

.sponsor a:hover {
  opacity: 0.86;
  transform: translateY(-2px);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.switch-btn {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  min-height: 26px;
  margin-top: 8px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--main-text-color);
  backdrop-filter: blur(var(--card-filter));
  -webkit-backdrop-filter: blur(var(--card-filter));
}

.switch-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: inherit;
  pointer-events: none;
}

.switch-btn span {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.26);
  transition: transform 0.22s ease, background 0.22s ease;
}

.switch-btn.is-on {
  background: rgba(65, 209, 255, 0.28);
}

.switch-btn.is-on span {
  transform: translateX(20px);
  background: #ffffff;
}

.status-pill {
  flex: 0 0 auto;
  margin-top: 8px;
  border-radius: 10px;
  background: var(--item-bg-color);
  backdrop-filter: blur(var(--card-filter));
  -webkit-backdrop-filter: blur(var(--card-filter));
  color: var(--main-text-color);
  padding: 7px 10px;
  font-size: 0.72rem;
  font-weight: 800;
}

button.status-pill {
  min-height: 32px;
  border: 0;
  cursor: pointer;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-panel {
  position: relative;
  width: min(420px, 100%);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.46);
  color: var(--main-text-color);
  padding: 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(var(--card-filter));
  -webkit-backdrop-filter: blur(var(--card-filter));
}

.modal.is-loading .modal-panel {
  display: grid;
  justify-items: center;
  text-align: center;
}

.modal-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: inherit;
  pointer-events: none;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--main-text-color);
  font-size: 1.2rem;
  line-height: 1;
}

.modal-spinner {
  display: none;
  width: 48px;
  height: 48px;
  margin: 4px 0 16px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent-2);
  animation: spin 0.82s linear infinite;
}

.modal.is-loading .modal-spinner {
  display: block;
}

.modal-title {
  margin: 0 36px 10px 0;
  font-size: 1.02rem;
  font-weight: 850;
}

.modal-message {
  margin: 0;
  color: var(--muted-text-color);
  overflow-wrap: anywhere;
}

.flow-board {
  --txt-w: 560px;
  --dns-w: 210px;
  --submit-w: 250px;
  --gap-12: 110px;
  --gap-23: 42px;
  --txt-shift: -36px;
  --dns-shift: -28px;
  --flow-total: calc(var(--txt-w) + var(--dns-w) + var(--submit-w) + var(--gap-12) + var(--gap-23));
  --row2-mid: calc(96px + 26px + ((100% - 122px) / 2));
  position: relative;
  display: grid;
  grid-template-columns: var(--txt-w) var(--gap-12) var(--dns-w) var(--gap-23) var(--submit-w);
  grid-template-rows: 96px minmax(220px, 1fr);
  column-gap: 0;
  row-gap: 26px;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  align-items: center;
}

.glass-card {
  position: relative;
  border-radius: 13px;
  background: var(--item-bg-color);
  backdrop-filter: blur(var(--card-filter));
  -webkit-backdrop-filter: blur(var(--card-filter));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.16);
}

.flow-node {
  padding: 18px 18px 17px;
}

.input-node.flow-node {
  padding: 12px 16px;
}

.input-node {
  grid-column: 1 / -1;
  grid-row: 1;
  z-index: 3;
  align-self: center;
  width: min(760px, 100%);
  justify-self: center;
  transform: translateY(26px);
}

.right-stack {
  display: contents;
}

.step-wrap {
  position: relative;
  grid-row: 2;
  z-index: 3;
  align-self: center;
  justify-self: center;
  overflow: visible;
}

.txt-wrap {
  grid-column: 1;
  width: var(--txt-w);
  transform: translateX(var(--txt-shift));
}

.dns-wrap {
  grid-column: 3;
  width: var(--dns-w);
  transform: translateX(var(--dns-shift));
}

.submit-wrap {
  grid-column: 5;
  width: var(--submit-w);
}

.txt-node,
.dns-node,
.submit-node {
  width: 100%;
}

.dns-node {
  display: grid;
  place-items: center;
  min-height: 96px;
}

.submit-node {
  display: grid;
  place-items: center;
  min-height: 96px;
}

.txt-node,
.dns-node,
.submit-node {
  opacity: 0;
  clip-path: inset(48% 48% 48% 48% round 13px);
}

.txt-node > *,
.dns-node > *,
.submit-node > * {
  opacity: 0;
}

.flow-node.is-shell {
  animation: cardShell 0.42s ease both;
}

.flow-node.is-content > * {
  animation: contentIn 0.38s ease both;
}

.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: inherit;
  pointer-events: none;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 7px;
}

label {
  color: var(--main-text-color);
  font-size: 0.94rem;
  font-weight: 800;
}

.field-head span,
.hint,
.section-title p {
  color: var(--muted-text-color);
  font-size: 0.88rem;
}

.hint {
  margin: 8px 0 0;
}

.domain-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 78px;
  gap: 10px;
}

input[type="text"] {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--main-text-color);
  font-size: 1rem;
  padding: 0 14px;
  outline: none;
}

input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.54);
}

input[type="text"]:focus {
  border-color: rgba(65, 209, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(65, 209, 255, 0.14);
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: rgba(116, 123, 255, 0.9);
  color: #fff;
  padding: 0 16px;
  font-size: 0.94rem;
  font-weight: 850;
  cursor: pointer;
  transition: width 0.3s ease, opacity 0.25s ease, transform 0.22s ease, background 0.2s ease;
}

button:hover:not(:disabled) {
  background: rgba(65, 209, 255, 0.9);
  transform: translateY(-2px);
}

button:active:not(:disabled) {
  transform: scale(0.96);
}

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

.secondary,
.linkish {
  background: rgba(255, 255, 255, 0.12);
  color: var(--main-text-color);
}

#btn-dns {
  min-width: 126px;
}

#btn-clear {
  padding: 0 12px;
}

.linkish {
  min-height: 30px;
  width: 54px;
  padding: 0;
  font-size: 0.82rem;
  white-space: nowrap;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-title p {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.step-no {
  display: grid;
  place-items: center;
  position: absolute;
  top: -18px;
  left: -18px;
  z-index: 4;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: var(--success);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(var(--card-filter));
  -webkit-backdrop-filter: blur(var(--card-filter));
  font-size: 0.95rem;
  font-weight: 900;
}

.kv {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 7px 10px;
  margin: 0;
}

.kv dt {
  color: var(--muted-text-color);
  font-size: 0.82rem;
  line-height: 30px;
}

.kv dd {
  display: block;
  align-items: center;
  min-width: 0;
  min-height: 30px;
  margin: 0;
}

.kv dd.copy-row {
  display: grid;
  grid-template-columns: minmax(0, max-content) 54px;
  align-items: center;
  justify-content: start;
  gap: 8px;
}

code {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.kv code {
  display: block;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  padding: 7px 10px;
  overflow-wrap: anywhere;
}

.flow-link {
  position: absolute;
  z-index: 2;
  opacity: 1;
  pointer-events: none;
}

.flow-link span {
  position: absolute;
  display: block;
  background: var(--line-color);
  box-shadow: 0 0 26px rgba(65, 209, 255, 0.38);
}

.flow-link span::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-top: 3px solid var(--line-color);
  border-right: 3px solid var(--line-color);
}

.link-right {
  left: calc((100% - var(--flow-total)) / 2 + var(--txt-w) + var(--txt-shift));
  top: calc(var(--row2-mid) - 10px);
  width: calc(var(--gap-12) + var(--dns-shift) - var(--txt-shift));
  height: 20px;
}

.link-right span {
  left: 0;
  top: 9px;
  width: 100%;
  height: 3px;
  transform-origin: left;
  transform: scaleX(0);
}

.link-right span::after {
  right: 0;
  top: -5px;
  transform: rotate(45deg);
}

.link-down {
  display: none;
}

.link-down span {
  left: 9px;
  top: 0;
  width: 3px;
  height: 100%;
  transform-origin: top;
  transform: scaleY(0);
}

.link-down span::after {
  left: -5px;
  bottom: 0;
  transform: rotate(135deg);
}

.link-left {
  left: calc((100% - var(--flow-total)) / 2 + var(--txt-w) + var(--gap-12) + var(--dns-w) + var(--dns-shift));
  top: calc(var(--row2-mid) - 10px);
  width: calc(var(--gap-23) - var(--dns-shift));
  height: 20px;
}

.link-left span {
  left: 0;
  top: 9px;
  width: 100%;
  height: 3px;
  transform-origin: left;
  transform: scaleX(0);
}

.link-left span::after {
  right: 0;
  top: -5px;
  transform: rotate(45deg);
}

.flow-board.line-right-active .link-right span {
  animation: growX 0.68s ease both;
}

.flow-board.line-down-active .link-down span {
  animation: growY 0.68s ease both;
}

.flow-board.line-left-active .link-left span {
  animation: growX 0.68s ease both;
}

.flow-board.line-right-done .link-right span,
.flow-board.line-down-done .link-down span,
.flow-board.line-left-done .link-left span {
  transform: scale(1);
}

@keyframes cardShell {
  0% {
    opacity: 0;
    clip-path: inset(48% 48% 48% 48% round 13px);
    transform: scale(0.98);
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    clip-path: inset(0 0 0 0 round 13px);
    transform: scale(1);
  }
}

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

@keyframes linkAppear {
  to {
    opacity: 1;
  }
}

@keyframes growX {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes growY {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes gradientMove {
  0% {
    background-position: 100%;
  }
  50% {
    background-position: 0%;
  }
  100% {
    background-position: 100%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  body {
    overflow-y: auto;
  }

  .wrap {
    height: auto;
    min-height: 100dvh;
  }

  .flow-board {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 18px;
    min-height: 0;
  }

  .input-node,
  .step-wrap {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
  }

  .right-stack {
    display: grid;
    gap: 18px;
  }

  .flow-link {
    display: none;
  }
}

@media (max-width: 680px) {
  .wrap {
    width: min(100% - 22px, 1180px);
    padding-top: 24px;
  }

  .topbar,
  .field-head,
  .domain-row {
    display: block;
  }

  .status-pill {
    display: inline-block;
    margin-top: 14px;
  }

  .field-head span {
    display: block;
    margin-top: 4px;
  }

  .domain-row button,
  #btn-dns,
  #btn-issue {
    width: 100%;
    margin-top: 10px;
  }

  .flow-node {
    padding: 18px;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .kv dt {
    line-height: 1.3;
    margin-top: 8px;
  }

  .kv dd {
    display: block;
  }

  .kv dd.copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
  }
}
