:root {
  color-scheme: light dark;
  --bg: #eef2fb;
  --bg-2: #dfe7f7;
  --text: #0f172a;
  --muted: #64748b;
  --card: rgba(255, 255, 255, 0.7);
  --card-strong: rgba(255, 255, 255, 0.9);
  --field: rgba(255, 255, 255, 0.5);
  --primary: #5b7cfa;
  --primary-contrast: #f8fafc;
  --border: rgba(148, 163, 184, 0.35);
  --danger: #ef4444;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.6), 0 18px 40px rgba(91, 124, 250, 0.22);
  --radius: 22px;
  --glass: blur(20px);
}

body[data-theme="dark"] {
  --bg: #0a0f1d;
  --bg-2: #121a33;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --card: rgba(17, 25, 40, 0.72);
  --card-strong: rgba(17, 25, 40, 0.88);
  --field: rgba(255, 255, 255, 0.08);
  --primary: #6d8bff;
  --primary-contrast: #0b1020;
  --border: rgba(148, 163, 184, 0.18);
  --shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px rgba(148, 163, 184, 0.2), 0 25px 55px rgba(88, 118, 255, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top, rgba(124, 160, 255, 0.25), transparent 55%),
    radial-gradient(circle at 20% 20%, rgba(125, 211, 252, 0.22), transparent 45%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body[data-motion="off"] * {
  transition: none !important;
  animation: none !important;
}

body::before {
  content: "";
  position: fixed;
  inset: -20%;
  background: radial-gradient(circle at 70% 30%, rgba(99, 102, 241, 0.18), transparent 45%),
    radial-gradient(circle at 30% 70%, rgba(56, 189, 248, 0.2), transparent 50%);
  filter: blur(40px);
  opacity: 0.9;
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: -10%;
  background: radial-gradient(circle at 20% 40%, rgba(59, 130, 246, 0.12), transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(129, 140, 248, 0.14), transparent 55%),
    radial-gradient(circle at 70% 80%, rgba(14, 165, 233, 0.1), transparent 55%);
  opacity: 0.7;
  filter: blur(50px);
  z-index: -2;
  pointer-events: none;
}

body[data-motion="on"]::before {
  animation: auroraShift 14s ease-in-out infinite alternate;
}

body[data-motion="on"]::after {
  animation: auroraDrift 18s ease-in-out infinite alternate;
}

.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -3;
  opacity: 0.75;
  filter: saturate(1.05) blur(2px);
}

.bg-video.is-paused {
  opacity: 0.65;
  filter: saturate(0.95) blur(2px);
}

.bg-video.is-hidden {
  display: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.container {
  width: min(1200px, 92vw);
  margin: 120px auto 80px;
}

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 48px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: var(--glass);
  box-shadow: var(--shadow);
}

.brand {
  font-weight: 700;
  font-size: 18px;
}

.nav-links {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--muted);
  flex-wrap: wrap;
}

.nav-links a {
  padding: 6px 12px;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(91, 124, 250, 0.15);
  box-shadow: 0 0 0 1px rgba(91, 124, 250, 0.25);
}

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

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
}

.primary {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.35), rgba(91, 124, 250, 0.85));
  color: var(--primary-contrast);
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ghost {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: var(--glass);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body[data-motion="on"] .primary:hover,
body[data-motion="on"] .ghost:hover {
  transform: translateY(-2px) scale(1.01);
}

.ghost.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.message {
  margin-top: 12px;
  color: var(--danger);
  font-size: 14px;
}

.message.success {
  color: #16a34a;
}

.gate {
  display: grid;
  gap: 16px;
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.gate form {
  display: flex;
  gap: 8px;
}

.gate input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.15);
}

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 32px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #94a3b8, #cbd5f5);
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.5), 0 0 30px rgba(91, 124, 250, 0.4);
}

