/* ============================================
   Physics Lab - Global Styles
   Dark Tech Theme
   ============================================ */

/* 始终保留滚动条空间，防止滚动条出现/消失导致页面宽度变化引发抖动 */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

/* 禁止浏览器自动填充的视觉样式 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--ink, #e8eaf6) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg3, #1a1f4b) inset !important;
  transition: background-color 9999s ease-in-out 0s !important;
}

:root {
  --bg: #0a0e27;
  --bg2: #12163a;
  --bg3: #1a1f4b;
  --card-bg: #1a1f4b;
  --ink: #e8eaf6;
  --muted: #7986cb;
  --rule: rgba(255, 255, 255, .12);
  --border: rgba(255, 255, 255, .12);
  --accent: #00d4ff;
  --accent2: #ffd700;
  --danger: #ef4444;
  --success: #22c55e;
  --font-sans: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, .4);
  --shadow-glow: 0 0 20px rgba(0, 212, 255, .3);

  /* ===== 响应式自适应变量（由JS动态设置，提供fallback） ===== */
  --vw-scale: 1;
  --container-max: 1400px;
  --section-py: 5rem;
  --grid-gap: 1.5rem;
  --nav-py: .75rem;
  --nav-px: 2rem;
  --hero-py: 6rem;
  --card-icon-size: 2.5rem;
  --radius-scale: 12px;
}

html[data-theme="light"] {
  --bg: #f6f8ff;
  --bg2: #ffffff;
  --bg3: #eef3ff;
  --card-bg: #ffffff;
  --ink: #16213a;
  --muted: #60708f;
  --rule: rgba(30, 41, 59, .14);
  --border: rgba(30, 41, 59, .14);
  --accent: #2563eb;
  --accent2: #f59e0b;
  --shadow: 0 8px 28px rgba(15, 23, 42, .12);
  --shadow-glow: 0 0 18px rgba(37, 99, 235, .18);
}

html[data-theme="warm"] {
  --bg: #fff7ed;
  --bg2: #fffbeb;
  --bg3: #fdecc8;
  --card-bg: #fffbeb;
  --ink: #3b2a16;
  --muted: #8a6b3e;
  --rule: rgba(120, 80, 30, .18);
  --border: rgba(120, 80, 30, .18);
  --accent: #d97706;
  --accent2: #16a34a;
  --shadow: 0 8px 28px rgba(120, 53, 15, .13);
  --shadow-glow: 0 0 18px rgba(217, 119, 6, .16);
}

html[data-theme="blackboard"] {
  --bg: #0b1f18;
  --bg2: #12352a;
  --bg3: #1c4a3c;
  --card-bg: #12352a;
  --ink: #f0fdf4;
  --muted: #a7c8b7;
  --rule: rgba(220, 252, 231, .16);
  --border: rgba(220, 252, 231, .16);
  --accent: #86efac;
  --accent2: #fde68a;
  --shadow: 0 8px 32px rgba(0, 0, 0, .38);
  --shadow-glow: 0 0 18px rgba(134, 239, 172, .22);
}

html[data-theme="light"] body,
html[data-theme="warm"] body {
  background:
    radial-gradient(circle at 20% 15%, rgba(37, 99, 235, .08), transparent 28%),
    radial-gradient(circle at 78% 10%, rgba(245, 158, 11, .10), transparent 24%),
    var(--bg);
}

html[data-theme="light"] #starfield,
html[data-theme="warm"] #starfield {
  opacity: .18;
}

html[data-theme="light"] .navbar,
html[data-theme="warm"] .navbar {
  background: rgba(255, 255, 255, .76);
}

html[data-theme="light"] .navbar.scrolled,
html[data-theme="warm"] .navbar.scrolled {
  background: rgba(255, 255, 255, .94);
}

.nav-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: transform .18s, border-color .18s, background .18s;
}

.nav-icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(0, 212, 255, .12);
}

.nav-icon-dot {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 2px var(--bg2);
}

