:root {
  color-scheme: dark;
  --milk: #f7f3ea;
  --milk-2: #fffaf0;
  --paper: rgba(255, 250, 240, 0.94);
  --paper-soft: rgba(247, 243, 234, 0.88);
  --ink: #1b2430;
  --ink-soft: #3f4a5a;
  --muted-dark: #637083;
  --neon-cyan: #41f6ff;
  --neon-purple: #9b5cff;
  --line-soft: rgba(65, 246, 255, 0.35);
  --bg: #050711;
  --bg-deep: #080b19;
  --panel: rgba(9, 16, 34, 0.72);
  --panel-strong: rgba(11, 22, 45, 0.88);
  --line: rgba(74, 229, 255, 0.24);
  --line-strong: rgba(119, 250, 255, 0.44);
  --text: #eef8ff;
  --muted: #92a7be;
  --cyan: #47f7ff;
  --blue: #38a7ff;
  --pink: #f25dff;
  --purple: #8d6bff;
  --ok: #3cffc2;
  --warn: #ffb454;
  --bad: #ff5277;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  --glow-cyan: 0 0 18px rgba(71, 247, 255, 0.42);
  --glow-pink: 0 0 20px rgba(242, 93, 255, 0.25);
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  min-width: 0;
}

html {
  min-height: 100%;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.58;
  background:
    linear-gradient(115deg, rgba(9, 19, 44, 0.98), rgba(5, 7, 17, 1) 46%, rgba(22, 8, 43, 0.96)),
    repeating-linear-gradient(90deg, rgba(71, 247, 255, 0.055) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg, rgba(141, 107, 255, 0.045) 0 1px, transparent 1px 42px);
  background-attachment: fixed;
  overflow-x: hidden;
  overflow-wrap: anywhere;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent, rgba(71, 247, 255, 0.055) 50%, transparent),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px);
  mix-blend-mode: screen;
  opacity: 0.5;
}

a {
  color: var(--cyan);
}

.shell,
.admin-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(34px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  overflow-x: clip;
  color: var(--ink);
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.96), rgba(247, 243, 234, 0.9));
  box-shadow:
    0 0 24px rgba(65, 246, 255, 0.16),
    0 0 48px rgba(155, 92, 255, 0.12),
    0 24px 70px rgba(0, 0, 0, 0.34);
}

.admin-shell {
  width: min(100%, 1360px);
}

.hero {
  padding: 16px 4px 18px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: var(--glow-cyan);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: #12283b;
  font-size: 28px;
  line-height: 1.18;
  text-shadow: 0 0 18px rgba(65, 246, 255, 0.26), 0 0 24px rgba(155, 92, 255, 0.12);
  overflow-wrap: anywhere;
}

h2 {
  color: #12283b;
  font-size: 17px;
  line-height: 1.3;
  text-shadow: 0 0 12px rgba(65, 246, 255, 0.18);
}

.hero p,
.hint,
.muted,
.meta {
  color: var(--muted-dark);
}

.hero p {
  margin: 9px 0 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.grid,
main.admin-grid {
  display: grid;
  gap: 14px;
  min-width: 0;
}

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

.card,
section {
  position: relative;
  overflow: hidden;
  margin: 0 0 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: linear-gradient(145deg, rgba(255, 250, 240, 0.94), rgba(247, 243, 234, 0.86));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  min-width: 0;
}

.card::after,
section::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(65, 246, 255, 0.16), transparent);
  opacity: 0.36;
  transform: translateX(-100%);
  animation: panel-scan 7s ease-in-out infinite;
}

