:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #131b30;
  --line: #26324d;
  --text: #ecf1ff;
  --muted: #9aa8c4;
  --accent: #7c9cff;
  --green: #59d6a2;
  --red: #ff8794;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 15% 0%, #192748 0, transparent 40%), var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, Segoe UI, sans-serif;
}

main { width: min(960px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 56px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -0.01em; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }

.eyebrow { margin-top: 34px; color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }

h1 { margin: 8px 0; font-size: clamp(30px, 5vw, 44px); letter-spacing: -0.04em; }

.intro, .hint, .count { color: var(--muted); }

.panel {
  margin-top: 28px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(22, 32, 54, 0.98), rgba(15, 22, 39, 0.96));
  box-shadow: 0 20px 60px #03071455;
}

h2 { margin: 0 0 18px; font-size: 18px; }

form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }

label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }

input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0c1324;
  color: var(--text);
  font: inherit;
}

input:focus { outline: 2px solid #7c9cff70; border-color: var(--accent); }

button, .button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #1a2741;
  color: var(--text);
  font: 600 14px system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

button.primary { background: var(--accent); border-color: var(--accent); color: #081127; }

button.ghost { min-height: 34px; padding: 6px 12px; background: transparent; }

button.danger { min-height: 34px; padding: 6px 10px; color: #ffb0b8; background: transparent; }

button:disabled { opacity: 0.55; cursor: wait; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 12px; }

.toolbar h2 { margin: 0; }

.routes { display: grid; gap: 10px; }

.route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0f1729;
}

.domain { font-weight: 700; overflow-wrap: anywhere; }

.upstream { margin-top: 3px; color: var(--muted); font: 13px ui-monospace, monospace; overflow-wrap: anywhere; }

.empty { padding: 22px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; }

#notice { min-height: 24px; margin: 12px 0 0; color: var(--green); }

#notice.error { color: var(--red); }

.hint { margin: 18px 0 0; font-size: 13px; }

.login-wrap { width: min(420px, calc(100% - 32px)); margin: 0 auto; padding-top: 12vh; }

.login-wrap h1 { font-size: 32px; }

.login-wrap form { grid-template-columns: 1fr; margin-top: 22px; }

.login-wrap .hint { margin-top: 16px; }

@media (max-width: 680px) {
  main { padding-top: 24px; }
  form { grid-template-columns: 1fr; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .route { align-items: flex-start; }
  .panel { padding: 18px; }
  .login-wrap { padding-top: 8vh; }
}