.theme-popover,
.notice-popover {
  position: fixed;
  top: 62px;
  right: 18px;
  z-index: 2200;
  width: min(360px, calc(100vw - 24px));
  display: none;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: rgba(18, 22, 58, .96);
  color: var(--ink);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

html[data-theme="light"] .theme-popover,
html[data-theme="light"] .notice-popover,
html[data-theme="warm"] .theme-popover,
html[data-theme="warm"] .notice-popover {
  background: rgba(255, 255, 255, .96);
}

.theme-popover.open,
.notice-popover.open,
.update-popover.open {
  display: block;
}

.update-popover {
  position: fixed;
  top: 62px;
  right: 18px;
  z-index: 2200;
  width: min(440px, calc(100vw - 24px));
  display: none;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: rgba(18, 22, 58, .96);
  color: var(--ink);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

html[data-theme="light"] .update-popover,
html[data-theme="warm"] .update-popover {
  background: rgba(255, 255, 255, .96);
}

.update-popover .popover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.version-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  padding: .2rem .55rem;
  border-radius: 999px;
}

.update-tabs {
  position: relative;
  display: flex;
  gap: .35rem;
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.update-tabs::-webkit-scrollbar { display: none; }

.update-tabs::before,
.update-tabs::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity .2s;
}

.update-tabs::before {
  left: 0;
  background: linear-gradient(to right, var(--bg, rgba(18,22,58,.96)), transparent);
}

.update-tabs::after {
  right: 0;
  background: linear-gradient(to left, var(--bg, rgba(18,22,58,.96)), transparent);
}

.update-tabs.can-scroll-left::before,
.update-tabs.can-scroll-right::after {
  opacity: 1;
}

.update-tab {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: .32rem .62rem;
  border-radius: 999px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .2s;
  font-weight: 600;
  white-space: nowrap;
}

.update-tab:hover {
  background: rgba(255,255,255,.08);
  color: var(--ink);
}

.update-tab.active {
  background: var(--accent);
  color: #fff;
}

.update-cat {
  font-size: .7rem;
  padding: .15rem .45rem;
  border-radius: 999px;
  font-weight: 600;
  flex-shrink: 0;
}

.cat-system { background: color-mix(in srgb, #6366f1 20%, transparent); color: #818cf8; }
.cat-update { background: color-mix(in srgb, #10b981 20%, transparent); color: #34d399; }
.cat-experiment { background: color-mix(in srgb, #f59e0b 20%, transparent); color: #fbbf24; }
.cat-notice { background: color-mix(in srgb, #3b82f6 20%, transparent); color: #60a5fa; }
.cat-activity { background: color-mix(in srgb, #ec4899 20%, transparent); color: #f472b6; }
.cat-info { background: color-mix(in srgb, #3b82f6 20%, transparent); color: #60a5fa; }

.update-footer {
  padding: .6rem .9rem;
  border-top: 1px solid var(--rule);
  font-size: .75rem;
  color: var(--muted);
  text-align: center;
}

.popover-head {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--rule);
  font-weight: 800;
}

.theme-options {
  display: grid;
  gap: .55rem;
  padding: .9rem;
}

.theme-option {
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: .75rem;
  background: rgba(255,255,255,.06);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.theme-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.theme-option b { display: block; margin-bottom: .15rem; }
.theme-option span { color: var(--muted); font-size: .82rem; }

.notice-list {
  max-height: min(520px, calc(100vh - 140px));
  overflow: auto;
  padding: .65rem;
}

.notice-item {
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: .8rem;
  margin-bottom: .55rem;
  background: rgba(255,255,255,.06);
}

.notice-item.unread { border-color: color-mix(in srgb, var(--accent) 58%, var(--rule)); }
.notice-title { display: flex; gap: .5rem; justify-content: space-between; font-weight: 800; margin-bottom: .35rem; }
.notice-meta { color: var(--muted); font-size: .74rem; margin-bottom: .4rem; }
.notice-body { color: var(--ink); font-size: .88rem; white-space: pre-wrap; }
.notice-empty { padding: 1.4rem; color: var(--muted); text-align: center; }

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .2s;
}

a:hover {
  color: var(--accent2);
}

img {
  max-width: 100%;
  display: block;
}

/* ============================================
   Canvas Background
   ============================================ */
#starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--nav-py) var(--nav-px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 14, 39, .7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--rule);
  transition: background .3s, box-shadow .3s;
}

.navbar.scrolled {
  background: rgba(10, 14, 39, .95);
  box-shadow: var(--shadow);
}

.navbar-brand {
  font-size: clamp(1.1rem, 1.3vw, 1.6rem);
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.navbar-brand span {
  color: var(--accent2);
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 2.5rem);
  list-style: none;
}

.navbar-nav a {
  color: var(--ink);
  font-size: clamp(.85rem, 1vw, 1.05rem);
  font-weight: 500;
  position: relative;
}

.navbar-nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width .3s;
}

.navbar-nav a:hover::after,
.navbar-nav a.active::after {
  width: 100%;
}

.navbar-nav a:hover {
  color: var(--accent);
}

.navbar-nav a.active {
  color: var(--accent);
}

.navbar-nav a.nav-highlight {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white;
  padding: .4rem .8rem;
  border-radius: 8px;
  font-weight: 600;
}

.navbar-nav a.nav-highlight::after {
  display: none;
}

.navbar-nav a.nav-highlight:hover {
  background: linear-gradient(135deg, #fbbf24, #fb923c);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249,115,22,.3);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: .78rem;
}

.nav-vip-info {
  display: none;
  align-items: center;
  padding: .22rem;
  border: 1px solid rgba(255, 215, 0, .35);
  border-radius: 999px;
  background: rgba(255, 215, 0, .08);
  color: var(--accent2);
  white-space: nowrap;
  margin-right: -.36rem;
}

.nav-vip-info.is-renew-warning {
  border-color: rgba(251, 146, 60, .55);
  background: rgba(251, 146, 60, .12);
  color: #ffb86c;
}

.nav-vip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: .12rem .45rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd700, #ff9f1c);
  color: #1a1200;
  font-weight: 800;
  letter-spacing: .04em;
}

.nav-logout-btn {
  white-space: nowrap;
}

/* 用户下拉菜单 */
.nav-user-menu {
  position: relative;
  display: none;
}

.nav-user-menu .user-menu-trigger {
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  transition: transform .2s;
  position: relative;
}

.nav-user-menu .user-menu-trigger:hover {
  transform: scale(1.05);
}

.nav-user-menu .user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 8px rgba(102, 126, 234, .3);
  overflow: hidden;
  position: relative;
}

.nav-user-menu .user-avatar.has-image {
  background-size: cover;
  background-position: center;
}

.nav-user-menu .user-menu-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 240px;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all .2s ease;
  padding: .5rem;
  z-index: 9999;
}

.nav-user-menu .user-menu-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 小三角指示 */
.nav-user-menu .user-menu-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 14px;
  width: 10px;
  height: 10px;
  background: var(--bg2);
  border-left: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  transform: rotate(45deg);
}

.nav-user-menu .user-menu-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem;
}

.nav-user-menu .user-menu-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(102, 126, 234, .35);
  border: 2px solid var(--bg3);
  overflow: hidden;
  position: relative;
}

.nav-user-menu .user-menu-avatar.has-image {
  background-size: cover;
  background-position: center;
}

.nav-user-menu .user-menu-info {
  flex: 1;
  min-width: 0;
}

.nav-user-menu .user-menu-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-menu .user-menu-role {
  font-size: .75rem;
  color: var(--muted);
  margin-top: 2px;
}

.nav-user-menu .user-menu-divider {
  height: 1px;
  background: var(--rule);
  margin: .25rem 0;
}

.nav-user-menu .user-menu-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  border-radius: 8px;
  color: var(--ink);
  font-size: .85rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all .15s;
  text-decoration: none;
}

.nav-user-menu .user-menu-item:hover {
  background: var(--bg3);
  color: var(--accent);
}

.nav-user-menu .user-menu-item svg {
  flex-shrink: 0;
  color: var(--muted);
}

.nav-user-menu .user-menu-item:hover svg {
  color: var(--accent);
}

.nav-user-menu .user-menu-danger {
  color: #ef4444;
}

.nav-user-menu .user-menu-danger:hover {
  background: rgba(239, 68, 68, .1);
  color: #ef4444;
}

.nav-user-menu .user-menu-danger svg {
  color: #ef4444;
}

.nav-user-menu .user-menu-danger:hover svg {
  color: #ef4444;
}

/* 主题适配：浅色/温暖主题下用户菜单 */
html[data-theme="light"] .nav-user-menu .user-menu-dropdown,
html[data-theme="warm"] .nav-user-menu .user-menu-dropdown {
  background: #ffffff;
  border-color: rgba(30, 41, 59, .12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .12);
}

html[data-theme="light"] .nav-user-menu .user-menu-dropdown::before,
html[data-theme="warm"] .nav-user-menu .user-menu-dropdown::before {
  background: #ffffff;
  border-color: rgba(30, 41, 59, .12);
}

html[data-theme="light"] .nav-user-menu .user-menu-name,
html[data-theme="warm"] .nav-user-menu .user-menu-name {
  color: #16213a;
}

html[data-theme="light"] .nav-user-menu .user-menu-role,
html[data-theme="warm"] .nav-user-menu .user-menu-role {
  color: #60708f;
}

html[data-theme="light"] .nav-user-menu .user-menu-item,
html[data-theme="warm"] .nav-user-menu .user-menu-item {
  color: #334155;
}

html[data-theme="light"] .nav-user-menu .user-menu-item:hover,
html[data-theme="warm"] .nav-user-menu .user-menu-item:hover {
  background: #f1f5f9;
  color: #2563eb;
}

html[data-theme="light"] .nav-user-menu .user-menu-item:hover svg,
html[data-theme="warm"] .nav-user-menu .user-menu-item:hover svg {
  color: #2563eb;
}

html[data-theme="light"] .nav-user-menu .user-menu-item svg,
html[data-theme="warm"] .nav-user-menu .user-menu-item svg {
  color: #94a3b8;
}

html[data-theme="light"] .nav-user-menu .user-menu-divider,
html[data-theme="warm"] .nav-user-menu .user-menu-divider {
  background: rgba(30, 41, 59, .08);
}

html[data-theme="light"] .nav-user-menu .user-menu-avatar,
html[data-theme="warm"] .nav-user-menu .user-menu-avatar {
  border-color: #f1f5f9;
}

/* 黑板主题下用户菜单适配 */
html[data-theme="blackboard"] .nav-user-menu .user-menu-dropdown {
  background: #1a3a2a;
  border-color: rgba(255, 255, 255, .15);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
}

html[data-theme="blackboard"] .nav-user-menu .user-menu-dropdown::before {
  background: #1a3a2a;
  border-color: rgba(255, 255, 255, .15);
}

html[data-theme="blackboard"] .nav-user-menu .user-menu-item:hover {
  background: rgba(255, 255, 255, .1);
}

/* 响应式：小屏幕下调整用户菜单 */
@media (max-width: 768px) {
  .nav-user-menu .user-menu-trigger {
    width: 34px;
    height: 34px;
  }
  .nav-user-menu .user-avatar {
    width: 34px;
    height: 34px;
    font-size: .9rem;
  }
  .nav-user-menu .user-menu-dropdown {
    position: fixed;
    top: auto;
    bottom: 20px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: 320px;
    margin: 0 auto;
  }
  .nav-user-menu .user-menu-dropdown::before {
    display: none;
  }
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: .5rem;
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ink);
  transition: .3s;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: clamp(.45rem, .7vw, .8rem) clamp(1rem, 1.5vw, 1.75rem);
  border-radius: var(--radius);
  font-size: clamp(.85rem, 1vw, 1rem);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0099cc);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 212, 255, .3);
}

.btn-primary:hover {
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-secondary:hover {
  background: rgba(0, 212, 255, .1);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #cc0000);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #16a34a);
  color: #fff;
}

.btn-gold {
  background: linear-gradient(135deg, var(--accent2), #ffaa00);
  color: #1a1a1a;
  box-shadow: 0 4px 15px rgba(255, 215, 0, .3);
}

.btn-gold:hover {
  box-shadow: 0 0 20px rgba(255, 215, 0, .4);
}

.btn-sm {
  padding: .35rem .85rem;
  font-size: clamp(.75rem, .8vw, .9rem);
}

.btn-lg {
  padding: clamp(.6rem, .9vw, 1rem) clamp(1.5rem, 2.5vw, 2.75rem);
  font-size: clamp(.95rem, 1.2vw, 1.15rem);
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: rgba(26, 31, 75, .6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(1rem, 1.5vw, 1.75rem);
  transition: transform .3s, box-shadow .3s, border-color .3s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(0, 212, 255, .3);
}

.card-title {
  font-size: clamp(1rem, 1.3vw, 1.3rem);
  font-weight: 700;
  margin-bottom: .5rem;
  color: var(--ink);
}

.card-text {
  color: var(--muted);
  font-size: clamp(.8rem, 1vw, .95rem);
  line-height: 1.5;
}

.card-icon {
  font-size: var(--card-icon-size);
  margin-bottom: 1rem;
}

.card-badge {
  display: inline-block;
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: .75rem;
}

.badge-free {
  background: rgba(34, 197, 94, .2);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, .3);
}

.badge-vip {
  background: rgba(255, 215, 0, .2);
  color: var(--accent2);
  border: 1px solid rgba(255, 215, 0, .3);
}

.badge-category {
  background: rgba(0, 212, 255, .15);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, .25);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: .6rem;
  font-size: clamp(.85rem, 1vw, 1rem);
  font-weight: 600;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: clamp(.6rem, .8vw, .9rem) clamp(.8rem, 1vw, 1.1rem);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(.9rem, 1vw, 1.05rem);
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, .15);
  background: rgba(255, 255, 255, .08);
}

.form-input::placeholder {
  color: rgba(121, 134, 203, .5);
}

.form-hint {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .25rem;
}

.form-error {
  font-size: .85rem;
  color: var(--danger);
  margin-top: .25rem;
}

/* ============================================
   Layout Utilities
   ============================================ */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(1rem, 2vw, 2rem);
  position: relative;
  z-index: 1;
}

