/* 山海订阅解密 — 简洁浅色主题，桌面/移动端自适应 */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e3e8f2;
  --text: #1c2333;
  --text-2: #5b6478;
  --text-3: #8b93a7;
  --accent: #4f6ef7;
  --accent-strong: #3d5bef;
  --accent-soft: #eef1ff;
  --danger: #d9384e;
  --danger-soft: #fdeef0;
  --ok: #149d64;
  --ok-soft: #e7f7f0;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(28, 35, 51, 0.07);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

/* ---------- header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-icon { font-size: 34px; }

.header h1 { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }

.subtitle { font-size: 13px; color: var(--text-2); }

.backend-info {
  font-size: 12px;
  color: var(--text-3);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

/* ---------- card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab.active {
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(28, 35, 51, 0.1);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- dropzone ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 34px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon { font-size: 30px; }
.dropzone-main { font-size: 15px; font-weight: 600; color: var(--text); }
.dropzone-hint { font-size: 12px; color: var(--text-3); }

/* ---------- fields ---------- */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.text-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fbfcfe;
  transition: border-color 0.15s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.text-input { resize: vertical; min-height: 120px; font-family: ui-monospace, Consolas, monospace; }

.field-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ---------- form row ---------- */
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.mode-group { display: flex; gap: 16px; flex-wrap: wrap; }

.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}

.radio input { accent-color: var(--accent); width: 15px; height: 15px; }

.btn-primary {
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 26px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- error ---------- */
.error-banner {
  margin-top: 14px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f6c9d0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  word-break: break-all;
}

/* ---------- result ---------- */
.result-title { font-size: 17px; margin-bottom: 2px; }
.result-source {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 14px;
  word-break: break-all;
}

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
}

.stat-chip b { font-size: 16px; }

.block-title { font-size: 14px; color: var(--text-2); margin-bottom: 8px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }

.node-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 520px;
}

.node-table th, .node-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.node-table th {
  background: #f8f9fd;
  color: var(--text-2);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.node-table tbody tr:last-child td { border-bottom: none; }
.node-table tbody tr:hover { background: #f8f9fd; }

.node-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.badge {
  display: inline-block;
  background: var(--ok-soft);
  color: var(--ok);
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 12px;
  font-family: ui-monospace, Consolas, monospace;
}

/* ---------- yaml ---------- */
.yaml-details { margin-top: 18px; }

.yaml-details summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 10px;
  user-select: none;
}

.yaml-actions { display: flex; gap: 8px; margin-bottom: 10px; }

.btn-secondary {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.yaml-pre {
  background: #1e2433;
  color: #d7e0f2;
  border-radius: 10px;
  padding: 14px;
  font-size: 12.5px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  line-height: 1.55;
  overflow: auto;
  max-height: 420px;
  white-space: pre;
  tab-size: 2;
}

.warning {
  margin-top: 14px;
  font-size: 12.5px;
  color: #a06a00;
  background: #fff7e6;
  border: 1px solid #f5e2b8;
  border-radius: 8px;
  padding: 8px 12px;
}

/* ---------- persist（持久化订阅链接） ---------- */
.persist-block {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.persist-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 10px;
}

.persist-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.persist-note { font-size: 12px; color: var(--text-3); }

.persist-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.persist-link-row .text-input {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  flex: 1;
}

/* ---------- footer ---------- */
.footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .page { padding: 14px 10px 32px; }
  .header h1 { font-size: 19px; }
  .brand-icon { font-size: 28px; }
  .card { padding: 14px; }
  .form-row { flex-direction: column; align-items: stretch; }
  .btn-primary { justify-content: center; width: 100%; }
  .dropzone { padding: 26px 12px; }
  .yaml-pre { max-height: 320px; }
  .node-name { max-width: 160px; }
  .persist-link-row { flex-direction: column; }
}
