:root {
  color-scheme: dark;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #111814;
}

/* Local preview: lightweight procedural background. */
.ambient-background {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 52% 42%, rgba(49, 90, 73, .28), transparent 34%),
    linear-gradient(150deg, #101b18 0%, #07100d 46%, #030806 100%);
  isolation: isolate;
}

.ambient-background::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    repeating-linear-gradient(112deg, transparent 0 72px, rgba(188, 230, 207, .012) 73px 74px),
    radial-gradient(ellipse at 50% 105%, rgba(95, 145, 118, .13), transparent 48%);
  animation: ambient-drift 22s ease-in-out infinite alternate;
}

.ambient-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 18%, rgba(1, 5, 3, .16) 62%, rgba(0, 3, 2, .62) 100%);
}

.ambient-orb {
  position: absolute;
  width: 72vmax;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: .72;
  will-change: transform;
}

.orb-one {
  top: -48vmax;
  left: -24vmax;
  background: radial-gradient(circle, rgba(98, 174, 139, .24) 0%, rgba(39, 96, 75, .11) 34%, transparent 69%);
  animation: orb-one 19s ease-in-out infinite alternate;
}

.orb-two {
  right: -42vmax;
  bottom: -38vmax;
  background: radial-gradient(circle, rgba(76, 128, 138, .2) 0%, rgba(26, 69, 68, .1) 38%, transparent 70%);
  animation: orb-two 24s ease-in-out infinite alternate;
}

.orb-three {
  top: 22%;
  left: 42%;
  width: 42vmax;
  background: radial-gradient(circle, rgba(170, 207, 181, .105) 0%, rgba(60, 109, 85, .06) 40%, transparent 72%);
  animation: orb-three 16s ease-in-out infinite alternate;
}

.ambient-glow {
  position: absolute;
  inset: auto 15% -22% 15%;
  height: 42%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(102, 159, 126, .12), transparent 68%);
  animation: glow-breathe 8s ease-in-out infinite;
}

.weather-canvas,
.fireworks-background {
  position: fixed;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border: 0;
}

.weather-canvas {
  opacity: .78;
  mix-blend-mode: screen;
}

.fireworks-background {
  color-scheme: dark;
  background: transparent;
  pointer-events: auto;
}

.sound-toggle {
  position: fixed;
  z-index: 6;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  color: rgba(255,255,255,.94);
  background: rgba(25,31,28,.48);
  box-shadow: 0 8px 26px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.08);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  cursor: pointer;
  transition: opacity .2s ease, transform .2s ease, background .2s ease;
  touch-action: manipulation;
}

.sound-toggle:active { transform: scale(.93); }
.sound-toggle:disabled { cursor: default; opacity: .38; }
.sound-toggle:not(.muted) { background: rgba(66,104,83,.58); }
.sound-icon { position: absolute; width: 21px; height: 21px; fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-icon-on { display: none; }
.sound-toggle:not(.muted) .sound-icon-off { display: none; }
.sound-toggle:not(.muted) .sound-icon-on { display: block; }

@keyframes ambient-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.05); }
}

@keyframes orb-one {
  from { transform: translate3d(-3%, -2%, 0) scale(.98); }
  to { transform: translate3d(14%, 11%, 0) scale(1.08); }
}

@keyframes orb-two {
  from { transform: translate3d(2%, 4%, 0) scale(1.04); }
  to { transform: translate3d(-14%, -10%, 0) scale(.96); }
}

@keyframes orb-three {
  from { transform: translate3d(-8%, 6%, 0) scale(.9); opacity: .45; }
  to { transform: translate3d(10%, -8%, 0) scale(1.12); opacity: .82; }
}

@keyframes glow-breathe {
  0%, 100% { transform: scale(.94); opacity: .55; }
  50% { transform: scale(1.08); opacity: .95; }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-background::before,
  .ambient-orb,
  .ambient-glow { animation: none !important; }
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; overflow: hidden; background: #111814; }
body { min-height: 100svh; }
body { touch-action: pan-x pan-y; }
button, a { -webkit-tap-highlight-color: transparent; }
.background-video, .shade, .grain { position: fixed; inset: 0; width: 100%; height: 100%; }
.background-video { z-index: 0; object-fit: cover; object-position: center; filter: saturate(.9) contrast(1.04); }
.shade {
  z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(7,12,10,.08), rgba(7,12,10,.25)), radial-gradient(circle at 50% 38%, transparent 20%, rgba(5,9,7,.16) 100%);
}
.grain {
  z-index: 3; pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}
.content { position: relative; z-index: 4; width: 100%; min-height: 100svh; pointer-events: none; }