.section {
  padding: var(--section-py) 0;
}

.section-title {
  font-size: clamp(1.6rem, 2.8vw, 2.6rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--ink), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: clamp(1.5rem, 3vw, 3rem);
  font-size: clamp(.9rem, 1.1vw, 1.1rem);
}

.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.gap-2 {
  gap: 2rem;
}

.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 2rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--hero-py) clamp(1rem, 2vw, 2rem) 4rem;
  position: relative;
}

.hero-content {
  max-width: clamp(600px, 70vw, 900px);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
  background: linear-gradient(135deg, var(--ink), var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  color: var(--muted);
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: var(--bg2);
  border-top: 1px solid var(--rule);
  padding: 3rem 0 2rem;
  position: relative;
  z-index: 1;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: clamp(1rem, 2vw, 2.5rem);
  margin-bottom: 2rem;
}

.footer-brand {
  font-size: clamp(1.1rem, 1.2vw, 1.4rem);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: .75rem;
}

.footer-desc {
  color: var(--muted);
  font-size: clamp(.8rem, 1vw, .95rem);
  line-height: 1.6;
}

.footer-title {
  font-size: clamp(.95rem, 1.1vw, 1.1rem);
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--ink);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: .5rem;
}

.footer-links a {
  color: var(--muted);
  font-size: clamp(.8rem, 1vw, .95rem);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
  padding: clamp(5rem, 8vw, 9rem) 0 clamp(2rem, 4vw, 4rem);
  text-align: center;
  position: relative;
}

