/* pixel-ui.css — 全站像素风换肤层（2026-10-26）。
   灵感与调色板来自 CC0 的 UNI!（playuni.app，Eldyn/uni）；实现为本站自绘。
   加载顺序：play.css → relay-ui.css → 本文件（最后加载，覆盖视觉令牌与外观）。
   DOM 结构、类名与交互 JS 不变：只换观感——像素字体、直角、硬阴影、纯色面。 */

/* ── 字体（自托管） ──────────────────────────────────────────────── */
@font-face {
  font-family: 'FatPixel';
  src: url('/static/fonts/fatpixel.woff2') format('woff2');
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: 'LanaPixel';
  src: url('/static/fonts/lanapixel.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

/* ── 令牌覆盖：暗色（默认态在 html.dark；UNI 暗色） ───────────────── */
html.dark {
  --or-bg: #16171d;
  --or-bg2: #1c1d24;
  --or-ink: #e7e5ee;
  --or-ink2: #b9b6c4;
  --or-mute: #9ca3af;
  --or-faint: #6b707c;
  --or-line: #2e303a;
  --or-line2: #3a3d49;
  --or-miku: #c084fc;
  --or-miku-soft: #2a1b3d;
  --or-teal: #cd9bff;
  --or-pink: #f2cc47;
  --or-pink-soft: #3a3317;
  --or-rose: #ffd95e;
  --or-lav: #b9aeeb;
  --or-lav-soft: #262038;
  --or-violet: #c3b8f5;
  --or-butter: #f2cc47;
  --or-amber: #f6d55e;
  --or-ok: #4aab42;
  --or-bad: #e05252;
  --or-info: #1790df;
  --or-miku-rgb: 192, 132, 252;
  --or-pink-rgb: 242, 204, 71;
  --or-lav-rgb: 185, 174, 235;
  --or-ink-rgb: 231, 229, 238;
  --or-glass: #23242c;
  --or-solid: #c084fc;
  --or-on: #16171d;
  --or-onk: 22, 23, 29;
  --or-onac: #16171d;
  /* 渐变改像素条：三段硬分界，无过渡 */
  --or-grad: linear-gradient(90deg, #c084fc 0 34%, #f2cc47 34% 67%, #1790df 67% 100%);
  --or-grad-on: linear-gradient(90deg, #f2cc47 0 50%, #cd9bff 50% 100%);
}

/* ── 令牌覆盖：亮色（UNI 亮色，米纸底） ───────────────────────────── */
:root {
  --or-bg: #f4f2ec;
  --or-bg2: #ebe7de;
  --or-ink: #17131f;
  --or-ink2: #40384c;
  --or-mute: #5f5868;
  --or-faint: #8d8598;
  --or-line: #d8d3c8;
  --or-line2: #c4beb0;
  --or-miku: #8f2ce0;
  --or-miku-soft: #eee0fa;
  --or-teal: #7b1fc4;
  --or-pink: #e3b520;
  --or-pink-soft: #faf0c8;
  --or-rose: #b98a00;
  --or-lav: #b9aeeb;
  --or-lav-soft: #efe9ff;
  --or-violet: #8f2ce0;
  --or-butter: #f2cc47;
  --or-amber: #a5761a;
  --or-ok: #2e7c3a;
  --or-bad: #c0403c;
  --or-info: #0470dd;
  --or-miku-rgb: 143, 44, 224;
  --or-pink-rgb: 227, 181, 32;
  --or-lav-rgb: 185, 174, 235;
  --or-ink-rgb: 23, 19, 31;
  --or-glass: #eae6dc;
  --or-solid: #17131f;
  --or-on: #f4f2ec;
  --or-onk: 244, 242, 236;
  --or-onac: #f4f2ec;
  --or-grad: linear-gradient(90deg, #8f2ce0 0 34%, #e3b520 34% 67%, #0470dd 67% 100%);
  --or-grad-on: linear-gradient(90deg, #e3b520 0 50%, #8f2ce0 50% 100%);
}

/* ── 全局形状与字体 ──────────────────────────────────────────────── */
/* 正文回退系统字体（像素字体只用于数字/拉丁展示元素，中文正文可读性优先） */
html.or-on body,
html.or-on {
  font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
html.or-on * {
  border-radius: 0 !important;
}
/* 像素字体保留区：数字、拉丁品牌、卡面、大字水印 */
html.or-on .big, html.or-on .or-ghost, html.or-on .du-count, html.or-on .du-score,
html.or-on .du-total, html.or-on .du-medal, html.or-on .du-pcard, html.or-on .du-pile,
html.or-on .or-brand b, html.or-on .or-clock {
  font-family: 'FatPixel', 'LanaPixel', monospace;
}
html.or-on h1, html.or-on h2, html.or-on h3 {
  font-weight: 700;
  letter-spacing: .02em;
}
html.or-on ::selection { background: rgba(var(--or-miku-rgb), .4); }
html.or-on ::-webkit-scrollbar-thumb { border-radius: 0 !important; border: 2px solid var(--or-bg); }

/* 像素硬阴影工具观感：所有浮层与卡片用 offset 实影替代模糊影。 */
html.or-on .card, html.or-on .or-panel, html.or-on .or-fly, html.or-on .or-modal,
html.or-on .or-toast, html.or-on .or-sheet, html.or-on .du-player,
html.or-on .duel-game, html.or-on .du-opt, html.or-on .du-stepper {
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .35);
}
html.or-on .or-toast, html.or-on .or-modal { border: 2px solid var(--or-line2); }

/* ── 背景层：去极光渐变，换像素格与纯色 ──────────────────────────── */
html.or-on .or-aurora {
  background:
    linear-gradient(rgba(var(--or-ink-rgb), .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--or-ink-rgb), .05) 1px, transparent 1px);
  background-size: 16px 16px, 16px 16px;
  opacity: 1;
}
html.or-on .or-stars, html.or-on .or-scan { display: none; }
html.or-on .or-grid { background: none; }

/* ── 顶栏 / 品牌 / dock ──────────────────────────────────────────── */
html.or-on .or-bar { background: var(--or-bg); border-bottom: 2px solid var(--or-line2); backdrop-filter: none; }
html.or-on .or-brand b { color: var(--or-ink-h, var(--or-ink)); }
html.or-on .or-mark .o { stroke-width: 10; }
html.or-on .or-clock, html.or-on .or-bar-btn { font-family: 'FatPixel', 'LanaPixel', monospace; }
html.or-on .or-bar-btn { border: 2px solid var(--or-line2); }
html.or-on .or-dock {
  background: var(--or-bg);
  border: 2px solid var(--or-line2);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .35);
}
html.or-on .or-di { border: 2px solid transparent; }
html.or-on .or-di:hover { border-color: var(--or-line2); }
html.or-on .or-di span { font-family: 'FatPixel', 'LanaPixel', monospace; }
html.or-on .or-sep { background: var(--or-line); }

/* ── 按钮：实色方块，去渐变去光晕 ────────────────────────────────── */
html.or-on button, html.or-on .button, html.or-on .or-btn, html.or-on .or-cb {
  background: var(--or-solid);
  color: var(--or-on);
  border: 2px solid var(--or-onk) !important;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .4);
  clip-path: none;
  font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-weight: 700;
  letter-spacing: .06em;
}
html.or-on button:hover, html.or-on .button:hover, html.or-on .or-btn:hover, html.or-on .or-cb:hover {
  filter: brightness(1.15);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .4);
  transform: translate(1px, 1px);
}
html.or-on button:active, html.or-on .button:active, html.or-on .or-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 rgba(0, 0, 0, .4);
}
html.or-on button::after, html.or-on .or-btn::after { display: none; }
html.or-on .text-button { font-family: inherit; }

/* ── 输入 ────────────────────────────────────────────────────────── */
html.or-on input, html.or-on select, html.or-on textarea {
  border: 2px solid var(--or-line2) !important;
  background: var(--or-bg2);
  font-family: 'LanaPixel', monospace;
}

/* ── 卡片 / 面板：实色面 + 粗边 ──────────────────────────────────── */
html.or-on .card, html.or-on .or-panel {
  background: var(--or-glass);
  border: 2px solid var(--or-line2);
  backdrop-filter: none;
}
html.or-on .card::before, html.or-on .card::after,
html.or-on .or-panel::before, html.or-on .or-panel::after { display: none; }
html.or-on .or-ghost { font-family: 'FatPixel', monospace; opacity: .06; }
html.or-on .pill, html.or-on .badge, html.or-on .or-chip {
  border-radius: 0 !important;
  border: 1px solid var(--or-line2);
  background: var(--or-bg2);
  font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
html.or-on .pill { border-color: var(--or-miku); color: var(--or-teal); }

/* ── 排行榜 / 名次 ───────────────────────────────────────────────── */
html.or-on .or-lb-row, html.or-on .rank-row { border-bottom: 2px dashed var(--or-line); }
html.or-on .or-lb-ring .arc, html.or-on .or-lb-ring .trk { stroke-linecap: butt; }
html.or-on .du-medal { border-radius: 0 !important; }

/* ── 启动画面 ────────────────────────────────────────────────────── */
html.or-on .or-boot { background: var(--or-bg); }
html.or-on .or-boot .or-brand b { font-size: 18px; }

/* ── 渐变文本/进度条：改像素条 ───────────────────────────────────── */
html.or-on .or-gauge { border-radius: 0 !important; border: 1px solid var(--or-line2); }
html.or-on .or-gauge i { background: var(--or-solid); }
html.or-on .duel-timer i { background: var(--or-solid); }

/* ── 卡牌（变色龙）像素卡面 ──────────────────────────────────────── */
.du-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.du-pcard {
  position: relative;
  width: 62px; height: 88px;
  border: 3px solid #1f1b18;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .4);
  display: flex; align-items: center; justify-content: center;
  font-family: 'FatPixel', monospace;
  font-size: 22px;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .45);
  background: var(--or-bg2);
  cursor: default;
  transition: transform .12s steps(2);
}
.du-pcard small { position: absolute; left: 4px; top: 2px; font-size: 9px; opacity: .85; }
.du-pcard.playable { cursor: pointer; }
.du-pcard.playable:hover { transform: translateY(-8px); outline: 2px solid #fff; }
.du-pcard.c-r { background: #bd3130; }
.du-pcard.c-y { background: #f2cc47; color: #1f1b18; text-shadow: 2px 2px 0 rgba(255, 255, 255, .35); }
.du-pcard.c-g { background: #4aab42; }
.du-pcard.c-b { background: #0470dd; }
.du-pcard.c-w { background: #1f1b18; }
.du-pcard.c-w::after {
  content: '';
  position: absolute; inset: 8px;
  background: conic-gradient(#bd3130 0 25%, #f2cc47 0 50%, #4aab42 0 75%, #0470dd 0);
}
.du-pcard.c-w span { position: relative; z-index: 1; background: #1f1b18; padding: 2px 4px; }
.du-pcard.dead { opacity: .35; filter: grayscale(1); }
.du-colors { display: flex; gap: 8px; }
.du-colors button {
  width: 40px; height: 40px;
  border: 3px solid #1f1b18;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .4);
}
.du-colors button[data-color="r"] { background: #bd3130; }
.du-colors button[data-color="y"] { background: #f2cc47; }
.du-colors button[data-color="g"] { background: #4aab42; }
.du-colors button[data-color="b"] { background: #0470dd; }
.du-pile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 74px; height: 104px;
  border: 3px solid #1f1b18;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .4);
  font-family: 'FatPixel', monospace; font-size: 26px; color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .45);
}
.du-pile.c-r { background: #bd3130; }
.du-pile.c-y { background: #f2cc47; color: #1f1b18; }
.du-pile.c-g { background: #4aab42; }
.du-pile.c-b { background: #0470dd; }
.du-pile.c-w { background: #1f1b18; }
.du-handcounts { display: flex; flex-wrap: wrap; gap: 8px; }
.du-hc { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--or-line2); padding: 4px 8px; font-family: 'FatPixel', 'LanaPixel', monospace; font-size: 12px; }
.du-hc .n { font-size: 15px; }

@media (max-width: 520px) {
  .du-pcard { width: 52px; height: 74px; font-size: 18px; }
}

/* 可读性补充：正文与提示行高、日志 */
html.or-on .du-hint, html.or-on .muted, html.or-on .du-events { line-height: 1.7; }
html.or-on .du-events { font-size: 14px; }

/* 实时游玩人数徽标 */
.duel-game h3 .du-live { margin-left: auto; font-size: 11px; }
