:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #4f46e5;
  --primary2: #6366f1;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--primary2); text-decoration: none; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
header {
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(8px);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; color: #fff; }
.brand span { color: var(--primary2); }
.nav-links { display: flex; align-items: center; gap: 12px; }
.btn {
  display: inline-block; padding: 8px 18px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-size: 14px; cursor: pointer; transition: all .15s;
  font-family: inherit; text-align: center;
}
.btn:hover { border-color: var(--primary2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary2); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Hero */
.hero { text-align: center; padding: 56px 16px 32px; }
.hero h1 { font-size: 34px; margin-bottom: 12px; }
.hero p { color: var(--muted); font-size: 15px; }
.parse-box {
  margin: 24px auto 0; max-width: 720px; display: flex; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px;
}
.parse-box input {
  flex: 1; background: transparent; border: none; outline: none; color: var(--text);
  font-size: 15px; padding: 10px 12px; font-family: inherit;
}
.notice {
  max-width: 720px; margin: 16px auto 0; padding: 12px 16px; background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.35); border-radius: 8px; color: var(--yellow); font-size: 13px;
}

/* Result */
#result { display: none; margin: 28px 0; }
.result-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.result-head { display: flex; gap: 16px; padding: 16px; align-items: flex-start; }
.result-head img {
  width: 168px; height: 94px; object-fit: cover; border-radius: 8px; background: var(--bg); flex-shrink: 0;
}
.result-meta { flex: 1; min-width: 0; }
.result-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; word-break: break-all; }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
  background: rgba(99,102,241,.15); color: var(--primary2); margin-right: 8px;
}
.tag-green { background: rgba(34,197,94,.15); color: var(--green); }
.tag-red { background: rgba(239,68,68,.15); color: var(--red); }
.countdown { color: var(--yellow); font-size: 13px; margin-top: 8px; }
.player-wrap { padding: 0 16px 16px; }
.player-wrap video, .player-wrap iframe { width: 100%; border-radius: 8px; background: #000; aspect-ratio: 16/9; border: none; }
.result-actions { display: flex; gap: 10px; padding: 0 16px 16px; flex-wrap: wrap; }
.error-box { display: none; margin-top: 20px; padding: 14px 18px; background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.35); border-radius: 8px; color: #fca5a5; font-size: 14px; }
.loading { text-align: center; padding: 40px; color: var(--muted); display: none; }

/* Sections */
.section-title { font-size: 20px; font-weight: 700; margin: 40px 0 16px; }
.grid-pkgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.pkg-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 18px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s;
}
.pkg-card:hover { border-color: var(--primary2); }
.pkg-name { font-weight: 600; font-size: 15px; }
.pkg-price { font-size: 26px; font-weight: 700; color: var(--primary2); }
.pkg-price small { font-size: 13px; color: var(--muted); font-weight: 400; }
.pkg-desc { color: var(--muted); font-size: 13px; flex: 1; }

/* Modal */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; align-items: center; justify-content: center; }
.modal-mask.show { display: flex; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 14px; width: 420px; max-width: 92vw; padding: 24px; }
.modal h3 { margin-bottom: 16px; }
.form-item { margin-bottom: 14px; }
.form-item label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; font-family: inherit; outline: none;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary2); }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { padding: 8px 16px; border-radius: 8px; background: var(--bg2); color: var(--muted); cursor: pointer; font-size: 14px; }
.tab.active { background: var(--primary); color: #fff; }
.pay-types { display: flex; gap: 10px; }
.pay-type { flex: 1; padding: 12px; text-align: center; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 14px; }
.pay-type.active { border-color: var(--primary2); background: rgba(99,102,241,.1); color: var(--primary2); }
.msg-line { font-size: 13px; margin-top: 10px; min-height: 18px; }
.msg-line.err { color: var(--red); }
.msg-line.ok { color: var(--green); }

/* User panel */
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 20px 0; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--primary2); }
.stat-card .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Tables */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: var(--bg2); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.badge-paid { background: rgba(34,197,94,.15); color: var(--green); }
.badge-pending { background: rgba(245,158,11,.15); color: var(--yellow); }
.badge-closed, .badge-failed { background: rgba(100,116,139,.15); color: var(--muted); }
.badge-on { background: rgba(34,197,94,.15); color: var(--green); }
.badge-off { background: rgba(239,68,68,.15); color: var(--red); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 16px 0; }
.pager button { padding: 5px 14px; }
.page-info { color: var(--muted); font-size: 13px; }

/* Admin */
.admin-layout { display: flex; min-height: calc(100vh - 60px); }
.admin-side { width: 180px; background: var(--bg2); border-right: 1px solid var(--border); padding: 16px 0; flex-shrink: 0; }
.admin-side .item { padding: 10px 20px; cursor: pointer; color: var(--muted); font-size: 14px; border-left: 3px solid transparent; }
.admin-side .item:hover { color: var(--text); }
.admin-side .item.active { color: #fff; background: rgba(99,102,241,.12); border-left-color: var(--primary2); }
.admin-main { flex: 1; padding: 24px; overflow: hidden; }
.admin-main h2 { margin-bottom: 16px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; outline: none; }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stats-cards .sc { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stats-cards .sc .n { font-size: 24px; font-weight: 700; color: var(--primary2); }
.stats-cards .sc .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.admin-form { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.admin-form h4 { margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 10px; }
.editor-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; flex-wrap: wrap; }
.editor-row input, .editor-row select { padding: 6px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; outline: none; }
.editor-row .btn-sm { flex-shrink: 0; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 40px 0 24px; border-top: 1px solid var(--border); margin-top: 40px; }

@media (max-width: 640px) {
  .hero h1 { font-size: 24px; }
  .parse-box { flex-direction: column; }
  .result-head { flex-direction: column; }
  .result-head img { width: 100%; height: auto; aspect-ratio: 16/9; }
  .admin-layout { flex-direction: column; }
  .admin-side { width: 100%; display: flex; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .admin-side .item { border-left: none; border-bottom: 3px solid transparent; padding: 10px 14px; flex-shrink: 0; }
  .admin-side .item.active { border-bottom-color: var(--primary2); }
}