.page-title {
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  font-weight: 800;
  margin-bottom: .75rem;
  background: linear-gradient(135deg, var(--ink), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-desc {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================
   Tabs
   ============================================ */
.tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.tab {
  padding: .6rem 1.25rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--rule);
  color: var(--muted);
  cursor: pointer;
  transition: .2s;
  font-size: .9rem;
  font-weight: 500;
}

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

.tab.active {
  background: rgba(0, 212, 255, .15);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(0, 212, 255, .3); }
  50% { box-shadow: 0 0 20px rgba(0, 212, 255, .6); }
}

.animate-fadeIn {
  animation: fadeIn .6s ease forwards;
}

.animate-slideUp {
  animation: slideUp .6s ease forwards;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

/* Stagger children */
.stagger > * {
  opacity: 0;
  animation: slideUp .5s ease forwards;
}

.stagger > *:nth-child(1) { animation-delay: .1s; }
.stagger > *:nth-child(2) { animation-delay: .2s; }
.stagger > *:nth-child(3) { animation-delay: .3s; }
.stagger > *:nth-child(4) { animation-delay: .4s; }
.stagger > *:nth-child(5) { animation-delay: .5s; }
.stagger > *:nth-child(6) { animation-delay: .6s; }

/* ============================================
   Auth Pages
   ============================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 1.5rem 2rem;
}

.auth-card {
  width: 100%;
  max-width: clamp(360px, 45vw, 520px);
  background: rgba(18, 22, 58, .9);
  backdrop-filter: blur(24px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3vw, 3rem);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .4);
}

.auth-header {
  text-align: center;
  margin-bottom: 2.25rem;
}

.auth-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: .6rem;
  color: var(--ink);
}

.auth-header p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.auth-footer {
  text-align: center;
  margin-top: 1.75rem;
  color: var(--muted);
  font-size: .95rem;
}

/* ============================================
   VIP Page
   ============================================ */
.pricing-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2vw, 2.5rem);
  max-width: clamp(700px, 80vw, 1100px);
  margin: 0 auto;
}

