:root {
  --bg: #050505;
  --fg: #f6f6f4;
  --muted: #a4a4a4;
  --faint: #8a8a88;
  --line: rgba(246, 246, 244, 0.22);
  --line-soft: rgba(246, 246, 244, 0.12);
  --red: #ff6b5a;
  --amber: #f2b544;
  --max: 960px;
}

* { box-sizing: border-box; }

html {
  height: 100%;
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, p, ul, figure { margin: 0; }

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: var(--fg); }

::selection { background: var(--fg); color: var(--bg); }

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.shell {
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 0 20px;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 30;
  background: var(--fg);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
}

.skip:focus { top: 12px; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  min-height: 64px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

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

.hdr-right { margin-left: auto; flex-shrink: 0; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--fg);
  text-decoration: none;
  min-width: 0;
}

.mark { width: 28px; height: 25px; display: block; flex: none; }

.brand-name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.011em;
  white-space: nowrap;
}

.hdr-email {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.lang {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.lang button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.lang button:first-child { border-radius: 999px 0 0 999px; }

.lang button:last-child { border-radius: 0 999px 999px 0; }

.lang button:focus-visible { position: relative; z-index: 1; }

.lang button.is-on {
  background: rgba(246, 246, 244, 0.14);
  color: var(--fg);
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--fg);
  font-size: 14px;
}

.icon { width: 20px; height: 20px; display: block; flex: none; }

.main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  padding: 8px 0 20px;
  min-width: 0;
}

.login {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 0 28px;
}

.login-card { width: min(100%, 420px); }

.login-card h1 {
  font-size: clamp(28px, 6vw, 34px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  text-wrap: pretty;
}

.banner {
  margin-top: 16px;
  color: var(--red);
  font-size: 14px;
  line-height: 1.45;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.lbl { font-size: 13px; color: var(--muted); }

.field input {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0 14px;
  font-size: 16px;
}

.field input::placeholder { color: var(--faint); }

.code-input {
  text-align: center;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  font-size: 22px;
}

.sent { font-size: 14px; line-height: 1.5; }

.err {
  color: var(--red);
  font-size: 13px;
  line-height: 1.45;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
  line-height: 1;
}

.btn .icon { width: 16px; height: 16px; }

.btn-primary { background: var(--fg); color: var(--bg); }

.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line);
}

.btn:disabled { opacity: 0.45; cursor: default; }

.stack .btn { width: 100%; }

.btn-text {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(246, 246, 244, 0.35);
  text-underline-offset: 3px;
}

.btn-text:disabled {
  color: var(--faint);
  text-decoration: none;
  cursor: default;
}

.or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0;
}

.or::before,
.or::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.keep {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 14px;
  cursor: pointer;
}

.keep input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--fg);
}

.legal {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.legal a { color: var(--fg); }

.dash { padding-top: 28px; min-width: 0; }

.traffic {
  margin-bottom: 16px;
  min-width: 0;
  max-width: 100%;
  padding: 20px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
}

.card h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 14px;
}

.traffic-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.traffic-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--faint);
  margin: 0;
}

.traffic-status { font-size: 13px; color: var(--muted); }

.traffic-status.is-warn,
.traffic-status.is-overflow { color: var(--amber); }

.traffic-status.is-cut { color: var(--red); }

.traffic-figure {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.1em;
  margin-top: 10px;
}

