:root {
  color-scheme: light;
  --page: #f5f6f8;
  --panel: rgba(255, 255, 255, .86);
  --ink: #1c1c1e;
  --muted: #737782;
  --faint: #989ca5;
  --line: rgba(22, 30, 45, .09);
  --blue: #1677f9;
  --green: #238a55;
  --orange: #d78a12;
  --red: #d74440;
  --shadow: 0 8px 26px rgba(37, 49, 72, .045);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--page); color: var(--ink); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex: 0 0 238px; flex-direction: column; height: 100vh; padding: 27px 17px 20px; border-right: 1px solid var(--line); background: rgba(249, 249, 250, .88); }
.brand { display: flex; align-items: center; gap: 10px; padding: 3px 8px; color: var(--ink); font-size: 15px; font-weight: 750; letter-spacing: -.35px; text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: linear-gradient(140deg, #1688ff, #6659e8); box-shadow: 0 5px 12px rgba(22, 119, 249, .24); color: white; font-size: 22px; }
.brand-wordmark { gap: 0; font-size: 24px; font-weight: 800; letter-spacing: -.6px; }
.brand-wordmark .wm { display: inline-block; font-weight: 800; }
.wm-1 { color: #2563eb; }
.wm-2 { color: #db2777; }
.wm-3 { color: #ea580c; }
.wm-4 { color: #16a34a; }
.wm-5 { color: #7c3aed; }
.wm-6 { color: #0891b2; }
.navigation { display: grid; gap: 5px; margin-top: 40px; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 39px; padding: 0 11px; border-radius: 8px; color: #555b66; font-size: 13px; font-weight: 550; text-decoration: none; transition: background .15s, color .15s; }
.nav-link span { width: 17px; color: #858b96; font-size: 17px; text-align: center; }
.nav-link:hover, .nav-link.active { background: #e9f2ff; color: #126ce3; }
.nav-link.active span { color: #126ce3; }
.sidebar-stats { display: grid; gap: 11px; margin-top: auto; padding: 16px 8px; border-top: 1px solid var(--line); }
.sidebar-stats div { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.sidebar-stats strong { color: #343943; font-size: 13px; }
.sidebar-note { margin: 7px 8px 0; color: var(--faint); font-size: 11px; line-height: 1.65; }
.main-content { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 94px; padding: 18px clamp(22px, 4vw, 58px); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .48); }
.topbar h1 { margin: 3px 0 0; font-size: 19px; letter-spacing: -.5px; }
.eyebrow { margin: 0; color: #89909d; font-size: 9px; font-weight: 750; letter-spacing: 1.3px; }
.top-link { padding: 9px 13px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #484e58; font-size: 12px; font-weight: 600; text-decoration: none; }
.top-link span { margin-left: 5px; color: var(--blue); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { width: min(100%, 1120px); margin: 0 auto; padding: 31px clamp(18px, 4vw, 54px) 25px; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 22px; }
.intro h2 { margin: 7px 0 5px; font-size: clamp(20px, 2vw, 25px); letter-spacing: -.75px; }
.intro p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 13px; }
.intro-badge { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid #d8eee2; border-radius: 20px; background: #f3fbf6; color: #357753; font-size: 11px; font-weight: 600; white-space: nowrap; }
.intro-badge span { width: 6px; height: 6px; border-radius: 50%; background: #38a765; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.import-panel, .downloads-panel { padding: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.section-heading h2 { margin: 4px 0 0; font-size: 16px; letter-spacing: -.3px; }
.protocol-hint { color: #8a909b; font-size: 11px; }
.subscription-form { display: flex; gap: 8px; }
input[type="url"], textarea { width: 100%; border: 1px solid #e1e3e8; border-radius: 8px; outline: none; background: rgba(249, 250, 252, .85); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input[type="url"] { min-width: 0; height: 39px; padding: 0 12px; font-size: 12px; }
textarea { display: block; min-height: 96px; padding: 11px 12px; resize: vertical; font-size: 12px; line-height: 1.6; }
input:focus, textarea:focus { border-color: #83b7ff; box-shadow: 0 0 0 3px rgba(22, 119, 249, .1); }
input::placeholder, textarea::placeholder { color: #a0a5ae; }
.button { display: inline-flex; min-height: 35px; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; border: 1px solid transparent; border-radius: 7px; font-size: 11px; font-weight: 650; white-space: nowrap; transition: filter .15s, background .15s; }
.button:hover:not(:disabled), .download-button:hover { filter: brightness(.96); }
.button:disabled { cursor: not-allowed; opacity: .46; }
.button-primary { background: var(--blue); color: #fff; }
.button-success { background: #238a55; color: #fff; }
.button-warning { background: #fff7e8; border-color: #f2e4c7; color: #a76e0c; }
.button-danger { background: #fff1f0; border-color: #f4d7d5; color: #bd413b; }
.button-quiet { border-color: #e5e6e9; background: #fff; color: #4f5560; }
.divider { display: flex; align-items: center; gap: 12px; margin: 17px 0 11px; color: #9da2aa; font-size: 9px; font-weight: 700; letter-spacing: .9px; }
.divider::before, .divider::after { height: 1px; flex: 1; background: #eceef1; content: ""; }
.import-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.import-footer p { margin: 0; color: #9096a1; font-size: 10px; line-height: 1.5; }
.notice { margin-top: 14px; padding: 11px 13px; border: 1px solid #d8eee2; border-radius: 9px; background: #f1fbf5; color: #277347; font-size: 12px; }
.notice.error { border-color: #f4d7d5; background: #fff3f2; color: #b23934; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 10px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.node-count { padding: 0 5px; color: #858b96; font-size: 11px; white-space: nowrap; }
.node-list { display: grid; gap: 7px; margin-top: 11px; }
.empty-state { display: grid; min-height: 180px; justify-items: center; align-content: center; padding: 25px; border: 1px dashed #dfe2e7; border-radius: 14px; background: rgba(255,255,255,.55); text-align: center; }
.empty-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: #edf4ff; color: var(--blue); font-size: 21px; }
.empty-state h3 { margin: 12px 0 4px; font-size: 13px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 11px; }
.node-card { display: flex; min-width: 0; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.84); box-shadow: 0 2px 6px rgba(37,49,72,.025); transition: background .15s, border-color .15s; }
.node-card.is-selected { border-color: #b9d8ff; background: #f1f7ff; }
.node-check { width: 15px; height: 15px; flex: 0 0 auto; accent-color: var(--blue); }
.type-badge { flex: 0 0 auto; padding: 4px 7px; border-radius: 5px; background: #eef4ff; color: #3975c5; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.type-ss, .type-ssr { background: #eff8f2; color: #388254; }
.type-trojan { background: #f4efff; color: #7553bc; }
.type-vless { background: #fff4e8; color: #b9731c; }
.node-description { flex: 1; min-width: 0; }
.node-description strong, .node-description span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-description strong { font-size: 12px; font-weight: 650; }
.node-description span { margin-top: 3px; color: #9298a2; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.latency { min-width: 67px; padding: 5px 7px; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 700; text-align: center; white-space: nowrap; }
.latency-unknown { background: #f2f3f5; color: #858b96; }
.latency-good { background: #eff9f2; color: #358251; }
.latency-warn { background: #fff7e8; color: #a76e0c; }
.latency-bad { background: #fff1f0; color: #bd413b; }
.node-actions { display: flex; flex: 0 0 auto; gap: 2px; }
.icon-button { display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #7d838d; font-size: 16px; }
.icon-button:hover { background: #f0f2f5; color: #343943; }
.downloads-panel { margin-top: 21px; scroll-margin-top: 20px; }
.download-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.download-card { min-width: 0; padding: 12px; border: 1px solid #e9eaed; border-radius: 10px; background: rgba(255,255,255,.76); }
.download-info { display: flex; align-items: flex-start; gap: 10px; min-height: 51px; }
.platform-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: #edf4ff; color: #1677f9; font-size: 20px; font-weight: 700; }
.platform-icon.android { background: #eff8f2; color: #328653; }
.platform-icon.apple { background: #f0f1f3; color: #535761; }
.download-details { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 5px; }
.download-details strong { color: #30343b; font-size: 11px; }
.arch-tag { padding: 2px 5px; border-radius: 4px; background: #f1f2f4; color: #777d87; font-size: 9px; }
.filename { width: 100%; overflow: hidden; color: #8b9099; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.download-footer { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding-top: 9px; border-top: 1px solid #eef0f2; color: #7d838c; font-size: 9px; }
.download-footer code { margin-left: 4px; color: #343943; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 750; }
.download-button { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 6px; background: #1677f9; color: white; font-size: 10px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.page-footer { padding: 20px 0 4px; color: #989da6; font-size: 10px; text-align: center; }
.page-footer span { margin: 0 5px; }
.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(23, 28, 38, .36); backdrop-filter: blur(5px); }
.modal { display: flex; width: min(100%, 540px); max-height: min(82vh, 760px); flex-direction: column; overflow: hidden; border: 1px solid rgba(255,255,255,.7); border-radius: 15px; background: #fff; box-shadow: 0 20px 65px rgba(17, 26, 43, .2); }
.modal-header, .modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 19px; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-header h2 { overflow: hidden; max-width: 420px; margin: 4px 0 0; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { overflow: auto; padding: 18px 20px; }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.detail-row { display: flex; align-items: center; gap: 15px; margin-bottom: 12px; }
.detail-row span, .detail-label { color: #8b9099; font-size: 10px; font-weight: 700; letter-spacing: .45px; text-transform: uppercase; }
.detail-row span { width: 72px; }
.detail-row code { color: #353a44; font-size: 11px; }
.detail-label { display: block; margin: 15px 0 7px; }
.code-block { overflow: auto; margin: 0; padding: 12px; border: 1px solid #eceef1; border-radius: 8px; background: #f7f8fa; color: #303640; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.65; white-space: pre-wrap; word-break: break-all; }
.qr-placeholder { display: grid; min-height: 225px; place-items: center; padding: 12px; border: 1px solid #eceef1; border-radius: 11px; background: #fafbfc; }
.qr-placeholder canvas, .qr-placeholder img { max-width: 100%; }
.modal-hint, .qr-note { color: #858b96; font-size: 11px; line-height: 1.6; text-align: center; }
.qr-note { min-height: 14px; margin-bottom: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }
.toast { position: fixed; z-index: 30; right: 20px; bottom: 20px; padding: 11px 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: rgba(32, 35, 42, .94); box-shadow: 0 8px 25px rgba(0,0,0,.15); color: white; font-size: 11px; }

@media (min-width: 1150px) {
  .download-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { font-size: 13px; }
  .brand-wordmark { font-size: 20px; }
  .brand-mark { width: 30px; height: 30px; }
  .navigation { display: flex; gap: 2px; margin: 0; }
  .nav-link { min-height: 34px; gap: 5px; padding: 0 8px; font-size: 10px; }
  .nav-link span { width: auto; font-size: 14px; }
  .sidebar-stats, .sidebar-note { display: none; }
  .main-content { width: 100%; }
  .topbar { min-height: 68px; padding: 12px 17px; }
  .content { padding: 23px 15px 20px; }
  .intro { align-items: flex-start; }
  .intro-badge { padding: 7px 8px; font-size: 9px; }
  .section-heading { align-items: flex-start; }
  .protocol-hint { max-width: 135px; text-align: right; line-height: 1.45; }
  .node-card { gap: 8px; padding: 9px; }
  .latency { min-width: 52px; padding: 5px 4px; font-size: 9px; }
  .node-actions { gap: 0; }
  .node-actions .icon-button { width: 25px; height: 28px; font-size: 13px; }
}
@media (max-width: 500px) {
  .navigation .nav-link { font-size: 0; gap: 0; }
  .navigation .nav-link span { font-size: 17px; }
  .top-link { padding: 8px 9px; font-size: 10px; }
  .intro h2 { font-size: 19px; }
  .intro p:not(.eyebrow) { max-width: 225px; font-size: 11px; line-height: 1.5; }
  .import-panel, .downloads-panel { padding: 14px; }
  .subscription-form { flex-direction: column; }
  .subscription-form .button { min-height: 37px; }
  .import-footer { align-items: flex-end; }
  .toolbar { align-items: flex-start; }
  .toolbar-actions { gap: 5px; }
  .toolbar-actions .button { padding: 0 8px; font-size: 10px; }
  .node-count { padding-top: 10px; font-size: 9px; }
  .download-grid { grid-template-columns: 1fr; }
  .node-card { gap: 7px; }
  .node-description strong { font-size: 10px; }
  .node-description span { font-size: 9px; }
  .type-badge { padding: 4px 5px; font-size: 8px; }
}
