/* ============ Ya1oM 游戏库 · Apple Liquid Glass（单色克制版） ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #eef0f4;
  --text: #1d1d1f;
  --text2: #6e6e73;
  --text3: #a1a1a6;
  --hairline: rgba(0, 0, 0, .08);

  /* 玻璃材质 */
  --glass-fill: linear-gradient(135deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .30));
  --glass-fill-heavy: linear-gradient(135deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .52));
  --glass-stroke: rgba(255, 255, 255, .72);
  --edge-hi: rgba(255, 255, 255, .95);
  --edge-lo: rgba(255, 255, 255, .38);
  --spec: rgba(255, 255, 255, .85);
  --inner-top: rgba(255, 255, 255, .75);
  --inner-bottom: rgba(255, 255, 255, .25);

  --card-fill: rgba(255, 255, 255, .52);
  --fill: rgba(120, 128, 144, .12);
  --fill2: rgba(120, 128, 144, .2);
  --invert-bg: #1d1d1f;
  --invert-text: #ffffff;

  --shadow-float: 0 12px 36px rgba(24, 30, 46, .12), 0 2px 8px rgba(24, 30, 46, .06);
  --shadow-hover: 0 22px 60px rgba(24, 30, 46, .17), 0 4px 12px rgba(24, 30, 46, .07);
  --shadow-sheet: 0 40px 120px rgba(15, 20, 35, .3);

  --radius: 18px;
  --ease: cubic-bezier(.25, .1, .25, 1);
  --spring: cubic-bezier(.3, 1.1, .35, 1);
}
:root[data-theme="dark"] {
  --bg: #050507;
  --text: #f5f5f7;
  --text2: #98989d;
  --text3: #6e6e73;
  --hairline: rgba(255, 255, 255, .1);

  --glass-fill: linear-gradient(135deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .05));
  --glass-fill-heavy: linear-gradient(135deg, rgba(48, 48, 54, .82), rgba(30, 30, 36, .72));
  --glass-stroke: rgba(255, 255, 255, .18);
  --edge-hi: rgba(255, 255, 255, .5);
  --edge-lo: rgba(255, 255, 255, .1);
  --spec: rgba(255, 255, 255, .4);
  --inner-top: rgba(255, 255, 255, .28);
  --inner-bottom: rgba(255, 255, 255, .06);

  --card-fill: rgba(28, 28, 32, .55);
  --fill: rgba(255, 255, 255, .09);
  --fill2: rgba(255, 255, 255, .16);
  --invert-bg: #f5f5f7;
  --invert-text: #000000;

  --shadow-float: 0 12px 36px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .4);
  --shadow-hover: 0 24px 64px rgba(0, 0, 0, .65), 0 4px 12px rgba(0, 0, 0, .4);
  --shadow-sheet: 0 40px 120px rgba(0, 0, 0, .8);
}

html { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei",
    "Hiragino Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .3s var(--ease), color .3s var(--ease);
  overflow-x: hidden;
}

.hidden { display: none !important; }
.flex1 { flex: 1; }

/* ---------- 背景光场：给玻璃提供可折射的层次（单色克制） ---------- */
.bgfield { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.bgfield i { position: absolute; inset: 0; }
.bgfield .g1 {
  background:
    radial-gradient(58% 42% at 12% -6%, rgba(255, 255, 255, .95), transparent 70%),
    radial-gradient(46% 38% at 88% 18%, rgba(164, 176, 200, .42), transparent 72%),
    radial-gradient(44% 40% at 30% 108%, rgba(196, 202, 216, .5), transparent 72%);
}
.bgfield .g2, .bgfield .g3 { display: none; }
:root[data-theme="dark"] .bgfield .g1 {
  background:
    radial-gradient(58% 42% at 12% -6%, rgba(255, 255, 255, .09), transparent 70%),
    radial-gradient(46% 38% at 88% 18%, rgba(170, 180, 210, .07), transparent 72%),
    radial-gradient(44% 40% at 30% 108%, rgba(255, 255, 255, .05), transparent 72%);
}

/* ---------- Liquid Glass 材质核心 ---------- */
/* .lg = 玻璃本体（无 backdrop 模糊，供大量元素用）；.lg-blur = 真折射（悬浮层专用，控制数量） */
.lg, .lg-blur {
  position: relative;
  background: var(--glass-fill);
  border: 1px solid var(--glass-stroke);
  box-shadow:
    inset 0 1px 0 var(--inner-top),
    inset 0 -1px 0 var(--inner-bottom),
    var(--shadow-float);
}
.lg-blur {
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
}
/* 跟随指针的液态高光 */
.lg::before, .lg-blur::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; z-index: 1;
  background: radial-gradient(240px circle at var(--x, 50%) var(--y, -30%),
    var(--spec), rgba(255, 255, 255, .1) 38%, transparent 62%);
  opacity: 0;
  transition: opacity .45s var(--ease);
}
.lg:hover::before, .lg-blur:hover::before { opacity: .5; }
/* 玻璃边缘折射环 —— 只给不带 backdrop-filter 的玻璃：
   blur + masked pseudo 同元素会触发 Chromium 合成挂死 */
