* { box-sizing: border-box; }
:root {
  --bg: #0f172a;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #22c55e;
  --primary-600: #16a34a;
  --border: #1f2937;
}
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  min-height: 100vh;
  background-color: #0b1220;
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
  background-attachment: fixed;
  color: var(--text);
}
.container { width: min(1100px, 92%); margin: 0 auto; }
header { padding: 32px 0 12px; }
h1 { margin: 0 0 6px; font-weight: 750; letter-spacing: 0.2px; }
.subtitle { color: var(--muted); margin: 0; }
.site-nav {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.nav-link:hover {
  border-color: rgba(34, 197, 94, 0.5);
  color: var(--primary);
}
.nav-link.active {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.12);
  color: var(--primary);
}

.api-info-badge {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 50;
  width: 240px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.78);
  backdrop-filter: blur(10px);
}
.api-info-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}
.api-info-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  line-height: 1.35;
  margin: 4px 0;
}
.api-info-k { color: var(--muted); white-space: nowrap; }
.api-info-v { color: var(--text); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 统计可视化 */
.analytics-section h2 { margin-top: 0; margin-bottom: 12px; }
.analytics-grid { display: flex; flex-direction: column; gap: 14px; }
.analytics-block { width: 100%; }
.analytics-subtitle { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.bar-list { display: grid; gap: 10px; }
.bar-item { display: grid; gap: 6px; }
.bar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.bar-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-count { color: var(--muted); white-space: nowrap; }
.bar-track { height: 8px; border-radius: 999px; background: rgba(31, 41, 55, 0.45); overflow: hidden; border: 1px solid var(--border); }
.bar-fill { height: 100%; border-radius: 999px; background: rgba(34, 197, 94, 0.85); width: 0%; }

.rank-list { display: grid; gap: 8px; }
.rank-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(15, 23, 42, 0.45); }
.rank-date { color: var(--text); font-size: 13px; }
.rank-count { color: var(--muted); font-size: 13px; white-space: nowrap; }

.today-card { padding: 14px 14px; border: 1px solid var(--border); border-radius: 14px; background: rgba(15, 23, 42, 0.45); }
.today-count { font-size: 32px; font-weight: 750; letter-spacing: 0.2px; color: var(--text); line-height: 1.1; }
.today-date { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* 后台 */
.admin-card {
  position: relative;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.admin-card h2 { margin-top: 0; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(34, 197, 94, 0.2); color: var(--primary); font-size: 16px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.admin-layout { display: grid; gap: 22px; }
.admin-col { display: grid; gap: 18px; min-width: 0; }
.admin-col:first-child .admin-card:first-child {
  position: sticky;
  top: 16px;
}
.admin-actions.danger-zone {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

@media (min-width: 960px) {
  .admin-layout { grid-template-columns: minmax(320px, 380px) minmax(0, 1fr); align-items: start; }
}

/* 表单布局 */
.admin-config-form {
  display: grid;
  gap: 20px;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.form-section legend {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
  padding: 0;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}

.form-group {
  display: grid;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.upload-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.popup-img-preview {
  width: 100%;
  max-width: 320px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.admin-config-form label {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.admin-config-form input[type="text"],
.admin-config-form input[type="password"],
.admin-config-form input[type="number"],
.admin-config-form input[type="file"],
.admin-config-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.6);
  color: var(--text);
  outline: none;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

.admin-config-form textarea {
  resize: vertical;
  min-height: 80px;
}

.admin-config-form input[type="text"]:focus,
.admin-config-form input[type="password"]:focus,
.admin-config-form input[type="number"]:focus,
.admin-config-form textarea:focus {
  border-color: var(--primary);
  background: rgba(11, 16, 32, 0.9);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.form-actions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.card {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-top: 18px;
  backdrop-filter: blur(6px);
}
.card.alt h2 { margin-top: 0; }
label { display: block; margin-bottom: 8px; color: var(--muted); }
.input-row { display: flex; gap: 10px; }
input[type="url"],
input[type="text"],
input[type="password"] {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b1020;
  color: var(--text);
  outline: none;
}
input[type="url"]:focus,
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus { border-color: #374151; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12); }

textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b1020;
  color: var(--text);
  outline: none;
  resize: vertical;
}

.admin-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
  opacity: 0.8;
}
button, .btn {
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  color: white;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn.danger {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.btn.danger:hover { filter: brightness(1.08); }
.btn.outline {
  background: transparent;
  border: 1px solid #2e3a4e;
}
.tips { margin-top: 10px; color: var(--muted); font-size: 14px; }
.footer { padding: 24px 0 40px; color: var(--muted); }
.player-wrapper { aspect-ratio: 16/9; padding: 0; }
.player-wrapper iframe { width: 100%; height: 100%; border-radius: 12px; }
.actions { display: flex; gap: 10px; margin-top: 14px; }
/* 支持平台 chips */
.platforms { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pill, .pill:link, .pill:visited {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #0b1020;
  border: 1px solid #263246;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}
.pill.muted { color: var(--muted); border-style: dashed; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.info-list { list-style: none; padding-left: 0; margin: 8px 0 0; }
.info-list li { margin: 6px 0; }
/* 广告位样式 */
.ad-section { position: relative; padding: 16px; background: linear-gradient(135deg, #1a1f2e 0%, #0f1419 100%); border-color: #2a3f5f; }
.ad-label { position: absolute; top: 8px; right: 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ad-content { text-align: center; }
.ad-banner { display: inline-block; text-decoration: none; }
.ad-image { max-width: 100%; height: auto; border-radius: 8px; }
.ad-notice { margin-top: 12px; padding: 10px; background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.3); border-radius: 8px; color: #fbbf24; font-size: 13px; line-height: 1.5; }
.warning-banner { margin-top: 10px; padding: 10px 14px; background: rgba(239, 68, 68, 0.1); border-left: 3px solid #ef4444; border-radius: 6px; color: #fca5a5; font-size: 14px; }
/* 广告招租样式 */
.ad-rental { padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rental-icon { font-size: 28px; margin: 0; flex-shrink: 0; }
.rental-content { flex: 1; min-width: 200px; }
.ad-rental h3 { margin: 0 0 4px 0; color: var(--text); font-size: 16px; line-height: 1.3; }
.rental-desc { color: var(--muted); margin: 0; font-size: 12px; }
.rental-contact { padding: 8px 12px; background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.contact-label { color: var(--muted); font-size: 12px; }
.contact-wechat { color: var(--primary); font-weight: 600; font-size: 13px; user-select: all; }
/* 最近他们在看样式 */
.recent-watches-section h2 { margin-top: 0; margin-bottom: 12px; font-size: 18px; }
.recent-watches-list { 
  display: flex; 
  gap: 12px; 
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
/* 自定义滚动条 */
.recent-watches-list::-webkit-scrollbar { height: 6px; }
.recent-watches-list::-webkit-scrollbar-track { background: rgba(31, 41, 55, 0.4); border-radius: 3px; }
.recent-watches-list::-webkit-scrollbar-thumb { background: rgba(34, 197, 94, 0.4); border-radius: 3px; }
.recent-watches-list::-webkit-scrollbar-thumb:hover { background: rgba(34, 197, 94, 0.6); }
.watch-item { 
  padding: 12px 14px; 
  background: rgba(15, 23, 42, 0.6); 
  border: 1px solid var(--border); 
  border-radius: 10px; 
  cursor: pointer; 
  transition: all 0.2s ease;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  flex-shrink: 0;
}
.watch-item:hover { 
  background: rgba(15, 23, 42, 0.9); 
  border-color: var(--primary); 
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}
.watch-item-icon { 
  font-size: 20px; 
  flex-shrink: 0; 
  opacity: 0.8;
}
.watch-item-content { flex: 1; min-width: 0; }
.watch-item-title { 
  margin: 0; 
  font-size: 14px; 
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.watch-item-time { 
  margin: 2px 0 0; 
  font-size: 12px; 
  color: var(--muted); 
}
/* 弹窗广告样式 - 重写版 */
.modal-mask {
  position: fixed !important;
  z-index: 9999 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-color: rgba(0, 0, 0, 0.8) !important;
  display: none !important;
  transition: opacity 0.3s ease;
}
.modal-mask.active {
  display: table !important;
  width: 100vw !important;
  height: 100vh !important;
}
.modal-wrapper {
  display: table-cell !important;
  vertical-align: middle !important;
  text-align: center;
}
.modal-container {
  display: inline-block;
  background: #1a1f2e;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  max-width: min(640px, 92%);
  max-height: 90vh;
  overflow: hidden;
  vertical-align: middle;
}
.modal-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(90vh - 48px);
}
.modal-body {
  margin-bottom: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.modal-body img {
  max-width: 100%;
  height: auto;
  max-height: 42vh;
  object-fit: contain;
  display: block;
  border-radius: 12px;
  margin: 0 auto 20px;
}
.modal-desc {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
  padding: 20px;
  text-align: left;
}
.desc-title {
  font-size: 18px;
  font-weight: 700;
  color: #22c55e;
  margin: 0 0 12px 0;
}
.desc-text {
  font-size: 14px;
  color: #d1d5db;
  margin: 0 0 16px 0;
  line-height: 1.6;
}
.desc-highlight {
  font-size: 15px;
  color: #e5e7eb;
  margin: 0 0 12px 0;
}
.desc-highlight strong {
  color: #22c55e;
  font-size: 18px;
  font-weight: 700;
}
.desc-list {
  margin: 0 0 16px 0;
  padding-left: 24px;
  color: #d1d5db;
  font-size: 14px;
  line-height: 2;
}
.desc-list li {
  margin: 8px 0;
  position: relative;
  padding-left: 8px;
}
.desc-list li::marker {
  color: #22c55e;
  font-size: 1.2em;
}
.desc-footer {
  font-size: 13px;
  color: #9ca3af;
  margin: 0;
  text-align: center;
  font-style: italic;
}
.modal-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #d1d5db;
  user-select: none;
}
.modal-opt input { width: 16px; height: 16px; }
.modal-close-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(180deg, #22c55e, #16a34a);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* 留言反馈 */
.feedback-section textarea {
  width: 100%;
  resize: vertical;
  min-height: 84px;
  padding: 12px;
  border-radius: 12px;
}
.feedback-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.feedback-hint {
  font-size: 13px;
  color: #9ca3af;
}
.feedback-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}
.feedback-item {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.feedback-from {
  font-size: 13px;
  color: #d1d5db;
  margin: 0 0 6px 0;
}
.feedback-message {
  font-size: 14px;
  color: #e5e7eb;
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.7;
}
.feedback-time {
  font-size: 12px;
  color: #9ca3af;
  margin: 8px 0 0 0;
}
.feedback-admin-reply {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(34, 197, 94, 0.2);
}
.feedback-admin-reply-label {
  font-size: 12px;
  color: var(--primary);
  margin-bottom: 6px;
  font-weight: 600;
}
.feedback-admin-reply-text {
  font-size: 13px;
  color: #d1d5db;
  white-space: pre-wrap;
  line-height: 1.6;
  margin: 0;
}

/* 更新日志 */
.changelog-list {
  display: grid;
  gap: 12px;
}
.changelog-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--border);
  line-height: 1.6;
  font-size: 13px;
  color: #d1d5db;
}
.changelog-empty {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

/* 后台留言管理样式 */
.feedback-admin-list {
  display: grid;
  gap: 14px;
}
.feedback-admin-item {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.feedback-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.feedback-admin-meta {
  font-size: 12px;
  color: var(--muted);
}
.feedback-admin-actions {
  display: flex;
  gap: 8px;
}
.feedback-admin-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}
.feedback-admin-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
}
.feedback-admin-btn.danger {
  color: #fca5a5;
}
.feedback-admin-btn.danger:hover {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}
.feedback-admin-reply {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.feedback-admin-reply-label {
  font-size: 12px;
  color: var(--primary);
  margin-bottom: 6px;
  font-weight: 600;
}
.feedback-admin-reply-text {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.6;
  margin: 0;
}
.feedback-admin-reply-form {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.feedback-admin-reply-form textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.6);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 60px;
}
.feedback-admin-reply-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(11, 16, 32, 0.9);
}
.feedback-admin-reply-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-close-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
  background: linear-gradient(180deg, #16a34a, #15803d);
}
.modal-close-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}
/* 弹窗滚动条美化 */
.modal-container::-webkit-scrollbar {
  width: 8px;
}
.modal-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.modal-container::-webkit-scrollbar-thumb {
  background: rgba(34, 197, 94, 0.3);
  border-radius: 4px;
}
.modal-container::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 197, 94, 0.5);
}
@media (max-width: 640px) {
  .input-row { flex-direction: column; }
  .ad-rental { padding: 10px 12px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .rental-icon { font-size: 24px; }
  .rental-content { min-width: auto; }
  .ad-rental h3 { font-size: 15px; margin-bottom: 2px; }
  .rental-desc { font-size: 11px; }
  .rental-contact { padding: 6px 10px; font-size: 11px; }
  .contact-label { font-size: 11px; }
  .contact-wechat { font-size: 12px; }
  .recent-watches-section h2 { font-size: 16px; margin-bottom: 10px; }
  .recent-watches-list { gap: 10px; padding: 6px 2px 10px; }
  .watch-item { padding: 10px 12px; gap: 8px; min-width: 200px; }
  .watch-item-icon { font-size: 18px; }
  .watch-item-title { font-size: 13px; }
  .watch-item-time { font-size: 11px; }
  .modal-container { 
    padding: 12px; 
    max-width: 95%; 
    max-height: 90vh;
    border-radius: 12px;
  }
  .api-info-badge {
    position: static;
    width: auto;
    margin: 12px auto 0;
  }
  .analytics-grid { gap: 12px; }
  .analytics-block { min-width: 100%; }
  .modal-body {
    margin-bottom: 12px;
  }
  .modal-body img {
    max-width: 280px;
    margin: 0 auto 12px;
  }
  .modal-desc {
    padding: 12px;
  }
  .desc-title { 
    font-size: 14px;
    margin-bottom: 8px;
  }
  .desc-text {
    font-size: 12px;
    margin-bottom: 10px;
  }
  .desc-highlight {
    font-size: 13px;
    margin-bottom: 8px;
  }
  .desc-highlight strong {
    font-size: 15px;
  }
  .desc-list {
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 10px;
    padding-left: 18px;
  }
  .desc-list li {
    margin: 4px 0;
    padding-left: 4px;
  }
  .desc-footer {
    font-size: 11px;
  }
  .modal-close-btn { 
    font-size: 14px; 
    padding: 10px 16px;
    flex-shrink: 0;
  }
}