.subscription-shell {
  position: fixed; top: 72%; left: 50%; width: min(340px, calc(100vw - 32px));
  transform: translate(-50%, -50%); pointer-events: auto;
}
.subscription-toggle, .subscription-menu, .modal-card {
  border: 1px solid rgba(255,255,255,.22);
  background: linear-gradient(145deg, rgba(255,255,255,.15), rgba(255,255,255,.07));
  box-shadow: 0 18px 55px rgba(0,0,0,.26), inset 0 1px 0 rgba(255,255,255,.15);
  -webkit-backdrop-filter: blur(22px) saturate(135%); backdrop-filter: blur(22px) saturate(135%);
}
.subscription-toggle {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 138px; height: 48px;
  margin: 0 auto; padding: 0 18px; border-radius: 999px; color: rgba(255,255,255,.94);
  font: inherit; font-size: 15px; letter-spacing: .12em; cursor: pointer;
  transition: transform .3s ease, background .3s ease, border-color .3s ease;
}
.subscription-toggle:hover { transform: translateY(-2px); background: linear-gradient(145deg, rgba(255,255,255,.2), rgba(255,255,255,.09)); border-color: rgba(255,255,255,.34); }
.subscription-toggle svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.subscription-shell.open .subscription-toggle svg { transform: rotate(180deg); }
.toggle-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(218,255,229,.95); box-shadow: 0 0 12px rgba(174,255,201,.9); }
.toggle-dot.off { background: rgba(255,190,193,.95); box-shadow: 0 0 12px rgba(255,132,139,.8); }
.toggle-dot.pending { background: rgba(255,232,174,.88); box-shadow: 0 0 10px rgba(255,209,102,.55); }

.subscription-menu {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: absolute;
  bottom: calc(100% + 12px); left: 0; width: 100%; max-height: 142px; padding: 10px; border-radius: 22px;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  opacity: 0; visibility: hidden; transform: translateY(16px) scale(.97); transform-origin: bottom center;
  transition: opacity .28s ease, transform .36s cubic-bezier(.2,.8,.2,1), visibility .28s;
}
.subscription-menu::-webkit-scrollbar { display: none; }
.subscription-shell.open .subscription-menu { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.subscription-item {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.1); border-radius: 15px; background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.94); font: inherit; font-size: 14px; text-align: left; text-decoration: none;
  cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.subscription-item:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); transform: translateY(-1px); }
