/* ============================================================
   theme.css — gaxen.fun 设计令牌 v4
   午夜街机厅 / Midnight arcade editorial
   深墨底 · 琥珀金强调 · 宋体标题 + DM Sans 正文 · 发丝网格
   ============================================================ */

@font-face {
  font-family: "Fraunces Display";
  src: url("/assets/fonts/fraunces-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dmsans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dmsans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* 墨色层级 */
  --bg: #101014;
  --bg-2: #16161c;
  --bg-3: #1c1c24;
  --bg-4: #24242e;

  /* 文字 */
  --ink: #f3efe7;
  --ink-soft: #b8b2a6;
  --ink-dim: #8c867b;

  /* 强调：琥珀金，唯一装饰色 */
  --accent: #f2b544;
  --accent-soft: #ffcf7d;
  --accent-dim: rgba(242, 181, 68, 0.14);
  --accent-line: rgba(242, 181, 68, 0.35);

  /* 语义色 */
  --ok: #7dd3a8;
  --warn: #f2b544;
  --danger: #e87a6a;
  --green: var(--ok);
  --red: var(--danger);
  --yellow: var(--warn);
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --bg-soft: var(--bg-2);
  --border: rgba(243, 239, 231, 0.12);

  /* 兼容旧变量（后台/游戏页仍在引用） */
  --paper: var(--bg);
  --paper-2: var(--bg-2);
  --paper-3: var(--bg-3);
  --rule: rgba(243, 239, 231, 0.1);
  --rule-2: rgba(243, 239, 231, 0.2);
  --rule-3: rgba(243, 239, 231, 0.32);
  --shadow-1: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.4);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, 0.55);

  /* 字体 */
  --font-display: "Fraunces Display", "Songti SC", "STSong", "SimSun", serif;
  --font-cn: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  --font-body: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "DM Sans", ui-monospace, monospace;

  /* 字阶 */
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-lg: 19px;
  --fs-xl: 26px;
  --fs-2xl: 38px;
  --fs-3xl: 56px;
  --fs-hero: clamp(48px, 8vw, 104px);

  /* 间距 */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;
  --gutter: clamp(20px, 4vw, 56px);

  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 180ms;
  --dur-base: 320ms;
  --dur-slow: 640ms;
}

/* ---------- 复位 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* 氛围网格 + 两处光晕 + 噪点 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(243, 239, 231, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(243, 239, 231, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

img,
canvas,
svg {
  display: block;
  max-width: 100%;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
ul,
ol {
  list-style: none;
}
table {
  border-collapse: collapse;
}
.hidden {
  display: none !important;
}

/* ---------- 排版 ---------- */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-4);
  border: 2px solid var(--bg);
  border-radius: 6px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- 通用元件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast),
    transform var(--dur-fast);
}
.btn:hover {
  background: var(--bg-3);
  border-color: var(--accent-line);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--bg);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink-soft);
}
.btn-ghost:hover {
  background: rgba(243, 239, 231, 0.05);
  border-color: var(--border);
  color: var(--ink);
}

.btn-green {
  color: var(--ok);
  border-color: rgba(125, 211, 168, 0.4);
  background: rgba(125, 211, 168, 0.08);
}
.btn-green:hover {
  background: rgba(125, 211, 168, 0.16);
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(232, 122, 106, 0.4);
  background: transparent;
}
.btn-danger:hover {
  background: rgba(232, 122, 106, 0.1);
}

.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

/* 表单：暗底(+轻微底色)、发丝下划线 */
.field {
  display: block;
  margin-bottom: var(--s5);
}
.field > label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: var(--s2);
}
input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--fs-base);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
input::placeholder,
textarea::placeholder {
  color: var(--ink-dim);
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.7;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--bg-4);
}
input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--bg-4);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  background: var(--accent);
  border-radius: 50%;
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.tag-pending {
  color: var(--warn);
  border-color: rgba(242, 181, 68, 0.4);
}
.tag-approved {
  color: var(--ok);
  border-color: rgba(125, 211, 168, 0.4);
}
.tag-hidden {
  color: var(--ink-dim);
  border-color: var(--border);
}

.empty-tip {
  padding: 40px 0;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* ---------- 动效 ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.rise {
  animation: rise var(--dur-slow) var(--ease-out) both;
  animation-delay: var(--d, 0ms);
}
.fade {
  animation: fade var(--dur-base) var(--ease-out) both;
  animation-delay: var(--d, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