.lg::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; z-index: 1; padding: 1px;
  background: linear-gradient(165deg,
    var(--edge-hi), transparent 32%, transparent 68%, var(--edge-lo));
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  mask-composite: exclude;
}

/* ---------- 顶栏：悬浮玻璃胶囊 ---------- */
.topbar { position: sticky; top: 12px; z-index: 50; padding: 0 14px; }
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  height: 52px; display: flex; align-items: center; gap: 14px;
  border-radius: 999px; padding: 0 10px 0 22px;
}
.brand {
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  white-space: nowrap; color: var(--text); text-decoration: none;
  position: relative; z-index: 2;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; position: relative; z-index: 2; }
.search-wrap {
  display: flex; align-items: center; gap: 6px; color: var(--text2);
  background: var(--fill); border-radius: 999px; padding: 7px 12px; min-width: 0;
  border: 1px solid transparent;
  transition: background .2s, border-color .2s;
}
.search-wrap:focus-within { background: var(--fill2); border-color: var(--glass-stroke); }
.search-wrap svg { flex: none; }
.search-wrap input {
  background: none; border: none; outline: none; color: var(--text);
  font: inherit; font-size: 13.5px; width: 160px; min-width: 0;
}
.search-wrap input::placeholder { color: var(--text3); }

.icon-btn {
  font: inherit; width: 34px; height: 34px; border-radius: 50%;
  border: none; background: transparent; color: var(--text2); cursor: pointer;
  display: grid; place-items: center; transition: background .2s, color .2s;
  flex: none;
}
.icon-btn:hover { background: var(--fill); color: var(--text); }

.admin-chip {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--text2); white-space: nowrap; padding-right: 8px;
}
.admin-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: #34c759; box-shadow: 0 0 6px rgba(52, 199, 89, .8); }
.admin-chip button {
  background: none; border: none; color: var(--text2); cursor: pointer;
  font: inherit; font-size: 13px; padding: 0; text-decoration: underline;
  text-underline-offset: 3px;
}
.admin-chip button:hover { color: var(--text); }