.pricing-card {
  background: rgba(26, 31, 75, .6);
  backdrop-filter: blur(16px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 2vw, 2.5rem);
  text-align: center;
  transition: transform .3s, box-shadow .3s;
  display: flex;
  flex-direction: column;
}

.pricing-card:hover {
  transform: translateY(-4px);
}

.pricing-card.featured {
  border-color: var(--accent2);
  box-shadow: 0 0 30px rgba(255, 215, 0, .15);
  position: relative;
}

.pricing-card.featured::before {
  content: '推荐';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent2);
  color: #1a1a1a;
  padding: .25rem 1rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 700;
}

.pricing-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.pricing-price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: .25rem;
}

.pricing-price span {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
}

.pricing-period {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 2rem;
  flex-grow: 1;
}

.pricing-card .btn {
  margin-top: auto;
}

.pricing-features li {
  padding: .5rem 0;
  color: var(--muted);
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.pricing-features li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
}

/* ============================================
   Profile Page
   ============================================ */
.profile-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 3rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.profile-avatar-wrap {
  position: relative;
  display: inline-block;
}

.avatar-change-hint {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: .7rem;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

.profile-avatar-wrap:hover .avatar-change-hint {
  opacity: 1;
}

.profile-avatar-wrap:hover .profile-avatar {
  box-shadow: 0 0 0 3px var(--accent), 0 8px 24px rgba(0, 0, 0, .15);
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--bg);
  overflow: hidden;
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: box-shadow .2s;
}

