:root {
  color-scheme: light;
  --paper: #f4f1ea;
  --surface: #fffdf8;
  --ink: #171612;
  --muted: #706a5d;
  --line: #d8d0c2;
  --line-strong: #9b917f;
  --green: #197149;
  --green-ink: #0d4a30;
  --amber: #c37b20;
  --red: #b73d2f;
  --blue: #1d5d91;
  --shadow: 0 18px 45px rgba(23, 22, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 22, 18, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 22, 18, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.mast {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 64px);
  line-height: 0.96;
  font-weight: 900;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
}

.panel-head p,
.hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

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

.span-5 {
  grid-column: span 5;
}

.span-7 {
  grid-column: span 7;
}

.span-12 {
  grid-column: span 12;
}

.panel {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head.flat {
  margin-bottom: 14px;
}

.step-index {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  color: var(--surface);
  background: var(--ink);
  font-weight: 900;
}

.step-index.done {
  color: var(--surface);
  background: var(--green);
  border-color: var(--green);
}

.status-pill {
  min-width: 148px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #efe3c8;
  padding: 9px 13px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.status-pill.ok {
  color: var(--green-ink);
  background: #dcefe4;
  border-color: var(--green);
}

.status-pill.bad {
  color: var(--red);
  background: #f7ddd8;
  border-color: var(--red);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span,
.mini-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  background: #fffaf0;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 93, 145, 0.16);
}

input[readonly] {
  background: #efe8d8;
}

textarea {
  min-height: 98px;
  resize: vertical;
}

button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0 15px;
  color: var(--ink);
  background: #fffaf0;
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:hover,
.link-button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

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

button:disabled:hover {
  transform: none;
  box-shadow: none;
}

.primary {
  width: 100%;
  background: var(--green);
  color: #fffdf8;
}

.primary.deploy {
  margin: 16px 0;
  min-height: 54px;
  font-size: 15px;
}

.secondary {
  background: #efe3c8;
}

.icon-button {
  width: 45px;
  flex: 0 0 auto;
  padding: 0;
  background: #efe3c8;
  font-size: 22px;
}

.icon-button.text-icon {
  font-size: 14px;
}

.inline-action {
  display: flex;
  gap: 8px;
}

.row {
  display: grid;
  gap: 12px;
}

.row.two {
  grid-template-columns: 1fr 1fr;
}

.row.compact {
  gap: 10px;
}

.subdomain-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 95px;
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  background: #f7f0e1;
  padding: 14px;
}

.subdomain-actions {
  display: flex;
  width: min(370px, 100%);
  gap: 8px;
}

.subdomain-actions input {
  min-width: 0;
}

.strong {
  margin-top: 5px;
  font-weight: 900;
}

.mono {
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 10px;
}

.summary-grid div {
  border: 2px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  padding: 13px;
  min-width: 0;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 7px;
}

.summary-grid strong {
  display: block;
  min-height: 18px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.log {
  min-height: 190px;
  max-height: 300px;
  overflow: auto;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #181713;
  color: #e9f5dc;
  padding: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}

#vlessUrl {
  min-height: 132px;
}

#alternateUrls {
  min-height: 96px;
}

.probe-list {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.probe-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fffaf0;
  font-size: 12px;
}

.probe-row.ok {
  border-color: rgba(25, 113, 73, 0.55);
}

.probe-row.bad {
  border-color: rgba(183, 61, 47, 0.5);
  color: var(--muted);
}

.probe-row span {
  text-align: right;
  overflow-wrap: anywhere;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.subscription-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.subscription-bar .field {
  margin-bottom: 0;
}

.nodes-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.node-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffaf0;
}

.node-row.disabled {
  opacity: 0.58;
}

.node-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.node-main strong {
  font-size: 15px;
}

.node-main span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.node-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.node-actions button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 12px;
}

.danger {
  color: var(--red);
  border-color: var(--red);
}

.empty-state {
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.qr-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #f7f0e1;
  padding: 14px;
}

#qrTarget svg {
  display: block;
  width: 236px;
  height: 236px;
  background: #fff;
}

.centered {
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  .span-5,
  .span-7,
  .span-12 {
    grid-column: 1 / -1;
  }

  .summary-grid,
  .subscription-bar,
  .node-row,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .node-actions {
    justify-content: stretch;
  }

  .node-actions button {
    flex: 1;
  }

  .mast {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .panel {
    padding: 14px;
  }

  .row.two,
  .subdomain-box,
  .subdomain-actions,
  .subscription-bar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    font-size: 34px;
  }
}
