:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232d;
  --line: #2b3440;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #3fb950;
  --accent-2: #238636;
  --warn: #d29922;
  --danger: #da3633;
  --link: #58a6ff;
  --code: #0b0f14;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--link);
}

code,
pre,
.kv dd,
.log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-start;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3.5rem 1.25rem 1.5rem;
}

.hero h1 {
  margin: 0.2rem 0 0.6rem;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 700;
}

.lede {
  max-width: 60ch;
  color: var(--muted);
  margin: 0;
}

.hero-side {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-end;
  white-space: nowrap;
}

.badge {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  display: grid;
  gap: 1.25rem;
}

.flow {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

.controller-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.7rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.segmented {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.2rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.seg-tab {
  border: 0;
  border-radius: 6px;
  padding: 0.42rem 0.8rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.2;
  transition: none;
}

.seg-tab:hover:not(:disabled) {
  border-color: transparent;
  background: #26303c;
  color: var(--text);
}

.seg-tab[aria-selected="true"] {
  background: var(--accent-2);
  color: #fff;
  font-weight: 600;
}

.seg-tab.detected::before {
  content: "";
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  margin-right: 0.38rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.08em;
}

.seg-tab.detected[aria-selected="true"]::before {
  background: #fff;
}

#controller-detect {
  flex: 1;
  min-width: 15rem;
  margin: 0;
  font-size: 0.85rem;
}

.steps {
  display: grid;
  gap: 0.3rem;
  margin: 0.4rem 0 0.8rem;
  padding-left: 1.35rem;
  color: var(--text);
}

.steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

.field {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.field select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.42rem 0.55rem;
}

.label {
  margin: 0.75rem 0 0.15rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#gulikit-card h3 {
  margin-top: 1.3rem;
}

#gulikit-card h3 .step {
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0.75rem;
}

#gulikit-package {
  margin-top: 0.75rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

#gulikit-package-info {
  margin-bottom: 0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  scroll-margin-top: 1rem;
  min-width: 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.card h2 {
  font-size: 1.15rem;
  margin: 0;
}

.card h3 {
  font-size: 0.95rem;
  margin: 1.1rem 0 0.5rem;
  color: var(--text);
}

.step {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--accent-2);
  color: #fff;
  font-size: 0.85rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.6rem 0;
}

.row.wrap {
  flex-wrap: wrap;
}

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

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

.status.error {
  color: #ff7b72;
}

.status.busy,
.status.warn {
  color: var(--warn);
}

button,
.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}

button:hover:not(:disabled),
.button:hover {
  border-color: #4a5869;
  background: #222b37;
}

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

button.primary {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: #2ea043;
  border-color: #2ea043;
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 600;
}

button.danger:hover:not(:disabled) {
  background: #f85149;
  border-color: #f85149;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 46ch;
}

.check input {
  margin-top: 0.25rem;
  accent-color: var(--accent-2);
}

.test-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.test-panel > div:first-child {
  flex: 1 1 18rem;
}

.test-panel p {
  margin: 0.15rem 0 0;
  max-width: 58ch;
}

.test-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin: 0.9rem 0;
  font-size: 0.9rem;
}

.notice.warn {
  border-left-color: var(--warn);
}

.notice p:first-child {
  margin-top: 0;
}

.notice p:last-child {
  margin-bottom: 0;
}

.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.kv {
  display: grid;
  grid-template-columns: minmax(7.5rem, auto) 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0.4rem 0;
  font-size: 0.88rem;
}

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

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 0.5rem 0;
}

.table th,
.table td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table td.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table tr:last-child td {
  border-bottom: none;
}

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.72rem;
  border: 1px solid var(--line);
  color: var(--muted);
}

.tag.ok {
  color: var(--accent);
  border-color: rgba(63, 185, 80, 0.4);
}

.tag.warn {
  color: var(--warn);
  border-color: rgba(210, 153, 34, 0.4);
}

.tag.bad {
  color: #ff7b72;
  border-color: rgba(248, 81, 73, 0.4);
}

progress {
  width: 100%;
  height: 0.55rem;
  margin: 0.5rem 0;
  accent-color: var(--accent);
}

.log {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  max-height: 22rem;
  overflow: auto;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #b7c4d1;
  margin: 0.4rem 0 0;
  white-space: pre-wrap;
}

.log .t {
  color: #5b6b7c;
}

.log .ok {
  color: var(--accent);
}

.log .warn {
  color: var(--warn);
}

.log .err {
  color: #ff7b72;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.6rem 0;
  background: var(--panel-2);
}

summary {
  cursor: pointer;
  font-weight: 600;
}

details[open] summary {
  margin-bottom: 0.5rem;
}

.code {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
}

.tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-style: italic;
  cursor: help;
}

.tip:hover,
.tip:focus-visible {
  color: var(--text);
  border-color: var(--muted);
}

.tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: min(22rem, 80vw);
  background: #0b0f14;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  font-size: 0.8rem;
  line-height: 1.45;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.12s, transform 0.12s;
  z-index: 20;
}

.tip:hover::after,
.tip:focus-visible::after {
  opacity: 1;
  transform: none;
}

.spinner {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -0.1rem;
}

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

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

@media (max-width: 720px) {
  .hero {
    flex-direction: column;
    padding-top: 2rem;
  }

  .hero-side {
    align-items: flex-start;
  }

  .controller-bar {
    align-items: flex-start;
    border-radius: 10px;
  }

  .segmented {
    width: 100%;
  }

  .seg-tab {
    flex: 1;
    padding-inline: 0.5rem;
  }

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

  .kv dt {
    margin-top: 0.35rem;
  }
}