.wide {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-kicker {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hint {
  margin: 8px 0 12px;
  font-size: 14px;
}

.status {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(65, 246, 255, 0.28);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}

.dot {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 12px currentColor;
}

.dot.ok,
.ok {
  color: var(--ok);
}

.dot.ok {
  background: var(--ok);
}

.dot.warn,
.warn {
  color: var(--warn);
}

.dot.warn {
  background: var(--warn);
}

.dot.bad,
.bad {
  color: var(--bad);
}

.dot.bad {
  background: var(--bad);
}

.status-title {
  color: var(--ink);
  font-weight: 800;
}

.status-msg {
  color: var(--ink-soft);
  font-size: 14px;
}

.actions,
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.row {
  display: flex;
  flex-wrap: wrap;
}

button {
  max-width: 100%;
  min-height: 44px;
  border: 1px solid rgba(71, 247, 255, 0.46);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(24, 62, 99, 0.78), rgba(8, 22, 47, 0.86));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 18px rgba(71, 247, 255, 0.18);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 10px 14px;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  animation: neon-breathe 3.8s ease-in-out infinite;
}

button:hover {
  border-color: rgba(71, 247, 255, 0.82);
  box-shadow: var(--glow-cyan), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

button.secondary {
  border-color: rgba(141, 107, 255, 0.46);
  background: linear-gradient(180deg, rgba(48, 38, 93, 0.78), rgba(18, 14, 40, 0.88));
  box-shadow: 0 0 16px rgba(141, 107, 255, 0.16);
}

button.mini,
.mini {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

input,
textarea,
select {
  max-width: 100%;
  width: 100%;
  border: 1px solid rgba(65, 246, 255, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(255, 250, 240, 0.96);
  color: var(--ink);
  font: inherit;
  outline: none;
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

textarea {
  min-height: 118px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: rgba(63, 74, 90, 0.55);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(65, 246, 255, 0.8);
  box-shadow:
    0 0 0 3px rgba(65, 246, 255, 0.14),
    0 0 18px rgba(65, 246, 255, 0.16);
}

.result,
.reply,
pre,
code {
  max-width: 100%;
  margin-top: 12px;
  border: 1px solid rgba(65, 246, 255, 0.28);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-soft);
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result {
  display: none;
  font-size: 14px;
}

.result.show {
  display: block;
}

[data-page="admin"] .result {
  display: block;
}

.reply {
  display: none;
}

pre {
  max-height: 380px;
  overflow: auto;
  overscroll-behavior: contain;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  min-width: 0;
}

.summary span,
.statusBadge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(65, 246, 255, 0.28);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted-dark);
  padding: 5px 10px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.statusBadge.ok {
  border-color: rgba(60, 255, 194, 0.42);
  color: var(--ok);
}

.statusBadge.warn {
  border-color: rgba(255, 180, 84, 0.48);
  color: var(--warn);
}

.statusBadge.bad {
  border-color: rgba(255, 82, 119, 0.5);
  color: var(--bad);
}

.mutedStatus {
  color: var(--muted-dark);
}

.qr-card {
  border: 1px solid rgba(65, 246, 255, 0.32);
  border-radius: var(--radius);
  background: rgba(255, 250, 240, 0.96);
  color: var(--ink);
  padding: 16px;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.qr-frame {
  display: inline-flex;
  max-width: 100%;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--glow-cyan);
}

.qr-card img {
  display: block;
  width: min(220px, calc(100vw - 92px));
  height: auto;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  border-radius: 12px;
}

.qr-title {
  color: var(--ink);
  margin: 12px 0 6px;
  font-weight: 900;
}

.qr-note {
  color: var(--ink-soft);
  font-size: 13px;
  margin: 8px 0 10px;
}

.qr-link {
  display: inline-block;
  font-weight: 800;
  word-break: break-word;
  text-decoration: none;
}

.qr-refresh {
  width: 100%;
  margin-top: 12px;
}

.persona-preview textarea {
  min-height: 150px;
  margin-top: 10px;
}

.kv {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.kv label,
.kv b {
  color: var(--ink);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(65, 246, 255, 0.24);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
  background: rgba(255, 250, 240, 0.92);
  color: var(--ink);
}

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid rgba(27, 36, 48, 0.12);
  text-align: left;
  vertical-align: top;
}

th {
  color: #0a5b66;
  background: rgba(65, 246, 255, 0.12);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: var(--ink-soft);
}

.mono {
  font-family: Consolas, "SFMono-Regular", monospace;
}

.accountId {
  display: block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.errorText {
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
}

details.error-detail summary {
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

details.error-detail summary::-webkit-details-marker {
  display: none;
}

details.error-detail pre {
  max-height: 180px;
  margin-top: 8px;
  overflow-x: auto;
}

.pathYes {
  cursor: help;
}

footer {
  color: var(--muted-dark);
  font-size: 12px;
  padding: 2px 6px;
  text-align: center;
}

.intro-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(4, 8, 20, 0.96), rgba(9, 4, 25, 0.94)),
    repeating-linear-gradient(90deg, rgba(71, 247, 255, 0.08) 0 1px, transparent 1px 54px);
  cursor: pointer;
  touch-action: manipulation;
}

.intro-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.34s ease;
}

.intro-stage {
  width: min(100%, 430px);
  aspect-ratio: 9 / 16;
  max-height: 86vh;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(71, 247, 255, 0.38);
  border-radius: 26px;
  background: rgba(4, 13, 28, 0.86);
  box-shadow: 0 0 40px rgba(71, 247, 255, 0.22), 0 20px 80px rgba(0, 0, 0, 0.62);
}

.intro-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.intro-overlay.has-video .intro-video {
  display: block;
}

.intro-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
}

.intro-overlay.has-video .intro-fallback {
  opacity: 0;
}

.intro-title {
  font-size: 30px;
  font-weight: 950;
  text-shadow: var(--glow-cyan), var(--glow-pink);
}

.intro-subtitle {
  margin-top: 10px;
  color: var(--muted);
}

.intro-skip {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: auto;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
  z-index: 2;
}

@keyframes panel-scan {
  0%, 48% { transform: translateX(-110%); }
  66%, 100% { transform: translateX(110%); }
}

@keyframes neon-breathe {
  0%, 100% { box-shadow: 0 0 12px rgba(71, 247, 255, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
  50% { box-shadow: 0 0 24px rgba(71, 247, 255, 0.32), inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
}

@media (max-width: 900px) {
  main.admin-grid {
    grid-template-columns: 1fr;
  }

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

  .accountId {
    max-width: 260px;
  }
}

@media (max-width: 520px) {
  .shell,
  .admin-shell {
    padding: 16px 12px 30px;
  }

  h1 {
    font-size: 25px;
  }

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

  .row button {
    flex: 1 1 100%;
  }

  .card,
  section {
    padding: 14px;
    border-radius: 16px;
  }

  textarea {
    min-height: 108px;
  }

  .intro-stage {
    width: min(100%, 390px);
    max-height: 84vh;
  }
}

@media (min-width: 768px) {
  .shell {
    padding-top: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