.profile-info h2 {
  font-size: 1.8rem;
  margin-bottom: .5rem;
}

.profile-meta {
  display: flex;
  gap: 1.5rem;
  color: var(--muted);
  font-size: .9rem;
}

.profile-section {
  margin-bottom: 2rem;
}

.profile-section h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule);
}

/* ============================================
   Experiment Detail
   ============================================ */
.experiment-page-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 1.25rem;
}

.experiment-back-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .55rem 1rem;
  border: 1px solid rgba(0, 212, 255, .35);
  border-radius: 999px;
  background: rgba(0, 212, 255, .1);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s, background .2s, border-color .2s;
}

.experiment-back-btn:hover {
  transform: translateY(-1px);
  background: rgba(0, 212, 255, .16);
  border-color: var(--accent);
}

.experiment-frame {
  position: relative;
  width: 100%;
  height: min(76vh, 820px);
  min-height: 660px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg2);
  overflow: hidden;
}

.experiment-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.experiment-frame:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: none;
  border-radius: 0;
  background: #050816;
}

.experiment-frame:fullscreen iframe {
  width: 100vw;
  height: 100vh;
}

.experiment-fullscreen-btn {
  position: absolute;
  right: .85rem;
  top: .85rem;
  z-index: 5;
  padding: .45rem .75rem;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  background: rgba(5, 8, 22, .72);
  color: #fff;
  font-size: .85rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

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

.experiment-info {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.experiment-sidebar .card {
  margin-bottom: 1rem;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.toast {
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  background: var(--bg3);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-size: .9rem;
  box-shadow: var(--shadow);
  animation: slideUp .3s ease;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 280px;
}

.toast-success {
  border-color: rgba(34, 197, 94, .4);
  background: rgba(34, 197, 94, .1);
}

.toast-error {
  border-color: rgba(239, 68, 68, .4);
  background: rgba(239, 68, 68, .1);
}

.toast-info {
  border-color: rgba(0, 212, 255, .4);
  background: rgba(0, 212, 255, .1);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 992px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-cards { grid-template-columns: 1fr; }
  .experiment-info { grid-template-columns: 1fr; }
  :root {
    --container-max: 100%;
  }
}

@media (max-width: 768px) {
  :root {
    --container-max: 100%;
    --section-py: 3.5rem;
    --grid-gap: 1rem;
    --nav-py: .5rem;
    --nav-px: 1rem;
    --hero-py: 4rem;
  }

  .navbar-nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(10, 14, 39, .98);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--rule);
    transform: translateY(-150%);
    transition: transform .3s;
  }

  .navbar-nav.open {
    transform: translateY(0);
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .navbar-actions {
    display: none;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.8rem;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5 {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .profile-meta {
    justify-content: center;
  }

  .page-title {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  :root {
    --container-max: 100%;
    --section-py: 2.5rem;
    --grid-gap: .75rem;
    --nav-py: .4rem;
    --nav-px: .75rem;
    --hero-py: 3rem;
  }

  .auth-card {
    padding: 1.25rem;
  }

  .pricing-card {
    padding: 1.25rem;
  }
}

/* ============================================
   Large Screen Adaptation
   ============================================ */
@media (min-width: 1440px) {
  :root {
    --container-max: 1600px;
    --section-py: 6rem;
    --grid-gap: 1.75rem;
    --nav-py: 1rem;
    --nav-px: 2.5rem;
    --hero-py: 7rem;
    --card-icon-size: 2.75rem;
  }
}

@media (min-width: 1680px) {
  :root {
    --container-max: 1800px;
    --section-py: 7rem;
    --grid-gap: 2rem;
    --nav-py: 1.1rem;
    --nav-px: 3rem;
    --hero-py: 8rem;
    --card-icon-size: 3rem;
  }
}

@media (min-width: 1920px) {
  :root {
    --container-max: 2000px;
    --section-py: 8rem;
    --grid-gap: 2.25rem;
    --nav-py: 1.2rem;
    --nav-px: 3.5rem;
    --hero-py: 9rem;
    --card-icon-size: 3.25rem;
  }

  html {
    font-size: 17px;
  }
}

@media (min-width: 2560px) {
  :root {
    --container-max: 2400px;
    --section-py: 10rem;
    --grid-gap: 3rem;
    --nav-py: 1.5rem;
    --nav-px: 4rem;
    --hero-py: 11rem;
    --card-icon-size: 3.75rem;
  }

  html {
    font-size: 18px;
  }
}

@media (min-width: 3840px) {
  :root {
    --container-max: 3200px;
    --section-py: 14rem;
    --grid-gap: 4rem;
    --nav-py: 2rem;
    --nav-px: 5rem;
    --hero-py: 14rem;
    --card-icon-size: 5rem;
  }

  html {
    font-size: 20px;
  }
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Selection */
::selection {
  background: rgba(0, 212, 255, .3);
  color: var(--ink);
}

/* ============================================
   Grade Tabs
   ============================================ */
.grade-tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.grade-tab {
  padding: .8rem 2rem;
  border-radius: 30px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--rule);
  color: var(--muted);
  cursor: pointer;
  transition: .3s;
  font-size: 1rem;
  font-weight: 600;
}

.grade-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.grade-tab.active {
  background: linear-gradient(135deg, var(--accent), #0099cc);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

/* ============================================
   Experiments Tree
   ============================================ */
.experiments-tree {
  max-width: 900px;
  margin: 0 auto;
}

.tree-chapter {
  margin-bottom: .5rem;
}

.tree-chapter-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.5rem;
  background: rgba(26, 31, 75, .8);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  transition: .3s;
}

.tree-chapter-header:hover {
  background: rgba(26, 31, 75, 1);
  border-color: rgba(0, 212, 255, .3);
}

.tree-chapter.expanded .tree-chapter-header {
  background: rgba(0, 212, 255, .1);
  border-color: rgba(0, 212, 255, .4);
}

.tree-arrow {
  font-size: .75rem;
  color: var(--accent);
  transition: transform .3s;
}

.tree-chapter-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.tree-chapter-content {
  padding-left: 1rem;
  margin-top: .5rem;
}

.tree-section {
  margin-bottom: .5rem;
}

.tree-section-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  background: rgba(18, 22, 58, .8);
  border: 1px solid var(--rule);
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  transition: .3s;
}

.tree-section-header:hover {
  background: rgba(18, 22, 58, 1);
  border-color: rgba(0, 212, 255, .2);
}

.tree-section.expanded .tree-section-header {
  background: rgba(0, 212, 255, .08);
}

.tree-section-title {
  font-size: .9rem;
  color: var(--muted);
}

.tree-section-content {
  padding-left: 1rem;
  margin-top: .75rem;
}

.experiment-grid {
  gap: 1rem;
}

.experiment-card {
  background: rgba(10, 14, 39, .6);
}

/* ============================================
   Admin Panel
   ============================================ */
.admin-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
}

.admin-tab {
  padding: clamp(.4rem, .6vw, .6rem) clamp(1rem, 1.5vw, 1.5rem);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--rule);
  color: var(--muted);
  cursor: pointer;
  transition: .2s;
  font-size: clamp(.8rem, 1vw, 1rem);
  font-weight: 600;
}

.admin-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.admin-tab.active {
  background: rgba(0, 212, 255, .15);
  border-color: var(--accent);
  color: var(--accent);
}

.admin-toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.admin-search {
  flex: 1;
  min-width: 200px;
}

.admin-filter {
  width: auto;
  min-width: 140px;
  cursor: pointer;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(18, 22, 58, .8);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}

.admin-table th {
  background: rgba(0, 212, 255, .1);
  color: var(--accent);
  font-weight: 600;
  font-size: .9rem;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover {
  background: rgba(0, 212, 255, .05);
}

.admin-table .badge {
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}

.profile-avatar-small {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-image: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 700;
  color: var(--bg);
  overflow: hidden;
  position: relative;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

/* ============================================
   Modal
   ============================================ */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, .8);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.modal-header h3 {
  font-size: 1.2rem;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color .2s;
}

.modal-close:hover {
  color: var(--ink);
}

/* ============================================
   使用说明弹窗样式（主题感知）
   ============================================ */
.guide-modal {
  background: var(--card-bg);
  color: var(--ink);
}

.guide-close-btn {
  background: var(--border);
  border: 1px solid var(--border);
  color: var(--ink);
}

.guide-close-btn:hover {
  background: rgba(239, 68, 68, .15) !important;
  color: var(--danger) !important;
  border-color: var(--danger) !important;
}

.guide-h3 { color: var(--ink); }

.guide-count-tag {
  color: var(--accent);
  background: rgba(59, 130, 246, .12);
}

.guide-subtitle { color: var(--muted); }

.guide-card {
  border: 1px solid var(--border);
  border-left: 3px solid #3b82f6;
  background: var(--bg3);
}
.guide-card-title { color: var(--ink); }
.guide-card-desc  { color: var(--muted); }

.guide-card-blue   { border-left-color: #3b82f6; background: rgba(59,130,246,.12); }
.guide-card-green  { border-left-color: #22c55e; background: rgba(34,197,94,.12); }
.guide-card-orange { border-left-color: #f97316; background: rgba(249,115,22,.12); }
.guide-card-purple { border-left-color: #a855f7; background: rgba(168,85,247,.12); }

html[data-theme="light"] .guide-card-blue,
html[data-theme="warm"]  .guide-card-blue   { background: #eef3ff; border-color: #dbeafe; border-left-color: #3b82f6; }
html[data-theme="light"] .guide-card-green,
html[data-theme="warm"]  .guide-card-green  { background: #ecfdf5; border-color: #d1fae5; border-left-color: #22c55e; }
html[data-theme="light"] .guide-card-orange,
html[data-theme="warm"]  .guide-card-orange { background: #fff7ed; border-color: #ffedd5; border-left-color: #f97316; }
html[data-theme="light"] .guide-card-purple,
html[data-theme="warm"]  .guide-card-purple { background: #faf5ff; border-color: #f3e8ff; border-left-color: #a855f7; }

.guide-qr-section {
  border-top: 1px solid var(--border);
  background: var(--bg3);
}
.guide-qr-title { color: var(--ink); }
.guide-qr-desc  { color: var(--muted); }
.guide-qr-hint  { color: var(--accent); }

html[data-theme="light"] .guide-qr-section,
html[data-theme="warm"]  .guide-qr-section { background: #eef3ff; }

.guide-confirm-btn {
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(59, 130, 246, .3);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 1px solid var(--rule);
}

/* ============================================
   Responsive for Admin
   ============================================ */
@media (max-width: 768px) {
  .admin-toolbar {
    flex-direction: column;
  }
  
  .admin-search,
  .admin-filter {
    width: 100%;
    min-width: auto;
  }
  
  .admin-table {
    overflow-x: auto;
    display: block;
  }
  
  .admin-table th,
  .admin-table td {
    padding: .75rem .5rem;
    font-size: .85rem;
  }
  
  .grade-tab {
    padding: .6rem 1.25rem;
    font-size: .9rem;
  }
  
  .tree-chapter-header,
  .tree-section-header {
    padding: .75rem 1rem;
  }
}
#oo-perm-indicator { display: none !important; }
