:root {
  --bg: #0a1628;
  --surface: #111f38;
  --surface-soft: rgba(255, 255, 255, 0.03);
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --error: #f87171;
  --success: #4ade80;
  --warning: #fbbf24;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(37, 99, 235, 0.25), transparent),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

main.centered {
  text-align: center;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.site-nav-brand {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.site-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.site-nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav-links a:hover,
.site-nav-links a.active {
  color: var(--text);
}

.logo {
  width: 112px;
  height: 112px;
  margin: 0 auto 1.25rem;
  border-radius: 26px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.lead,
.tagline {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 1.75rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card p {
  color: var(--muted);
  font-size: 0.975rem;
}

.card p + p {
  margin-top: 1rem;
}

.card.left {
  text-align: left;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.125rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.tool-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.tool-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.tool-card-desc {
  font-size: 0.875rem;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.actions .btn,
form .btn {
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s, transform 0.15s;
}

a.btn,
button.btn {
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

a.btn-primary,
a.btn-primary:visited {
  color: #fff;
}

button.btn:active:not(:disabled),
a.btn-primary:active {
  transform: none;
  background: var(--accent-hover);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.04);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}

footer {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.callout {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 1rem 1.125rem;
  margin-bottom: 1rem;
  text-align: left;
}

.callout strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.callout p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}

.callout p + p {
  margin-top: 0.5rem;
}

.callout-warning {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.35);
}

.callout-warning strong {
  color: #fde68a;
}

.download-help {
  margin-top: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
}

.download-help strong {
  color: var(--text);
}

.download-help-main {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.download-help-main strong {
  display: inline;
}

.download-backup {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}

.download-backup strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
}

.download-backup p {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.85rem;
}

.btn-small {
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
}

.download-help-note {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  color: var(--accent);
}

.download-help-note[hidden] {
  display: none;
}

.download-help code {
  font-size: 0.85em;
  color: var(--text);
}

.callout-detail {
  font-size: 0.85rem !important;
}

.server-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.server-item {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.875rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.server-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.25rem;
}

.server-flag {
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
}

.server-country {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.server-address-box {
  display: flex;
  align-items: baseline;
  max-width: 100%;
  padding: 0.625rem 0.75rem;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.server-address-box::-webkit-scrollbar {
  height: 4px;
}

.server-address-box::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 4px;
}

.server-host,
.server-port {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  white-space: nowrap;
}

.server-host {
  color: var(--text);
}

.server-port {
  color: var(--muted);
  flex-shrink: 0;
}

.copy-btn {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.copy-btn.copied {
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.35);
}

.status-text {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 0.5rem 0;
}

.status-text.error {
  color: var(--error);
}

@media (max-width: 520px) {
  main {
    padding: 1.5rem 1rem 3rem;
  }

  .logo {
    width: 96px;
    height: 96px;
    border-radius: 22px;
  }

  h1 {
    font-size: 1.65rem;
  }

  .lead,
  .tagline {
    font-size: 0.975rem;
  }

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

  .btn {
    padding: 0.8rem 1.25rem;
    font-size: 0.95rem;
  }
}