/* ---------- 按钮 ---------- */
.btn {
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  border-radius: 999px; padding: 8px 18px;
  border: 1px solid var(--glass-stroke);
  background: var(--glass-fill); color: var(--text);
  box-shadow: inset 0 1px 0 var(--inner-top), 0 2px 10px rgba(20, 26, 40, .07);
  transition: transform .3s var(--spring), box-shadow .25s, opacity .2s, background .2s;
  white-space: nowrap;
}
.btn:hover { box-shadow: inset 0 1px 0 var(--inner-top), 0 6px 18px rgba(20, 26, 40, .13); transform: translateY(-1px); }
.btn:active { transform: scale(.96); }
.btn.primary {
  background: var(--invert-bg); color: var(--invert-text); border-color: transparent;
  box-shadow: 0 6px 20px rgba(15, 18, 28, .25);
}
.btn.primary:hover { opacity: .88; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text2); }
.btn.ghost:hover { color: var(--text); background: var(--fill); transform: none; }
.btn.danger { background: transparent; color: #e30000; border-color: rgba(227, 0, 0, .4); box-shadow: none; }
:root[data-theme="dark"] .btn.danger { color: #ff6961; border-color: rgba(255, 105, 97, .4); }
.btn.busy { pointer-events: none; opacity: .45; }
.btn .bi { margin-right: 5px; display: inline-block; }
.btn.busy .bi { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 页头 ---------- */
.hero { max-width: 1080px; margin: 0 auto; padding: 52px 22px 8px; }
.hero-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.avatar-ring {
  width: 66px; height: 66px; border-radius: 50%; overflow: hidden; flex: none;
  border: 1px solid var(--glass-stroke);
  box-shadow: inset 0 1px 0 var(--inner-top), var(--shadow-float);
  background: var(--fill);
  display: grid; place-items: center;
}
.avatar-ring img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-ring img.noimg { display: none; }
.avatar-ring:has(img.noimg)::after { content: "🎮"; font-size: 26px; }
.hero-info h1 {
  font-size: clamp(28px, 5vw, 40px); font-weight: 700; letter-spacing: -.022em;
  line-height: 1.1;
}
.stat-line { margin-top: 6px; font-size: 14px; color: var(--text2); letter-spacing: -.005em; }
.stat-line b { color: var(--text); font-weight: 600; }
.hero-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.hero-actions .btn { font-size: 13px; padding: 7px 14px; }

/* ---------- 控制区 ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 22px 22px 48px; }
.controls {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.seg {
  display: inline-flex; gap: 2px;
  border-radius: 999px; padding: 4px; max-width: 100%; overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg::before { display: none; } /* 分段容器不要指针高光，子项自己亮 */
.pill {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--text2);
  background: transparent; border: none; cursor: pointer;
  border-radius: 999px; padding: 6px 14px; white-space: nowrap;
  position: relative; z-index: 2;
  transition: color .2s, background .25s, box-shadow .25s;
}
.pill:hover { color: var(--text); }
.pill.on {
  color: var(--text); background: var(--glass-fill-heavy);
  box-shadow: inset 0 1px 0 var(--inner-top), 0 2px 8px rgba(20, 26, 40, .14);
}

.glass-select {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--text2);
  background: var(--glass-fill); border: 1px solid var(--glass-stroke);
  border-radius: 999px; padding: 8px 16px; outline: none; cursor: pointer;
  margin-left: auto; -webkit-appearance: none; appearance: none;
  box-shadow: inset 0 1px 0 var(--inner-top);
}
.glass-select:hover { color: var(--text); }
.glass-select option { background: var(--bg); color: var(--text); }

/* ---------- 游戏网格 ---------- */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}
.card {
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--card-fill);
  transition: transform .4s var(--spring), box-shadow .35s var(--ease);
  animation: cardin .45s var(--ease) backwards;
}
/* 366 张卡不吃得起 mask 边缘环：普通边框即可，环只留给悬浮层 */
.card::after { content: none; }
@keyframes cardin { from { opacity: 0; transform: translateY(10px); } }
.card:hover { transform: translateY(-5px) scale(1.015); box-shadow: inset 0 1px 0 var(--inner-top), inset 0 -1px 0 var(--inner-bottom), var(--shadow-hover); }
.card::before { z-index: 3; }  /* 高光扫过封面 */
.card:hover::before { opacity: .38; }
.cover { position: relative; aspect-ratio: 2/3; background: var(--fill); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 40px; font-weight: 700; color: var(--text3);
  background: linear-gradient(160deg, var(--fill) 0%, var(--fill2) 100%);
  letter-spacing: -.02em;
}
.rating-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600; color: #fff;
  background: rgba(10, 10, 14, .5);
  -webkit-backdrop-filter: blur(12px) saturate(160%); backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
  border-radius: 999px; padding: 3px 9px;
}
.card-foot { padding: 11px 13px 12px; position: relative; z-index: 2; }
.card-title {
  font-size: 13.5px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-sub {
  font-size: 11.5px; color: var(--text3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-height: 14px;
}
.card-meta {
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
  margin-top: 7px;
}
.pbadge {
  font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text2); white-space: nowrap;
}
.hours { font-size: 12px; color: var(--text2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- 空状态 / 页脚 ---------- */
.empty {
  text-align: center; padding: 70px 20px; color: var(--text2);
  border: 1px dashed var(--glass-stroke); border-radius: var(--radius);
}
.empty-icon { font-size: 40px; margin-bottom: 10px; }
.foot {
  text-align: center; color: var(--text3); font-size: 12px;
  padding: 24px 0 40px; border-top: 1px solid var(--hairline);
  max-width: 1080px; margin: 0 auto;
}

/* ---------- 弹窗：厚玻璃浮层 ---------- */
.glass-dialog {
  margin: auto; border: none; outline: none; color: var(--text);
  background: var(--glass-fill-heavy);
  -webkit-backdrop-filter: blur(34px) saturate(190%);
  backdrop-filter: blur(34px) saturate(190%);
  border-radius: 24px; padding: 0;
  border: 1px solid var(--glass-stroke);
  box-shadow: inset 0 1px 0 var(--inner-top), var(--shadow-sheet);
  width: min(440px, calc(100vw - 32px));
  animation: dlgin .35s var(--spring);
}
@keyframes dlgin { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.glass-dialog::backdrop {
  background: rgba(8, 10, 16, .38);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.dlg-form { padding: 26px 26px 22px; display: flex; flex-direction: column; gap: 13px; max-height: min(80vh, 720px); overflow-y: auto; }
.dlg-form h2 { font-size: 19px; font-weight: 700; letter-spacing: -.015em; margin-bottom: 2px; }
.dlg-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text2); }
.dlg-form input, .dlg-form select, .dlg-form textarea {
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--fill); border: 1px solid transparent;
  border-radius: 11px; padding: 9px 12px; outline: none; resize: vertical;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.dlg-form input:focus, .dlg-form select:focus, .dlg-form textarea:focus {
  border-color: var(--glass-stroke); background: var(--fill2);
  box-shadow: inset 0 1px 0 var(--inner-bottom);
}
.dlg-form select option { background: var(--bg); color: var(--text); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 4px; }
.hint { font-size: 12px; color: var(--text3); line-height: 1.5; }
.dlg-x {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--glass-stroke);
  background: var(--glass-fill); color: var(--text2); cursor: pointer; font-size: 13px;
}
.dlg-x:hover { color: var(--text); }

/* 评分滑条 */
.rating-label output { color: var(--text); font-weight: 700; font-size: 15px; margin-left: 6px; font-variant-numeric: tabular-nums; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 26px;
  background: transparent !important; padding: 0 !important; border: none !important;
  box-shadow: none !important;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--text) var(--fillpct, 0%), var(--fill2) var(--fillpct, 0%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px;
  border-radius: 50%; cursor: pointer;
  background: linear-gradient(160deg, #fff, #e8e8ec);
  border: 1px solid rgba(0, 0, 0, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 2px 8px rgba(0, 0, 0, .25);
}
.stars { font-size: 14px; letter-spacing: 2px; color: var(--text); min-height: 17px; }

/* 详情弹窗 */
.view-dialog { width: min(600px, calc(100vw - 32px)); overflow: hidden; }
.view-body { display: flex; }
.view-body img { width: 200px; object-fit: cover; flex: none; }
.view-body img[src=""] { display: none; }
.view-info { padding: 26px 26px 24px; min-width: 0; flex: 1; }
.view-info h2 { font-size: 20px; font-weight: 700; letter-spacing: -.015em; margin-bottom: 4px; }
.view-names { font-size: 12.5px; color: var(--text3); line-height: 1.6; margin-bottom: 12px; }
.view-meta {
  display: flex; flex-direction: column; gap: 6px; font-size: 13.5px;
  color: var(--text2); margin-bottom: 12px;
  padding-top: 12px; border-top: 1px solid var(--hairline);
}
.view-meta b { color: var(--text); font-weight: 600; }
#view-notes { font-size: 13px; color: var(--text2); line-height: 1.6; white-space: pre-wrap; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 100; padding: 11px 20px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; max-width: calc(100vw - 40px);
  background: var(--invert-bg); color: var(--invert-text);
  box-shadow: var(--shadow-float);
  animation: dlgin .3s var(--spring);
}
.toast.err { background: #e30000; color: #fff; }

/* ---------- 手机端 ---------- */
@media (max-width: 640px) {
  .topbar { top: 8px; padding: 0 10px; }
  .topbar-inner { padding: 0 6px 0 16px; gap: 8px; }
  .search-wrap input { width: 84px; }
  .hero { padding: 32px 16px 4px; }
  .hero-actions { margin-left: 0; }
  main { padding: 16px 16px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
  .view-body { flex-direction: column; }
  .view-body img { width: 100%; max-height: 280px; }
  .row3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .glass-dialog, .toast { animation: none; }
}
