:root {
  --bg-dark: #0a0a0f;
  --text-primary: #f5f5f7;
  --text-secondary: rgba(245, 245, 247, 0.72);
  --text-muted: rgba(245, 245, 247, 0.42);
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.22);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.12);
  --accent: #7dd3fc;
  --accent-soft: rgba(125, 211, 252, 0.18);
  --radius: 22px;
  --radius-sm: 16px;
  --font-cn: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-en: "Inter", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] {
  --bg-dark: #e8eef5;
  --text-primary: #0f172a;
  --text-secondary: rgba(15, 23, 42, 0.72);
  --text-muted: rgba(15, 23, 42, 0.45);
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-highlight: rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255,255,255,0.8);
  --accent: #0284c7;
  --accent-soft: rgba(2, 132, 199, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-cn);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  transition: background 0.6s ease, color 0.5s ease;
}

.bg {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
  transition: opacity 1s ease, background 1.2s ease;
  opacity: 0;
}

.bg.loaded {
  opacity: 1;
}

.overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,8,14,0.45) 0%, rgba(8,8,14,0.72) 55%, rgba(8,8,14,0.88) 100%);
  z-index: 1;
  pointer-events: none;
  transition: background 0.6s ease;
}

[data-theme="light"] .overlay {
  background: linear-gradient(180deg, rgba(232,238,245,0.35) 0%, rgba(232,238,245,0.65) 55%, rgba(232,238,245,0.82) 100%);
}

.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.03;
  z-index: 2;
  pointer-events: none;
}

.container {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2.2rem 1.25rem calc(2.5rem + var(--safe-bottom));
  gap: 1.6rem;
  max-width: 920px;
  margin: 0 auto;
}

.header {
  text-align: center;
  padding-top: 0.5rem;
}

.logo {
  font-family: var(--font-en);
  font-size: clamp(2.6rem, 8.5vw, 4.6rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  background: linear-gradient(135deg, #fff 10%, var(--accent) 90%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

[data-theme="light"] .logo {
  background: linear-gradient(135deg, #0f172a 10%, var(--accent) 90%);
  -webkit-background-clip: text;
  background-clip: text;
}

.tagline {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero {
  width: 100%;
  max-width: 640px;
}

.quote-box {
  padding: 1.5rem 1.6rem;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.quote {
  font-size: clamp(1.05rem, 3.1vw, 1.35rem);
  font-weight: 400;
  line-height: 1.75;
  color: var(--text-primary);
  min-height: 2.8em;
  transition: opacity 0.4s ease;
}

.quote.updating {
  opacity: 0.3;
}

.quote-from {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 300;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  width: 100%;
  max-width: 720px;
}

.extra-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  width: 100%;
  max-width: 480px;
}

.card {
  padding: 1.15rem 0.9rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-height: 100px;
  justify-content: center;
}

.card-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 400;
}

.card-value {
  font-family: var(--font-en);
  font-size: 1.55rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.card-value.small {
  font-size: 1.1rem;
}

.card-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 300;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  transition: transform 0.35s cubic-bezier(0.22,1,0.36,1), background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
  position: relative;
  overflow: hidden;
}

.glass.liquid::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--glass-highlight) 0%, transparent 45%, transparent 55%, rgba(255,255,255,0.04) 100%);
  pointer-events: none;
  opacity: 0.7;
}

.glass.liquid::after {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-highlight), transparent);
  opacity: 0.6;
  pointer-events: none;
}

.glass:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 14px 40px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.18);
}

[data-theme="light"] .glass:hover {
  background: rgba(255,255,255,0.72);
}

.is-touch .glass:hover {
  transform: none;
}

.is-touch .glass:active {
  transform: scale(0.98);
  opacity: 0.92;
}

.live-section {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.live-title {
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.live-switch {
  display: flex;
  gap: 0.3rem;
  background: rgba(0,0,0,0.22);
  padding: 0.22rem;
  border-radius: 999px;
}

[data-theme="light"] .live-switch {
  background: rgba(0,0,0,0.06);
}

.switch-btn {
  font-family: var(--font-cn);
  font-size: 0.8rem;
  font-weight: 400;
  padding: 0.45rem 1.05rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.28s ease;
  white-space: nowrap;
  min-height: 36px;
}

.switch-btn:hover {
  color: var(--text-primary);
}

.switch-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  box-shadow: 0 2px 12px rgba(125,211,252,0.15);
}

.live-frame-wrap {
  position: relative;
  width: 100%;
  height: min(520px, 62vh);
  overflow: hidden;
  padding: 0;
  transition: opacity 0.35s ease, transform 0.35s ease, filter 0.35s ease;
}

.live-frame-wrap.switching {
  opacity: 0.35;
  transform: scale(0.985);
  filter: blur(2px);
}

.live-frame {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: #0c0c10;
  display: block;
}

.frame-loader {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  background: rgba(10,10,15,0.55);
  backdrop-filter: blur(8px);
  z-index: 5;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.frame-loader.show {
  display: flex;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.frame-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  background: rgba(10,10,15,0.78);
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem;
  z-index: 4;
}

.frame-fallback a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}

.frame-fallback.show {
  display: flex;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.3rem;
  padding-bottom: 0.5rem;
}

.link, .link-btn {
  font-family: var(--font-en);
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.03em;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0;
  transition: color 0.25s ease;
  position: relative;
}

.link::after, .link-btn::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.link:hover, .link-btn:hover {
  color: var(--accent);
}

.link:hover::after, .link-btn:hover::after {
  width: 100%;
}

.dot {
  color: var(--text-muted);
  font-size: 0.65rem;
}

.theme-toggle {
  position: fixed;
  top: max(1.1rem, env(safe-area-inset-top));
  right: 1.1rem;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease;
  font-size: 1.15rem;
  color: var(--text-primary);
  user-select: none;
  box-shadow: var(--glass-shadow);
}

.theme-toggle:hover {
  transform: scale(1.08);
  background: var(--accent-soft);
}

.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: inline; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 720px) {
  .info-grid {
    grid-template-columns: 1fr;
    max-width: 340px;
  }
  .extra-grid {
    grid-template-columns: 1fr 1fr;
    max-width: 340px;
  }
  .card {
    min-height: 88px;
    padding: 1rem 0.8rem;
  }
  .container {
    padding: 1.6rem 1rem calc(2rem + var(--safe-bottom));
    gap: 1.25rem;
  }
  .live-frame-wrap {
    height: min(420px, 55vh);
  }
  .live-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
  }
  .live-switch {
    width: 100%;
    justify-content: center;
  }
  .switch-btn {
    flex: 1;
    text-align: center;
    padding: 0.55rem 0.8rem;
    min-height: 42px;
  }
  .quote-box {
    padding: 1.25rem 1.2rem;
  }
  .theme-toggle {
    width: 42px;
    height: 42px;
    top: max(0.9rem, env(safe-area-inset-top));
    right: 0.9rem;
  }
}

@media (max-width: 380px) {
  .logo {
    font-size: 2.3rem;
  }
  .extra-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 721px) and (max-width: 900px) {
  .info-grid {
    max-width: 640px;
  }
}
