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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
}

.header-name { font-weight: 600; }

.logout {
  color: #666;
  text-decoration: none;
  font-size: 14px;
}
.logout:hover { color: #333; }

main {
  display: flex;
  justify-content: center;
  padding: 40px 16px;
}

/* Login */
.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 40px 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.login-box h1 {
  font-size: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.login-box form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-box input {
  padding: 12px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.login-box input:focus { border-color: #2481cc; }

.login-box button {
  padding: 12px;
  background: #2481cc;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.login-box button:hover { background: #1a6eb0; }

.divider {
  text-align: center;
  color: #999;
  font-size: 13px;
  margin: 16px 0;
  position: relative;
}
.divider::before, .divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: #e0e0e0;
}
.divider::before { left: 0; }
.divider::after { right: 0; }

#tg-login { display: flex; justify-content: center; }

.error {
  background: #fff0f0;
  border: 1px solid #ffcccc;
  color: #cc0000;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* Page */
.page {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.page h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

.back {
  display: inline-block;
  color: #2481cc;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 16px;
}
.back:hover { text-decoration: underline; }

/* Server list */
.server-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.server-link {
  display: block;
  padding: 14px 18px;
  background: #f7f9fc;
  border: 1px solid #e0e8f0;
  border-radius: 8px;
  text-decoration: none;
  color: #2481cc;
  font-weight: 500;
  transition: background 0.15s;
}
.server-link:hover { background: #eaf2fb; }

.empty { color: #999; font-size: 15px; }

/* Proxy links */
.primary-link {
  margin-bottom: 20px;
}

.proxy-btn {
  display: inline-block;
  padding: 12px 20px;
  background: #2481cc;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.2s;
}
.proxy-btn:hover { background: #1a6eb0; }
.proxy-btn.small { padding: 8px 14px; font-size: 13px; }

.link-text {
  margin-top: 8px;
  font-size: 12px;
  color: #999;
  word-break: break-all;
}

/* Extra links */
.extra-links {
  margin-top: 8px;
}

.extra-links summary {
  cursor: pointer;
  color: #2481cc;
  font-size: 14px;
  padding: 8px 0;
  user-select: none;
}

.extra-links ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 480px) {
  .page, .login-box { padding: 24px 16px; border-radius: 0; box-shadow: none; }
  main { padding: 0; }
  body { background: #fff; }
}
