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

:root {
  --primary: #da5806;
  --primary-g1: #933c00;
  --primary-g2: #ff7f27;
  --bg-base: #191c23;
  --bg-1: #212328;
  --bg-2: #2c2d33;
  --text-base: #fff;
  --text-1: rgba(255, 255, 255, 0.9);
  --text-2: rgba(255, 255, 255, 0.7);
  --text-3: rgba(255, 255, 255, 0.5);
  --text-4: rgba(255, 255, 255, 0.3);
  --border: rgba(255, 255, 255, 0.1);
  --latency-ok-bg: rgba(74, 222, 128, 0.15);
  --latency-ok-text: #4ade80;
  --latency-error-bg: rgba(248, 113, 113, 0.15);
  --latency-error-text: #f87171;
}

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

body {
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg-base);
  color: var(--text-base);
  -webkit-font-smoothing: antialiased;
}

.page {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg-base);
  padding-bottom: 100px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 16px;
  background: var(--bg-1);
}

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

.header-logo {
  height: 42px;
  width: auto;
  max-width: 110px;
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
}

.header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.header-title-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-title {
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary-g1), var(--primary-g2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.badge {
  font-size: 9px;
  padding: 2px 4px;
  border-radius: 2px;
  line-height: 1;
  color: #6a5104;
  background: linear-gradient(90deg, #f5d76e, #e8b923);
}

.header-domain {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.2;
  white-space: nowrap;
}

.header-kf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--primary);
  font-size: 12px;
  flex-shrink: 0;
  padding: 4px;
}

.header-kf svg {
  width: 24px;
  height: 24px;
}

/* Banner */
.banner {
  width: 100%;
  overflow: hidden;
  line-height: 0;
}

.banner img {
  width: 100%;
  height: auto;
  display: block;
}

/* Lines section */
.lines-section {
  padding: 12px 16px 0;
}

.lines-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  padding-top: 4px;
}

.lines-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  color: var(--text-1);
}

.lines-refresh {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
}

.lines-refresh:active {
  opacity: 0.7;
}

.lines-refresh.spinning svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.lines-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.line-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.line-url-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  font-size: 13px;
  min-width: 0;
}

.line-latency {
  flex-shrink: 0;
  width: 60px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: #1f2229;
}

.line-latency.latency-ok {
  color: var(--latency-ok-text);
  background: var(--latency-ok-bg);
}

.line-latency.latency-error {
  color: var(--latency-error-text);
  background: var(--latency-error-bg);
}

.line-latency.testing {
  color: var(--text-3);
  background: #1f2229;
}

.line-url {
  flex: 1;
  padding: 0 36px 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-1);
}

.line-copy {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
}

.line-copy:active {
  opacity: 0.6;
}

.line-enter {
  flex-shrink: 0;
  height: 32px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.line-enter:active {
  background: rgba(218, 88, 6, 0.1);
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  padding: 20px 16px;
  background: var(--bg-base);
}

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 12px;
  background: var(--bg-2);
  border-radius: 12px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.footer-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.footer-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-title {
  font-size: 15px;
  color: var(--text-1);
  line-height: 1;
}

.footer-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1;
}

.footer-download {
  flex-shrink: 0;
  height: 32px;
  padding: 0 16px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.footer-download:active {
  background: var(--primary-g1);
}

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@media screen and (min-width: 768px) {
  body {
    background: #111;
  }
}