.avatar.has-image {
  background-color: transparent;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.section {
  margin-bottom: 24px;
}

.list {
  padding-left: 18px;
  color: var(--muted);
}

.list-link {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.list-item {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.item-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.tools-grid {
  display: grid;
  gap: 16px;
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: var(--glass);
  box-shadow: var(--shadow);
}

.tool-card span {
  font-size: 13px;
  color: var(--primary);
}

.tool-card.disabled,
.list-link.disabled,
.primary.disabled,
.ghost.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.card-link {
  display: inline-flex;
  margin-top: 8px;
  color: var(--primary);
  font-size: 13px;
}

.rich-content {
  color: var(--muted);
  line-height: 1.6;
}

.rich-content ul,
.rich-content ol {
  padding-left: 18px;
}

body[data-motion="on"] .tool-card:hover {
  transform: translateY(-8px) rotateX(2deg);
  box-shadow: var(--glow);
}

body[data-motion="on"] .site-header,
body[data-motion="on"] .hero,
body[data-motion="on"] .card,
body[data-motion="on"] .gate {
  animation: riseFade 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

body[data-motion="on"] .hero {
  animation-delay: 0.05s;
}

body[data-motion="on"] .card {
  animation-delay: 0.08s;
}

body[data-motion="on"] .tools-grid .tool-card {
  animation: cardLift 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

body[data-motion="on"] .tools-grid .tool-card:nth-child(1) { animation-delay: 0.05s; }
body[data-motion="on"] .tools-grid .tool-card:nth-child(2) { animation-delay: 0.12s; }
body[data-motion="on"] .tools-grid .tool-card:nth-child(3) { animation-delay: 0.18s; }
body[data-motion="on"] .tools-grid .tool-card:nth-child(4) { animation-delay: 0.24s; }
body[data-motion="on"] .tools-grid .tool-card:nth-child(5) { animation-delay: 0.3s; }
body[data-motion="on"] .tools-grid .tool-card:nth-child(6) { animation-delay: 0.36s; }

body[data-motion="on"] .avatar {
  animation: avatarPulse 4.5s ease-in-out infinite;
}

body[data-motion="on"] .primary {
  position: relative;
  overflow: hidden;
}

body[data-motion="on"] .primary::after {
  content: "";
  position: absolute;
  inset: -40% -120%;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  opacity: 0.5;
  transform: translateX(-30%);
  animation: sheen 3.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes riseFade {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes cardLift {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes avatarPulse {
  0% {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.55), 0 0 28px rgba(91, 124, 250, 0.35);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.35), 0 0 45px rgba(91, 124, 250, 0.6);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.55), 0 0 28px rgba(91, 124, 250, 0.35);
  }
}

@keyframes sheen {
  0% {
    transform: translateX(-40%);
    opacity: 0;
  }
  35% {
    opacity: 0.6;
  }
  70% {
    transform: translateX(40%);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

@keyframes auroraShift {
  from {
    transform: translateY(-2%) scale(1);
    opacity: 0.75;
  }
  to {
    transform: translateY(2%) scale(1.06);
    opacity: 0.9;
  }
}

@keyframes auroraDrift {
  from {
    transform: translateX(-2%) scale(1.02);
    opacity: 0.65;
  }
  to {
    transform: translateX(2%) scale(1.08);
    opacity: 0.85;
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-content {
  width: min(520px, 92vw);
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  gap: 12px;
  backdrop-filter: var(--glass);
  box-shadow: var(--shadow);
}

.modal-content form {
  display: grid;
  gap: 12px;
}

.modal-content label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.content-section {
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.avatar-editor {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.avatar.preview {
  width: 96px;
  height: 96px;
}

.avatar-actions {
  display: grid;
  gap: 8px;
}

.file-button input {
  display: none;
}

.list-editor {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.list-item-editor {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 12px;
  background: var(--card);
}

.list-item-header {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.field-label {
  font-weight: 600;
  font-size: 13px;
}

.rich-editor-wrapper {
  display: grid;
  gap: 8px;
}

.rich-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rich-editor {
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--field);
  color: var(--text);
}

.content-footer {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.admin-toolbar input {
  flex: 1;
  min-width: 200px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
}

.temp-code-panel {
  display: grid;
  gap: 12px;
}

.temp-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.temp-code-current {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
}

.temp-code-current .label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.temp-code-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.temp-code-list-header,
.temp-code-list-item {
  display: grid;
  grid-template-columns: 1fr 0.6fr 1fr 1fr;
  gap: 8px;
  font-size: 13px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.temp-code-list-item.valid span:nth-child(2) {
  color: #16a34a;
}

.temp-code-list-item.expired span:nth-child(2) {
  color: var(--muted);
}

.temp-code-list-item.revoked span:nth-child(2) {
  color: var(--danger);
}

.status-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-filters .active {
  border-color: var(--primary);
  color: var(--primary);
}

.admin-tabs .active {
  border-color: var(--primary);
  color: var(--primary);
}

.admin-layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.admin-list-header,
.admin-list-item {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr 0.8fr 1fr;
  gap: 8px;
  font-size: 13px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.admin-list-header {
  color: var(--muted);
}

.admin-list-item {
  cursor: pointer;
}

.admin-list-item:hover {
  background: rgba(59, 130, 246, 0.08);
}

.detail-grid {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

input,
textarea,
select {
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
}

input:focus,
textarea:focus,
select:focus,
button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(91, 124, 250, 0.35);
}

.admin-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-send {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

@media (max-width: 1024px) {
  .tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .site-header {
    flex-wrap: wrap;
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .avatar-editor {
    flex-direction: column;
    align-items: flex-start;
  }
  .temp-code-list-header,
  .temp-code-list-item {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .tools-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
  .container {
    margin-top: 40px;
  }
  .site-header {
    padding: 16px;
  }
  .hero {
    grid-template-columns: 1fr;
  }
}