.traffic-pct {
  font-size: clamp(56px, 14vw, 96px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.traffic-sign {
  color: var(--muted);
  font-size: clamp(20px, 3.5vw, 32px);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.traffic-word {
  margin-left: 0.35em;
  color: var(--muted);
  font-size: 15px;
}

.traffic-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.hero-figure {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15em 0.35em;
}

.hero-used {
  font-size: clamp(44px, 7.4vw, 72px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.hero-cap,
.hero-quiet {
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.bar {
  height: 10px;
  border-radius: 99px;
  background: rgba(246, 246, 244, 0.12);
  overflow: hidden;
}

.bar-fill {
  width: var(--p, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--fg);
  transition: width 300ms ease;
}

.bar.is-warn .bar-fill,
.bar.is-overflow .bar-fill { background: var(--amber); }

.bar.is-cut { background: rgba(255, 107, 90, 0.25); }

.bar.is-cut .bar-fill {
  width: 0;
  background: var(--red);
}

.traffic-bar { margin-top: 20px; }

.bar-thin {
  height: 4px;
  margin-top: 8px;
}

.traffic-stats {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.stat-label { color: var(--faint); font-size: 13px; }

.stat-value {
  font-size: 15px;
  overflow-wrap: anywhere;
  text-align: right;
}

.stat-rel {
  display: block;
  flex-basis: 100%;
  margin-top: 2px;
  color: var(--faint);
  font-size: 12px;
  text-align: right;
}

.traffic-rows { margin-top: 20px; }

.traffic-rows-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 4px;
}

.t-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.t-row { padding: 14px 0; min-width: 0; }

.t-row + .t-row { border-top: 1px solid var(--line-soft); }

.t-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.t-row-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  min-width: 0;
  margin: 0;
}

.t-row-title { font-size: 15px; }

.t-row-src { color: var(--faint); font-size: 13px; }

.t-row-left { flex: none; font-size: 14px; }

.t-row-line {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.t-row-hint {
  margin: 2px 0 0;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.5;
}

.quick {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.quick-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
}

.quick-card h2 {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

.quick-body {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.quick-email {
  margin-top: 10px;
  color: var(--fg);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.quick-card .actions {
  margin-top: auto;
  padding-top: 16px;
}

.quick-card .btn { width: 100%; }

.quick-packline {
  margin: auto 0 0;
  padding-top: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.quick-note {
  margin-top: 10px;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.quick-buy.is-warn { border-color: rgba(242, 181, 68, 0.35); }

.quick-buy.is-cut { border-color: rgba(255, 107, 90, 0.55); }

.pack-line,
.note,
.plan-status,
.usage-unknown {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.pack-line,
.note { margin-top: 12px; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.card {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 20px;
}

.plan-name {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.actions .btn { flex: 1 1 140px; }

.actions.col { flex-direction: column; }

.actions.col .btn { width: 100%; flex-basis: auto; }

.link-lead {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.link-meta {
  color: var(--faint);
  font-size: 13px;
  line-height: 1.45;
}

.link-meta + .link-lead { margin-top: 8px; }

.warn {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(246, 246, 244, 0.06);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.55;
  text-wrap: pretty;
}

.nowrap { white-space: nowrap; }

.fresh {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.fresh-copy { min-width: 0; }

.fresh-copy .link-url { margin-top: 0; }

.link-url {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(246, 246, 244, 0.03);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.qr-box {
  width: 200px;
  height: 200px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.qr-svg { width: 200px; height: 200px; display: block; }

.qr-fallback {
  margin: 0;
  padding: 16px;
  color: #050505;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.guides {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 4px;
}

.guide {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: 14px;
  text-decoration: none;
}

.devices {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dev {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}

.dev:first-child { border-top: 0; padding-top: 0; }

.dev-ico {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.dev-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.dev-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.dev-use,
.dev-kind,
.dev-meta,
.soon {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dev-use { flex: none; }

.soon { margin-top: 12px; }

.empty {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 0 36px;
}

.help-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.copyright {
  color: var(--faint);
  font-size: 12px;
}

.blocker {
  padding: 72px 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.skel-wrap { padding-top: 36px; }

.skel {
  border-radius: 8px;
  background: rgba(246, 246, 244, 0.08);
  animation: pulse 1.4s ease-in-out infinite;
}

.skel-kicker { width: 88px; height: 12px; margin-bottom: 18px; }
.skel-hero { width: min(280px, 62%); height: 64px; margin-bottom: 16px; }
.skel-line { width: min(420px, 88%); height: 14px; margin-bottom: 28px; }
.skel-card { height: 180px; border-radius: 16px; }

.toast {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 14px;
  text-align: center;
  transform: translateX(-50%);
}

.toast.show { display: block; animation: rise 200ms ease; }

dialog {
  width: min(420px, calc(100% - 32px));
  max-height: calc(100svh - 32px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0e0e0e;
  color: var(--fg);
}

dialog::backdrop { background: rgba(5, 5, 5, 0.72); }

dialog h2 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

dialog p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-wrap: pretty;
}

.dlg-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rise { animation: rise 200ms ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (hover: hover) {
  .btn-primary:hover { background: #fff; }
  .btn-ghost:hover { border-color: rgba(246, 246, 244, 0.45); }
  .btn-quiet:hover { background: rgba(246, 246, 244, 0.06); }
  .help-link:hover { color: var(--fg); }
  .guide:hover { text-decoration: underline; text-underline-offset: 3px; }
}

.btn:active { opacity: 0.82; }

@media (max-width: 720px) {
  .hdr-email { display: none; }
  .qr-box,
  .qr-svg { width: 168px; height: 168px; }
}

@media (min-width: 560px) {
  .traffic-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
  }
  .stat { display: block; padding: 0 16px; }
  .stat:first-child { padding-left: 0; }
  .stat + .stat { border-left: 1px solid var(--line-soft); }
  .stat:last-child { padding-right: 0; }
  .stat-value { text-align: left; }
  .stat-rel { text-align: left; }
}

@media (min-width: 800px) {
  .shell { padding: 0 32px; }
  .dash { padding-top: 40px; }
  .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid:has(.card.is-fresh) { grid-template-columns: minmax(0, 1fr); }
  .span-2,
  .card.is-fresh { grid-column: 1 / -1; }
  .traffic { padding: 28px; }
  .quick { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .quick-card .btn { width: auto; }
  .quick-card .actions .btn { flex: 0 0 auto; }
  .fresh {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 28px;
    align-items: start;
  }
}

@media (max-width: 400px) {
  .shell { padding: 0 16px; }
  .brand-name { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

:lang(zh-CN) {
  letter-spacing: 0;
}

:lang(zh-CN) .hero-used {
  letter-spacing: -0.04em;
}

:lang(zh-CN) .traffic-pct {
  letter-spacing: -0.02em;
}

:lang(zh-CN) .code-input {
  letter-spacing: 0.42em;
}

:lang(zh-CN) .brand-name {
  letter-spacing: -0.011em;
}

:lang(zh-CN) .login-card h1,
:lang(zh-CN) dialog h2 {
  letter-spacing: 0;
}
