* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green: #07c160;
  --green-d: #05a050;
  --green-l: #e8f8ef;
  --indigo: #6366f1;
  --indigo-d: #4f46e5;
  --indigo-l: #eef2ff;
  --bg: #f1f3f6;
  --card: #ffffff;
  --text: #16181d;
  --text2: #6b7280;
  --text3: #9ca3af;
  --border: #e5e7eb;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
}

html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: inherit; }

/* ---------------- Header ---------------- */
.hdr {
  background: linear-gradient(135deg, #07c160 0%, #00b189 100%);
  padding: 16px 0 0;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hdr::after {
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  right: -90px; top: -140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
body[data-page="p2"] .hdr {
  background: linear-gradient(135deg, #4f6ef7 0%, #6d5cf6 100%);
}
.hdr-in {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 18px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 13px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .25);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  padding-left: 2px;
}
.brand-txt { min-width: 0; }
.brand-txt h1 { font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.brand-txt p {
  font-size: 11.5px;
  color: rgba(255, 255, 255, .82);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.acct {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(6px);
  transition: background .2s;
}
.acct:hover { background: rgba(255, 255, 255, .26); }
.acct .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #a7f3d0;
  box-shadow: 0 0 0 3px rgba(167, 243, 208, .25);
}
.acct.warn .dot { background: #fde68a; box-shadow: 0 0 0 3px rgba(253, 230, 138, .25); }
.acct.danger .dot { background: #fca5a5; box-shadow: 0 0 0 3px rgba(252, 165, 165, .25); }

.notice {
  max-width: 960px;
  margin: 0 auto 14px;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .22);
  font-size: 12.5px;
  color: #fff;
  position: relative;
  z-index: 1;
  margin-left: 18px;
  margin-right: 18px;
}

/* ---------------- 页面切换 ---------------- */
.switcher {
  max-width: 960px;
  margin: -8px auto 0;
  padding: 0 18px;
  position: relative;
  z-index: 2;
}
.switch-in {
  display: flex;
  gap: 6px;
  background: #e3e6ea;
  border-radius: 14px;
  padding: 5px;
}
.sw-btn {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: var(--text2);
  font-weight: 600;
  font-size: 14px;
  transition: all .22s;
}
.sw-btn small { font-size: 10.5px; font-weight: 500; opacity: .75; }
.sw-btn.active { background: #fff; color: var(--green-d); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.sw-btn.sw-p2.active { color: var(--indigo-d); }

/* ---------------- 布局 ---------------- */
.main { max-width: 960px; width: 100%; margin: 0 auto; padding: 18px 18px 40px; flex: 1 0 auto; }
.page[hidden] { display: none; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 14px; }

.tabs {
  display: flex;
  gap: 4px;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 8px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  transition: all .2s;
}
.tab.active { background: #fff; color: var(--green-d); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .07); }
body[data-page="p2"] .tab.active { color: var(--indigo-d); }

.panel[hidden] { display: none; }
.panel-title { font-size: 15px; font-weight: 700; margin-bottom: 5px; display: flex; align-items: center; gap: 7px; }
.panel-desc { font-size: 12.5px; color: var(--text2); line-height: 1.65; margin-bottom: 14px; }

/* ---------------- 输入 ---------------- */
.input-wrap { position: relative; margin-bottom: 12px; }
.input-ico {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 15px; opacity: .45; pointer-events: none;
}
.url-input, .url-textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px 13px 42px;
  font-size: 14px;
  color: var(--text);
  background: #fafbfc;
  outline: none;
  transition: all .22s;
}
.url-input::placeholder, .url-textarea::placeholder { color: #b3b8c2; }
.url-input:focus, .url-textarea:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(7, 193, 96, .1);
}
body[data-page="p2"] .url-input:focus,
body[data-page="p2"] .url-textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .1);
}
.url-textarea {
  padding-left: 14px;
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
}
.counter { text-align: right; font-size: 11.5px; color: var(--text3); margin: -6px 2px 10px; }

/* ---------------- 按钮 ---------------- */
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.btn {
  border: none;
  border-radius: 11px;
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .2s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #07c160, #00b189); color: #fff; box-shadow: 0 4px 14px rgba(7, 193, 96, .25); }
.btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 20px rgba(7, 193, 96, .3); }
.btn.p2 { background: linear-gradient(135deg, #5b6cf7, #7c5cf6); color: #fff; box-shadow: 0 4px 14px rgba(99, 102, 241, .25); }
.btn.p2:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 20px rgba(99, 102, 241, .32); }
.btn.other {
  background: linear-gradient(135deg, #6b7bf8, #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 92, 246, .22);
}
.btn.other:hover:not(:disabled) { transform: translateY(-1px); }
.btn.ghost { background: #f3f4f6; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: #e9ebef; }
.btn.outline { background: transparent; color: var(--green-d); border: 2px solid var(--green); }
.btn.outline:hover { background: var(--green-l); }
.btn.sm { padding: 7px 13px; font-size: 12px; border-radius: 9px; }
.btn.danger { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.btn.danger:hover { background: #fee2e2; }
.btn.locked { opacity: .5; filter: grayscale(.5); }

/* ---------------- 加载 ---------------- */
.loading { display: none; text-align: center; padding: 30px 16px; }
.loading.show { display: block; }
.spinner {
  width: 38px; height: 38px; margin: 0 auto 12px;
  border: 4px solid #e8f8ef;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
body[data-page="p2"] .spinner { border-color: #e0e7ff; border-top-color: var(--indigo); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13.5px; font-weight: 500; }
.loading-detail { font-size: 11.5px; color: var(--text3); margin-top: 5px; font-family: ui-monospace, monospace; }

/* ---------------- 播放器 ---------------- */
.video-wrap {
  display: none;
  margin-top: 16px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 9;
}
.video-wrap.show { display: block; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; display: block; }
.video-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px;
  background: rgba(0, 0, 0, .65);
  z-index: 2;
}
.video-loading.hide { display: none; }

/* ---------------- 结果 ---------------- */
.result { display: none; margin-top: 18px; }
.result.show { display: block; animation: fadeIn .28s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.q-box {
  border: 1px solid #e0e7ff;
  background: #f8faff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: none;
}
.q-box.show { display: block; }
.q-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.q-title { font-size: 13px; font-weight: 700; color: #4338ca; }
.q-tip { font-size: 11px; color: #94a3b8; }
.q-tabs { display: flex; flex-wrap: wrap; gap: 7px; }
.q-tab {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 12px;
  border: 1px solid #e0e7ff;
  border-radius: 9px;
  background: #fff;
  color: #475569;
  font-size: 12px;
  transition: all .18s;
}
.q-tab:hover { border-color: var(--indigo); transform: translateY(-1px); }
.q-tab.active { background: linear-gradient(135deg, #6366f1, #8b5cf6); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(99, 102, 241, .28); }
.q-tab b { font-size: 13px; font-weight: 700; }
.q-tab em { font-style: normal; font-size: 9.5px; opacity: .8; }
.q-tab.active em { opacity: .9; }

.details { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-top: 12px; }
.details > summary {
  list-style: none; cursor: pointer;
  padding: 11px 14px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  background: #fafbfc;
  user-select: none;
}
.details > summary::-webkit-details-marker { display: none; }
.details > summary .arrow { font-size: 10px; transition: transform .2s; color: var(--text3); }
.details[open] > summary .arrow { transform: rotate(90deg); }
.details > summary .count { margin-left: auto; font-size: 10.5px; color: #fff; background: var(--green); padding: 1px 8px; border-radius: 999px; }
body[data-page="p2"] .details > summary .count { background: var(--indigo); }
.details .body { padding: 4px 12px 12px; }

.row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  background: #f8faf9;
  border: 1px solid #dff2e7;
  border-radius: 9px;
  margin-top: 8px;
}
body[data-page="p2"] .row { background: #f8faff; border-color: #dbe3fb; }
.row .k { font-size: 11.5px; font-weight: 600; color: var(--green-d); min-width: 62px; padding-top: 1px; flex-shrink: 0; }
body[data-page="p2"] .row .k { color: var(--indigo-d); }
.row .v {
  flex: 1; font-size: 12.5px;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
  user-select: text;
}
.row .cp {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 10.5px;
  color: var(--green-d);
}
.row .cp:hover { background: var(--green-l); border-color: var(--green); }
body[data-page="p2"] .row .cp { color: var(--indigo-d); }
body[data-page="p2"] .row .cp:hover { background: var(--indigo-l); border-color: var(--indigo); }
.row.err { background: #fef2f2; border-color: #fecaca; }
.row.err .k { color: var(--red); }

/* ---------------- 批量 / 历史 ---------------- */
.batch-sum {
  padding: 9px 13px;
  border-radius: 9px;
  font-size: 12.5px;
  margin-bottom: 10px;
  background: #f0fdf4;
  color: #166534;
}
.batch-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  margin-bottom: 7px;
  font-size: 12px;
}
.batch-item .idx { color: var(--text3); min-width: 20px; font-variant-numeric: tabular-nums; }
.batch-item .u { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-item .st { flex-shrink: 0; font-size: 11px; font-weight: 600; }
.batch-item.ok { border-color: #bbf7d0; background: #f7fdf9; }
.batch-item.ok .st { color: var(--green-d); }
.batch-item.bad { border-color: #fecaca; background: #fff8f8; }
.batch-item.bad .st { color: var(--red); }
.batch-item .mini-btn { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 2px 8px; font-size: 10.5px; }

.history-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .18s;
}
.history-item:hover { border-color: #c7f0d8; background: #f9fdfb; transform: translateY(-1px); }
body[data-page="p2"] .history-item:hover { border-color: #c7d2fe; background: #f9faff; }
.history-item img, .history-item .ph {
  width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  background: #eef0f3;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.history-item .hi { flex: 1; min-width: 0; }
.history-item .hi .t { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item .hi .s { font-size: 11px; color: var(--text3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item .time { font-size: 10.5px; color: var(--text3); flex-shrink: 0; }
.empty { text-align: center; padding: 34px 16px; color: var(--text3); font-size: 13px; }

/* ---------------- Toast ---------------- */
.toasts {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  background: rgba(22, 24, 29, .92);
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  opacity: 0;
  transform: translateY(-8px);
  transition: all .25s;
  max-width: 100%;
}
.toast.show { opacity: 1; transform: none; }
.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }
.toast.warn { background: #92400e; }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0;
  background: rgba(15, 18, 25, .5);
  backdrop-filter: blur(3px);
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.mask[hidden] { display: none; }
.dialog {
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  width: 100%; max-width: 380px;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
  animation: pop .22s ease;
}
.dialog.small { max-width: 320px; text-align: center; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
.dialog h3 { font-size: 17px; margin-bottom: 12px; }
.dialog .x {
  position: absolute; right: 14px; top: 12px;
  border: none; background: none; font-size: 22px; color: var(--text3); line-height: 1;
  padding: 4px;
}
.dialog .x:hover { color: var(--text); }
.status-box {
  background: #f8faf9;
  border: 1px solid #e3f5ea;
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.8;
  margin-bottom: 14px;
}
.status-box b { color: var(--text); }
.status-box .hi { color: var(--green-d); font-weight: 700; }
.status-box.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.status-box.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.seg { display: flex; background: #f3f4f6; border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg button {
  flex: 1; border: none; background: transparent;
  padding: 8px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text2);
}
.seg button.on { background: #fff; color: var(--green-d); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.form { display: flex; flex-direction: column; gap: 11px; }
.form[hidden] { display: none; }
.form label { font-size: 12.5px; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.form input {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  outline: none;
  transition: all .2s;
}
.form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(7, 193, 96, .1); }
.form .btn { margin-top: 3px; width: 100%; }
.dialog-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.mini { font-size: 11.5px; color: var(--text3); text-decoration: none; }
.mini:hover { color: var(--green-d); }
.muted { font-size: 12.5px; color: var(--text2); }

/* ---------------- Footer ---------------- */
.footer {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 6px 18px 28px;
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  line-height: 1.9;
}
.foot-links { display: flex; align-items: center; justify-content: center; gap: 7px; }
.foot-links a { text-decoration: none; }
.foot-links a:hover { color: var(--green-d); }

@media (max-width: 560px) {
  .hdr-in { padding-bottom: 14px; }
  .brand-txt h1 { font-size: 16.5px; }
  .brand-txt p { font-size: 10.5px; max-width: 190px; }
  .logo { width: 38px; height: 38px; border-radius: 11px; }
  .acct { padding: 6px 11px; font-size: 11.5px; }
  .main { padding: 14px 12px 32px; }
  .card { padding: 16px 14px; border-radius: 14px; }
  .tab { font-size: 12.5px; padding: 8px 4px; }
  .btn { padding: 10px 14px; font-size: 13px; }
  .btn.sm { padding: 6px 11px; }
  .row .k { min-width: 54px; font-size: 11px; }
  .row .v { font-size: 11.5px; }
  .notice { margin-left: 12px; margin-right: 12px; }
}
