/* ============ 赛博算命 · 赛博朋克主题 ============ */

:root {
  /* 赛博底色（深紫黑） */
  --bg-base: #050208;
  --bg-deep: #0a0518;
  --bg-mid: #150a2e;
  --bg-panel: rgba(15, 8, 35, 0.78);
  --bg-panel-strong: rgba(22, 12, 48, 0.92);

  /* 古典金（中式韵味） */
  --gold: #c9a84c;
  --gold-light: #ffd76b;
  --gold-dark: #6b4f0f;

  /* 文字 */
  --text-light: #f0f5ff;
  --text-muted: #8090b0;
  --text-dim: #4a5878;

  /* 赛博霓虹 */
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff2d95;
  --neon-purple: #b04dff;
  --neon-green: #2dff8a;
  --neon-yellow: #ffea00;

  /* 边框 */
  --border-gold: rgba(201, 168, 76, 0.4);
  --border-cyan: rgba(0, 240, 255, 0.45);
  --border-magenta: rgba(255, 45, 149, 0.45);
  --border-purple: rgba(176, 77, 255, 0.45);

  /* 等级色（赛博化） */
  --lv-daji: #00f0ff;
  --lv-ji: #2dff8a;
  --lv-ping: #c9a84c;
  --lv-xiong: #ff8800;
  --lv-daxiong: #ff2d95;

  --danger: #ff2d95;

  /* 排版 */
  --font-serif: 'Noto Serif SC', 'STKaiti', 'KaiTi', serif;
  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  background: var(--bg-base);
  color: var(--text-light);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: relative;
}

/* ============ 全局背景层 ============ */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(176, 77, 255, 0.20) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(0, 240, 255, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 45, 149, 0.08) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-base) 100%);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 45, 149, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 90%);
  animation: grid-drift 30s linear infinite;
}

@keyframes grid-drift {
  from { background-position: 0 0; }
  to { background-position: 50px 50px; }
}

.bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.85) 100%);
}

.bg-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 2px,
    rgba(0, 240, 255, 0.025) 2px,
    rgba(0, 240, 255, 0.025) 3px
  );
  opacity: 0.6;
  mix-blend-mode: screen;
}

/* ============ 排版工具 ============ */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: clamp(40px, 10vw, 56px);
  font-weight: 900;
  letter-spacing: 0.3em;
  color: var(--gold);
  text-shadow:
    0 0 8px rgba(201, 168, 76, 0.8),
    0 0 20px rgba(201, 168, 76, 0.4),
    0 0 40px rgba(0, 240, 255, 0.4),
    2px 0 0 rgba(255, 45, 149, 0.5),
    -2px 0 0 rgba(0, 240, 255, 0.5);
  position: relative;
  animation: title-flicker 6s infinite;
}

@keyframes title-flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.85; }
  94% { opacity: 1; }
  95% { opacity: 0.7; }
  96% { opacity: 1; }
}

.brand-title::before {
  content: '<<';
  position: absolute;
  left: -0.6em;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.3em;
  color: var(--neon-cyan);
  letter-spacing: 0;
  text-shadow: 0 0 6px var(--neon-cyan);
  animation: bracket-blink 1.5s steps(2) infinite;
}

.brand-title::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 70%;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--gold), var(--neon-magenta), transparent);
  box-shadow: 0 0 8px var(--neon-cyan);
}

@keyframes bracket-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.3; }
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--neon-cyan);
  letter-spacing: 0.45em;
  margin-top: 24px;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.5);
}

.brand-wrap {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
}

/* ============ 链接 ============ */
a {
  color: var(--neon-cyan);
  text-decoration: none;
  transition: text-shadow 0.2s;
}

a:hover {
  text-shadow: 0 0 8px var(--neon-cyan);
}

.link {
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font-mono);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  padding: 4px 2px;
}

.link::before { content: '['; color: var(--neon-cyan); margin-right: 4px; }
.link::after { content: ']'; color: var(--neon-cyan); margin-left: 4px; }

.link:hover {
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
}

/* ============ 滚动条 ============ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 8, 35, 0.5);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--neon-cyan), var(--neon-magenta));
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--neon-magenta), var(--neon-cyan));
}

/* ============ 选择 ============ */
::selection {
  background: var(--neon-cyan);
  color: var(--bg-deep);
  text-shadow: none;
}

/* ============ 通用按钮 ============ */
button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

button:focus {
  outline: none;
}

button:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
}

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 36px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(255, 45, 149, 0.15));
  color: var(--text-light);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3em;
  border: 1px solid var(--neon-cyan);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  overflow: hidden;
  transition: all 0.2s;
  box-shadow:
    0 0 20px rgba(0, 240, 255, 0.3),
    inset 0 0 15px rgba(0, 240, 255, 0.1);
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.6);
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.4), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.btn-primary:hover {
  border-color: var(--neon-magenta);
  color: var(--text-light);
  text-shadow: 0 0 10px var(--neon-magenta);
  box-shadow:
    0 0 30px rgba(255, 45, 149, 0.5),
    inset 0 0 20px rgba(255, 45, 149, 0.15);
  transform: translateY(-1px);
}

.btn-primary:hover::before {
  transform: translateX(100%);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-large {
  width: 100%;
  padding: 18px;
  font-size: 19px;
  letter-spacing: 0.4em;
}

.btn-ghost {
  flex: 1;
  padding: 12px;
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.2em;
  transition: all 0.2s;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

.btn-ghost:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.12);
  text-shadow: 0 0 6px var(--neon-cyan);
}

.btn-small {
  display: inline-flex;
  width: auto;
  padding: 8px 22px;
  font-size: 13px;
  margin-top: 16px;
}

.btn-danger {
  flex: 1;
  padding: 12px;
  background: rgba(255, 45, 149, 0.05);
  border: 1px solid rgba(255, 45, 149, 0.5);
  color: var(--neon-magenta);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.2em;
  transition: all 0.2s;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

.btn-danger:hover {
  background: rgba(255, 45, 149, 0.15);
  box-shadow: 0 0 15px rgba(255, 45, 149, 0.4);
  text-shadow: 0 0 6px var(--neon-magenta);
}

.btn-row {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

/* ============ Toast ============ */
.toast-container {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(22, 12, 48, 0.95);
  border: 1px solid var(--neon-cyan);
  border-left-width: 3px;
  padding: 12px 24px;
  color: var(--text-light);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.15em;
  box-shadow:
    0 4px 25px rgba(0, 0, 0, 0.6),
    0 0 15px rgba(0, 240, 255, 0.3);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 1.7s forwards;
  backdrop-filter: blur(8px);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(-10px); }
}

/* ============ 响应式 ============ */
@media (min-width: 768px) {
  body { font-size: 16px; }
}

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