:root {
  --text: #e7ebf3;
  --muted: #9aa4b2;
  --border: #273041;
  --gateway-title: #294b73;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, #122, #0b0c0f 60%) no-repeat fixed;
  transition: background .22s ease;
}

body.gateway-background {
  background: #fff;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.page {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 12px 0;
}

.page.theme-page {
  padding-top: 18px;
}

.app-main {
  padding: 15px 12px 0;
}

.gateway-card {
  display: grid;
  gap: 16px;
  padding: 20px 18px 8px;
  border: 1px solid #ececec;
  background: #fff;
  color: #111;
}

.gateway-title {
  margin: 0;
  color: var(--gateway-title);
  font-size: 34px;
  line-height: 1.35;
  font-weight: 800;
  text-align: center;
}

.gateway-text {
  margin: 0;
  color: #9a9a9a;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.countdown-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 8px 0 4px;
}

.countdown-ring {
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  border: 3px solid rgba(88, 213, 132, .4);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(88, 213, 132, .18), rgba(61, 150, 97, .08));
  box-shadow: 0 0 20px rgba(88, 213, 132, .14), inset 0 0 18px rgba(88, 213, 132, .1);
}

.countdown-number {
  display: block;
  color: #78f0aa;
  font-size: 40px;
  line-height: 1;
  font-weight: 800;
  text-align: center;
}

.countdown-unit {
  display: block;
  margin-top: 12px;
  color: #8a98a8;
  font-size: 13px;
  text-align: center;
}

.countdown-status {
  color: #d8f8e2;
  font-size: 14px;
}

.ready-tip {
  padding: 0 0 2px;
  color: #8f8f8f;
  font-size: 13px;
  text-align: center;
}

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

.line-card {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 0;
  border-radius: 6px;
  background: #1fb319;
  color: #fff;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}

.line-card:hover {
  background: #18a814;
  transform: translateY(-1px);
}

.line-name {
  flex: 1;
  color: #fff;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
  text-align: center;
}

.line-speed {
  flex: 0 0 auto;
  margin-left: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.quick-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 18px;
  margin-top: 4px;
}

.quick-nav-link {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #2e4a6b;
  text-decoration: none;
}

.quick-nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  object-fit: contain;
}

.quick-nav-text {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
}

.browser-section {
  display: grid;
  gap: 14px;
  margin-top: 8px;
  padding-top: 12px;
}

.browser-divider {
  height: 1px;
  background: #d8d8d8;
}

.browser-title {
  color: #9a9a9a;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

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

.browser-item {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.browser-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.browser-name {
  color: #111;
  font-size: 13px;
  font-weight: 700;
}

.support-footer {
  display: grid;
  gap: 6px;
  padding: 26px 8px 18px;
  color: #8f8f8f;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.theme-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(135deg, #2a2f3a, #141922);
  text-decoration: none;
}

.theme-hero img {
  display: block;
  width: 100%;
  max-width: 408px;
  max-height: 48px;
  object-fit: contain;
}

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

.theme-card {
  min-height: 113px;
  display: grid;
  grid-template-rows: 64px auto;
  align-items: center;
  justify-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #151a24, #0f1420);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.theme-card:active {
  transform: translateY(1px);
}

.theme-img-wrap {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-card img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.theme-name {
  color: #ffd447;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  -webkit-text-stroke: .6px #3aa0ff;
  paint-order: stroke fill;
  text-shadow: 0 1px 0 #3aa0ff, 1px 0 0 #3aa0ff, -1px 0 0 #3aa0ff, 0 -1px 0 #3aa0ff;
}

.toast {
  position: fixed;
  left: 50%;
  top: 70px;
  z-index: 20;
  display: none;
  max-width: min(86vw, 360px);
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 6px;
  background: rgba(17, 24, 39, .92);
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.toast.show {
  display: block;
}

@media (max-width: 540px) {
  .page {
    max-width: 100%;
    padding-right: 8px;
    padding-left: 8px;
  }

  .gateway-card {
    padding: 18px 12px 6px;
  }

  .gateway-title {
    font-size: 28px;
  }

  .line-card {
    padding-right: 10px;
    padding-left: 10px;
  }

  .line-name {
    font-size: 14px;
  }

  .line-speed {
    margin-left: 8px;
    font-size: 13px;
  }

  .quick-nav-grid {
    gap: 12px 14px;
  }

  .quick-nav-text {
    font-size: 14px;
  }

  .browser-grid {
    gap: 16px 8px;
  }

  .browser-icon {
    width: 42px;
    height: 42px;
  }

  .theme-grid {
    gap: 10px;
  }

  .theme-card {
    min-height: 113px;
  }

  .theme-img-wrap {
    height: 58px;
  }
}