.item-icon { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border-radius: 10px; background: rgba(255,255,255,.12); font-size: 15px; font-weight: 500; }
.item-icon.app-icon { overflow: hidden; padding: 0; background: rgba(255,255,255,.9); }
.item-icon.app-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.item-icon.qr-icon { background: #edf7ff; }
.item-icon.copy-icon { background: #eef1ff; }
.qr-symbol { display: grid; grid-template-columns: repeat(2, 6px); grid-template-rows: repeat(2, 6px); gap: 2px; }
.qr-symbol i { border: 1.7px solid #48a0e8; border-radius: 1px; }
.qr-symbol i:last-child { background: #48a0e8; }
.copy-symbol { position: relative; width: 13px; height: 16px; margin: 2px 0 0 3px; border: 1.7px solid #6677dc; border-radius: 2px; }
.copy-symbol::before { content: ""; position: absolute; width: 10px; height: 13px; left: -6px; top: -6px; border: 1.7px solid #6677dc; border-radius: 2px; opacity: .75; }

.server-panel {
  grid-column: 1 / -1; min-height: 142px; margin-top: 14px; padding: 14px; border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; background: rgba(255,255,255,.075); color: rgba(255,255,255,.94);
}
.server-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.server-title { display: flex; min-width: 0; align-items: center; gap: 7px; font-size: 13px; }
.server-title b { overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.server-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #58e28a; box-shadow: 0 0 10px rgba(88,226,138,.7); }
.server-dot.off { background: #ff6b70; box-shadow: 0 0 10px rgba(255,107,112,.65); }
.server-dot.pending { background: #ffd166; box-shadow: 0 0 10px rgba(255,209,102,.55); }
.server-uptime { flex: none; color: rgba(255,255,255,.58); font-size: 10px; font-variant-numeric: tabular-nums; }
.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.resource span { display: block; min-width: 0; }
.resource b, .resource em { display: block; overflow: hidden; font-size: 10px; font-style: normal; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.resource em { margin-top: 3px; color: rgba(255,255,255,.58); font-size: 9px; font-variant-numeric: tabular-nums; }
.resource > i { display: block; height: 4px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.12); }
.resource > i > u { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#63d98a,#9ae6b4); text-decoration: none; transition: width .5s ease; }
.server-load { margin: 12px 0 0; color: rgba(255,255,255,.48); font-size: 9px; font-variant-numeric: tabular-nums; }

.traffic-panel {
  grid-column: 1 / -1; min-height: 132px; padding: 14px; border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; background: rgba(255,255,255,.075); color: rgba(255,255,255,.94);
}
.traffic-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.traffic-header > span:first-child { display: flex; align-items: baseline; gap: 4px; }
.traffic-header b { font-size: 17px; font-weight: 550; }
.traffic-header em { color: rgba(255,255,255,.6); font-size: 10px; font-style: normal; }
.traffic-header > span:last-child { color: rgba(255,255,255,.58); font-size: 9px; }
.traffic-bar { height: 5px; margin-top: 14px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.13); }
.traffic-bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#65d98c,#b3e57e); transition: width .5s ease; }
.traffic-detail { display: flex; justify-content: space-between; gap: 10px; margin-top: 9px; color: rgba(255,255,255,.58); font-size: 9px; }
.traffic-detail b { color: rgba(255,255,255,.9); font-weight: 550; font-variant-numeric: tabular-nums; }
.traffic-today { margin: 13px 0 0; color: rgba(255,255,255,.5); font-size: 9px; }
.traffic-today b { color: rgba(255,255,255,.82); font-weight: 550; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; z-index: 8; bottom: max(28px, env(safe-area-inset-bottom)); left: 50%;
  padding: 10px 16px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px;
  background: rgba(14,20,17,.68); color: #fff; font-size: 13px; opacity: 0;
  transform: translate(-50%, 16px); transition: opacity .25s ease, transform .25s ease;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal { display: grid; position: fixed; z-index: 9; inset: 0; place-items: center; padding: 20px; background: rgba(4,8,6,.42); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s; }
.modal.show { opacity: 1; visibility: visible; }
.modal-card { position: relative; width: min(510px, 100%); padding: 25px; border-radius: 26px; color: #fff; text-align: center; transform: translateY(12px) scale(.98); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.modal.show .modal-card { transform: translateY(0) scale(1); }
.modal-card h2 { margin: 0; font-size: 19px; font-weight: 500; }
.modal-card > p { margin: 7px 0 20px; color: rgba(255,255,255,.62); font-size: 13px; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 23px; line-height: 1; cursor: pointer; }
.auth-modal {
  padding: max(18px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom));
  background: rgba(4,8,6,.48);
  -webkit-backdrop-filter: blur(9px) saturate(110%); backdrop-filter: blur(9px) saturate(110%);
}
.auth-card {
  width: min(340px, 100%); padding: 18px 18px 10px; border: 0; outline: 0;
  background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  color: #fff; text-align: center;
}
.auth-card > h2 { margin: 0; font-size: 22px; font-weight: 550; letter-spacing: .02em; }
.auth-card > p { margin: 8px 0 0; color: rgba(255,255,255,.72); font-size: 13px; }
.passcode-dots { display: flex; align-items: center; justify-content: center; gap: 17px; height: 18px; margin-top: 24px; }
.passcode-dots i {
  width: 12px; height: 12px; border: 1.5px solid rgba(255,255,255,.9); border-radius: 50%;
  background: transparent; transition: transform .14s ease, background .14s ease;
}
.passcode-dots i.filled { background: #fff; transform: scale(1.05); }
.auth-message { min-height: 18px; margin: 9px 0 7px; color: #ffd1d3; font-size: 12px; text-align: center; }
.passcode-keypad { display: grid; grid-template-columns: repeat(3, 74px); justify-content: center; gap: 13px 22px; }
.passcode-key {
  display: grid; width: 74px; height: 74px; place-content: center; padding: 0; border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, background .08s ease, opacity .16s ease;
}
.passcode-key b { font-size: 29px; font-weight: 350; line-height: 29px; }
.passcode-key small { min-height: 11px; margin-top: 3px; font-size: 9px; font-weight: 650; letter-spacing: .16em; line-height: 10px; }
.passcode-key:hover { background: rgba(255,255,255,.24); }
.passcode-key:active, .passcode-key.pressed { transform: scale(.93); background: rgba(255,255,255,.34); }
.passcode-action {
  align-self: center; width: 74px; height: 52px; border: 0; background: transparent; color: rgba(255,255,255,.94);
  font: inherit; font-size: 14px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.passcode-key:disabled, .passcode-action:disabled { cursor: default; opacity: .38; }
.auth-card.verifying .passcode-dots i.filled { animation: passcodePulse .8s ease-in-out infinite alternate; }
.auth-card.shake { animation: passcodeShake .38s ease; }
@keyframes passcodePulse { to { opacity: .4; transform: scale(.84); } }
@keyframes passcodeShake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-7px); } 80% { transform: translateX(5px); } }
.qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.qr-block { display: grid; gap: 9px; justify-items: center; color: rgba(255,255,255,.8); font-size: 13px; }
.qr-code { display: grid; width: 196px; min-height: 196px; place-items: center; padding: 8px; border-radius: 15px; background: #fff; }
.qr-code img, .qr-code canvas { display: block; max-width: 180px !important; width: 100% !important; height: auto !important; }

@media (max-width: 600px) {
  .background-video { object-position: 57% center; }
  .subscription-shell { top: 75%; width: min(320px, calc(100vw - 28px)); }
  .subscription-menu { grid-template-columns: 1fr; max-height: 254px; }
  .subscription-item { min-height: 50px; }
  .qr-grid { grid-template-columns: 1fr; max-height: 62svh; overflow: auto; }
  .qr-code { width: 176px; min-height: 176px; }
  .qr-code img, .qr-code canvas { max-width: 160px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .background-video { display: none; }
  body { background: #111814 url("./poster.jpg") center / cover no-repeat; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
