:root {
  --gold: #fed840;
  --gold-hover: #fa0;
  --gold-dim: rgba(254, 216, 64, 0.15);
  --bg: #141414;
  --surface: #1c1c1c;
  --surface2: #242424;
  --border: #2a2a2a;
  --border2: #333;
  --text: #f0f0f0;
  --text-muted: #777;
  --text-dim: #3a3a3a;
  --green: #3ddc84;
  --red: #ff5f57;
  --cyan: #22d3ee;
  --orange: #ff9f0a;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, PingFang SC, SF Pro Text, Helvetica Neue, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}

ul,
ol {
  list-style: none;
}

.page-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
}

main {
  flex: 1;
}

.header {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  height: 54px;
  padding: 0 14px;
  background: rgba(14, 14, 14, 0.96);
  border-bottom: 1px solid var(--border);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-logo {
  flex-shrink: 0;
  width: auto;
  height: 26px;
  object-fit: contain;
}

.header-notice {
  flex: 1;
  overflow: hidden;
  color: var(--cyan);
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hamburger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 5px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  transition: background 0.15s;
}

.hamburger:active {
  background: var(--surface2);
}

.hamburger-line {
  width: 18px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  transform-origin: center;
  transition: all 0.25s ease;
}

.hamburger.is-open .hamburger-line:first-child {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.is-open .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger.is-open .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  width: 230px;
  padding-top: 54px;
  background: #0f0f0f;
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  color: #aaa;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  transition: all 0.18s;
}

.drawer-nav a:hover,
.drawer-nav a:active {
  padding-left: 26px;
  color: #fff;
  background: var(--surface);
}

.drawer-nav .nav-dot {
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  background: var(--gold);
  border-radius: 50%;
}

.content-area {
  padding-top: 54px;
}

.carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.carousel-track {
  display: flex;
  will-change: transform;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
}

.carousel-slide img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  z-index: 10;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}

.carousel-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-dot.active {
  width: 18px;
  background: var(--gold);
}

.notice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.notice-bar-icon {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  object-fit: contain;
}

.notice-bar-text {
  color: #888;
  font-size: 11px;
  line-height: 1.4;
}

.notice-bar-text strong {
  color: var(--gold);
  font-weight: 600;
}

.speed-panel {
  margin: 10px 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.speed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.speed-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-indicator {
  width: 7px;
  height: 7px;
  background: var(--border2);
  border-radius: 50%;
  transition: all 0.3s;
}

.speed-indicator.active {
  background: var(--green);
  box-shadow: 0 0 8px rgba(61, 220, 132, 0.6);
  animation: glow-pulse 1.4s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(61, 220, 132, 0.4);
  }

  50% {
    box-shadow: 0 0 14px rgba(61, 220, 132, 0.9);
  }
}

.speed-title {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.speed-status {
  color: var(--text-dim);
  font-size: 11px;
}

.site-list {
  padding: 2px 0;
}

.site-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(42, 42, 42, 0.5);
  transition: background 0.15s;
  animation: row-in 0.3s ease both;
}

.site-row:last-child {
  border-bottom: none;
}

.site-row:active {
  background: var(--surface2);
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.site-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.site-url {
  flex: 1;
  overflow: hidden;
  color: var(--text);
  font-family: SF Mono, Fira Code, ui-monospace, monospace;
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-bars {
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
  gap: 2px;
  height: 14px;
}

.signal-bar {
  width: 3px;
  background: var(--border2);
  border-radius: 1.5px;
  transition: background 0.4s ease;
}

.signal-bar:first-child {
  height: 4px;
}

.signal-bar:nth-child(2) {
  height: 7px;
}

.signal-bar:nth-child(3) {
  height: 10px;
}

.signal-bar:nth-child(4) {
  height: 14px;
}

.signal-bars.level-4 .signal-bar,
.signal-bars.level-3 .signal-bar:not(:nth-child(4)) {
  background: var(--green);
}

.signal-bars.level-2 .signal-bar:not(:nth-child(3)):not(:nth-child(4)) {
  background: var(--orange);
}

.signal-bars.level-1 .signal-bar:first-child {
  background: var(--red);
}

.site-ping {
  width: 48px;
  flex-shrink: 0;
  color: var(--text-dim);
  font-family: SF Mono, Fira Code, ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  transition: color 0.4s;
}

.ping-idle {
  color: var(--text-dim);
}

.ping-testing {
  color: #555;
  animation: blink 0.9s ease-in-out infinite;
}

.ping-fast {
  color: var(--green);
}

.ping-ok {
  color: var(--gold);
}

.ping-slow {
  color: var(--orange);
}

.ping-dead {
  color: var(--red);
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.25;
  }
}

.btn-open {
  flex-shrink: 0;
  padding: 5px 12px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--gold-dim);
  border: 1px solid rgba(254, 216, 64, 0.25);
  border-radius: 7px;
  transition: all 0.18s;
}

.btn-open:hover,
.btn-open:active {
  color: #111;
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.05);
}

.refresh-wrap {
  display: flex;
  justify-content: center;
  padding: 12px 16px 16px;
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 30px;
  color: #111;
  font-size: 13px;
  font-weight: 700;
  background: var(--gold);
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(254, 216, 64, 0.25);
  transition: all 0.2s;
}

.btn-refresh:hover {
  background: var(--gold-hover);
  box-shadow: 0 6px 24px rgba(255, 170, 0, 0.35);
  transform: translateY(-1px);
}

.btn-refresh:active {
  transform: scale(0.97);
}

.btn-refresh svg {
  transition: transform 0.5s ease;
}

.btn-refresh.spinning svg {
  animation: spin 0.6s ease;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

.footer {
  padding: 22px 16px 30px;
  text-align: center;
  background: #0a0a0a;
  border-top: 1px solid var(--border);
}

.footer-cert {
  margin-bottom: 14px;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.9;
}

.footer-img {
  max-width: 160px;
  margin: 0 auto;
  opacity: 0.4;
  filter: grayscale(40%);
}

@media (min-width: 480px) {
  body {
    background: #0a0a0a;
  }

  .page-wrapper {
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.7);
  }
}
