:root{
  --bg:#0b0d12;
  --panel:#141922;
  --panel2:#1b2230;
  --line:#242c3a;
  --text:#e9eef6;
  --muted:#94a0b4;
  --accent:#f6821f;
  --accent-soft:#ffb26b;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:
    radial-gradient(900px 500px at 50% -10%, #1c2536 0%, transparent 60%),
    radial-gradient(700px 400px at 90% 110%, #1a1520 0%, transparent 60%),
    var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  -webkit-tap-highlight-color:transparent;
}
a{color:inherit;text-decoration:none}

.top{
  display:flex;align-items:center;justify-content:space-between;
  padding:16px 22px;border-bottom:1px solid var(--line);
  background:rgba(11,13,18,.65);backdrop-filter:blur(10px);
  position:sticky;top:0;z-index:10;
}
.logo{font-weight:800;letter-spacing:.4px;font-size:17px}
.logo span{color:var(--accent)}
nav{display:flex;gap:20px;font-size:14px;color:var(--muted)}
nav a:hover,nav a.on{color:var(--text)}

.home{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:56px 20px;text-align:center}
.home h1{font-size:clamp(28px,5vw,44px);margin:0 0 10px;letter-spacing:-.5px}
.home .sub{color:var(--muted);margin:0 0 40px;font-size:15px}

.banner{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  width:min(720px,100%);
  margin:0 0 18px;
  padding:24px 26px;
  text-align:left;
  border:1px solid #3a2a22;
  border-radius:20px;
  background:
    radial-gradient(420px 240px at 88% 8%, rgba(185,74,50,.22), transparent 65%),
    linear-gradient(135deg,#1d1814,#12100e);
  overflow:hidden;
  transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease;
}
.banner::before{
  content:"";
  position:absolute;right:-60px;top:-90px;
  width:280px;height:280px;
  border:1px solid rgba(199,168,106,.16);
  border-radius:50%;
  pointer-events:none;
}
.banner::after{
  content:"";
  position:absolute;right:-10px;top:-40px;
  width:180px;height:180px;
  border:1px dashed rgba(199,168,106,.1);
  border-radius:50%;
  pointer-events:none;
}
.banner:hover{transform:translateY(-3px);border-color:#5a3c2d;box-shadow:0 18px 50px rgba(0,0,0,.4)}
.banner-copy{position:relative;z-index:1}
.banner-kicker{
  font-family:"SFMono-Regular","Menlo",monospace;
  font-size:10px;letter-spacing:.2em;color:#b28d50;
}
.banner h2{
  margin:8px 0 6px;
  font-family:"Songti SC","STSong","SimSun",serif;
  font-size:clamp(25px,4vw,33px);
  font-weight:500;
  letter-spacing:.12em;
  color:#f7f1e6;
}
.banner p{margin:0;max-width:460px;color:#94a0b4;font-size:13px;line-height:1.75}
.banner-go{display:inline-block;margin-top:14px;font-size:12px;letter-spacing:.05em;color:#cf6548}
.banner-seal{
  position:relative;z-index:1;
  flex:none;
  display:grid;place-items:center;
  width:54px;height:74px;
  border:1.5px solid rgba(185,74,50,.85);
  color:#d06a4d;
  font-family:"Songti SC","STSong","SimSun",serif;
  font-size:19px;
  letter-spacing:.15em;
  writing-mode:vertical-rl;
  transform:rotate(3deg);
  background:rgba(185,74,50,.04);
  opacity:.9;
}
.shelf-label{
  width:min(720px,100%);
  margin:16px 0 10px;
  text-align:left;
  font-family:"SFMono-Regular","Menlo",monospace;
  font-size:10px;
  letter-spacing:.22em;
  text-transform:uppercase;
  color:#5b6678;
}

.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:18px;width:min(720px,100%)}
.card{
  background:linear-gradient(180deg,var(--panel2),var(--panel));
  border:1px solid var(--line);border-radius:18px;padding:24px;text-align:left;
  transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease;
}
.card:hover{transform:translateY(-3px);border-color:#3a475c;box-shadow:0 16px 40px rgba(0,0,0,.35)}
.card .icon{font-size:26px;font-weight:800;color:var(--accent-soft);margin-bottom:14px}
.card h2{margin:0 0 8px;font-size:19px}
.card p{margin:0 0 16px;color:var(--muted);font-size:14px;line-height:1.6}
.card .go{font-size:13px;color:var(--accent)}

.foot{padding:22px;text-align:center;color:#5b6678;font-size:12px;border-top:1px solid var(--line)}

/* ---------- game shell ---------- */
.wrap{flex:1;display:flex;flex-direction:column;align-items:center;padding:26px 16px 56px;gap:16px}
.hud{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:center}
.chip{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:9px 16px;min-width:88px;text-align:center}
.chip b{display:block;font-size:19px;color:var(--accent-soft);font-variant-numeric:tabular-nums}
.chip span{font-size:11px;color:var(--muted);letter-spacing:.4px}

.btn{
  background:var(--accent);color:#1a0f02;border:0;border-radius:12px;
  padding:11px 18px;font-size:14px;font-weight:700;cursor:pointer;
  font-family:inherit;transition:filter .15s;
}
.btn:hover{filter:brightness(1.08)}
.btn.ghost{background:transparent;color:var(--text);border:1px solid var(--line)}
.btn.ghost:hover{border-color:#3a475c;filter:none}

.hint{color:var(--muted);font-size:13px;text-align:center;line-height:1.7}

/* ---------- 2048 ---------- */
.board{position:relative;background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:10px}
.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;width:min(82vw,360px);aspect-ratio:1}
.cell{background:#1b2230;border-radius:10px;position:relative}
.tile{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  border-radius:10px;font-weight:800;font-size:min(8.4vw,32px);
  color:#2a1d10;background:#eee4da;font-variant-numeric:tabular-nums;
  animation:pop .12s ease-out;
}
@keyframes pop{from{transform:scale(.86);opacity:.6}to{transform:scale(1);opacity:1}}
.t2{background:#eee4da}
.t4{background:#ede0c8}
.t8{background:#f2b179}
.t16{background:#f59563}
.t32{background:#f67c5f;color:#fff}
.t64{background:#f65e3b;color:#fff}
.t128{background:#edcf72;color:#241a06}
.t256{background:#edcc61;color:#241a06}
.t512{background:#edc850;color:#241a06}
.t1024{background:#edc53f;color:#241a06;font-size:min(7vw,26px)}
.t2048{background:#edc22e;color:#241a06;font-size:min(7vw,26px);box-shadow:0 0 24px rgba(237,194,46,.45)}

.overlay{
  position:absolute;inset:0;border-radius:18px;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:14px;text-align:center;
  background:rgba(10,12,17,.82);backdrop-filter:blur(3px);opacity:0;pointer-events:none;
  transition:opacity .2s;
}
.overlay.show{opacity:1;pointer-events:auto}
.overlay h3{margin:0;font-size:24px}
.overlay p{margin:0;color:var(--muted);font-size:14px}

/* ---------- snake ---------- */
.snake-board{background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:10px;line-height:0}
canvas{width:min(86vw,420px);height:min(86vw,420px);border-radius:10px;display:block;touch-action:none;background:#0e1219}
.pad{display:grid;grid-template-columns:repeat(3,56px);grid-template-rows:repeat(3,56px);gap:8px;margin-top:6px}
.pad button{
  background:var(--panel);border:1px solid var(--line);border-radius:12px;color:var(--text);
  font-size:18px;cursor:pointer;font-family:inherit;user-select:none;
}
.pad button:active{background:var(--panel2)}
.pad .sp{visibility:hidden}
@media (min-width:720px){.pad{display:none}}

@media (max-width:520px){
  .banner{padding:20px;gap:14px}
  .banner-seal{width:44px;height:62px;font-size:16px}
  .banner p{font-size:12px}
  nav{gap:14px}
}

/* ---------- 首页 2.0 ---------- */
.chips{display:flex;flex-wrap:wrap;gap:8px;margin:15px 0 0}
.chips span{
  font-size:11px;letter-spacing:.04em;color:#bfab8c;
  border:1px solid rgba(199,168,106,.22);border-radius:999px;
  padding:4px 10px;background:rgba(199,168,106,.05);
}
.row-card{
  display:flex;align-items:center;justify-content:space-between;gap:20px;
  width:min(720px,100%);padding:20px 24px;text-align:left;
  border:1px solid var(--line);border-radius:16px;
  background:linear-gradient(180deg,var(--panel2),var(--panel));
  transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease;
}
.row-card:hover{transform:translateY(-2px);border-color:#3a475c;box-shadow:0 14px 34px rgba(0,0,0,.3)}
.row-card h2{margin:0 0 6px;font-size:17px;letter-spacing:.02em}
.row-card p{margin:0;color:var(--muted);font-size:13px;line-height:1.65;max-width:520px}
.row-card .arrow{flex:none;color:var(--accent);font-size:13px;white-space:nowrap}
@media (max-width:520px){
  .row-card{padding:17px 18px;gap:12px}
  .row-card p{font-size:12px}
}

/* ---------- 小屏：导航收紧、横幅去掉装饰圈 ---------- */
@media (max-width:560px){
  .top{padding:14px 16px}
  .logo{font-size:15px}
  nav{gap:12px;font-size:12.5px}
  .home{padding:40px 16px 48px}
  .home h1{font-size:clamp(26px,7.4vw,32px)}
  .home .sub{font-size:13.5px;margin-bottom:28px}
  .banner::before,.banner::after{display:none}
  .banner p{font-size:12.5px;line-height:1.7}
  .banner h2{font-size:26px;margin:6px 0 5px}
  .banner{gap:12px}
  .banner-seal{width:34px;height:48px;font-size:13px;letter-spacing:.1em;opacity:.8}
  .chips span{font-size:10.5px;padding:3px 9px}
}

/* ---------- 首页 4.0：白底 + 分类卡片（全部挂在 body.light 下，不影响游戏页与 404） ---------- */
body.light{
  --bg:#f6f7f8;
  --panel:#ffffff;
  --panel2:#f7f8fa;
  --line:#e4e7ec;
  --text:#1b1f24;
  --muted:#6f7885;
  --accent:#2f6fd0;
  background:#f6f7f8;
  color:var(--text);
}
body.light .top{
  background:rgba(255,255,255,.94);
  border-bottom:1px solid var(--line);
  padding:15px 22px;
}
body.light .logo{color:#1b1f24}
body.light .logo span{color:#e0673f}

body.light .home{
  display:flex;flex-direction:column;align-items:center;
  justify-content:flex-start;
  padding:54px 20px 68px;
  text-align:center;
}

body.light .hero{width:100%;margin:0 0 44px}
body.light .hero h1{
  margin:0;font-size:clamp(30px,4.4vw,48px);
  font-weight:700;letter-spacing:.1em;line-height:1.22;
}
body.light .hero .sub{
  margin:12px 0 0;color:var(--muted);font-size:14px;line-height:1.8;
}

body.light .sec{width:100%;margin:0}
body.light .sec + .sec{margin-top:48px}
body.light .sec-title{
  display:flex;align-items:center;justify-content:center;gap:13px;
  margin:0 0 22px;font-size:19px;font-weight:600;
  letter-spacing:.12em;color:#22282f;
}
body.light .sec-title::before,
body.light .sec-title::after{
  content:"";width:5px;height:5px;display:block;
  background:#b9c1cc;transform:rotate(45deg);
}

body.light .sec-cards{
  display:flex;flex-wrap:wrap;justify-content:center;
  gap:22px;width:100%;max-width:880px;margin:0 auto;
}
body.light .sec-cards .entry{flex:0 1 272px;min-width:0}
body.light .sec-cards.two{max-width:583px}
body.light .entry{
  display:flex;flex-direction:column;
  background:#fff;border:1px solid var(--line);border-radius:4px;
  overflow:hidden;text-align:left;
  box-shadow:0 1px 2px rgba(16,24,40,.04);
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;
}
body.light .entry:hover{
  transform:translateY(-2px);border-color:#d5dae1;
  box-shadow:0 10px 26px rgba(16,24,40,.09);
}
body.light .entry-thumb{
  display:grid;place-items:center;
  aspect-ratio:16/10;
  background:linear-gradient(160deg,#fbfcfd,#f2f4f7);
  border-bottom:1px solid var(--line);
  overflow:hidden;
}
body.light .entry-thumb svg{width:58%;height:58%;display:block}
body.light .entry.warm .entry-thumb{background:linear-gradient(160deg,#fdfaf7,#faf1ea)}

body.light .entry-body{display:flex;flex-direction:column;flex:1;padding:17px 18px 20px}
body.light .entry-body h3{margin:0 0 7px;font-size:16px;font-weight:600;letter-spacing:.01em}
body.light .entry-body h3 a{color:#1b1f24}
body.light .entry-body h3 a:hover{color:#2f6fd0}
body.light .entry-body .meta{margin:0 0 9px;font-size:11.5px;color:#949ca7;letter-spacing:.02em}
body.light .entry-body .desc{margin:0 0 17px;font-size:13px;line-height:1.76;color:var(--muted);flex:1}
body.light .entry-actions{display:flex;gap:8px;margin-top:auto}
body.light .b1,
body.light .b2{
  display:inline-flex;align-items:center;justify-content:center;
  padding:7px 15px;border-radius:3px;font-size:12.5px;letter-spacing:.02em;
  transition:background .15s ease,border-color .15s ease,color .15s ease;
}
body.light .b1{background:#2f6fd0;border:1px solid #2f6fd0;color:#fff}
body.light .b1:hover{background:#2a63ba;border-color:#2a63ba}
body.light .b2{background:#fff;border:1px solid #d7dce3;color:#4a5260}
body.light .b2:hover{border-color:#b6bfcb;color:#1b1f24}

/* 底部说明面板 + 右侧按钮 */
body.light .notice{
  display:flex;align-items:flex-start;gap:22px;
  width:100%;max-width:880px;margin:54px auto 0;
  padding:26px 28px;text-align:left;
  background:#fff;border:1px solid var(--line);border-radius:4px;
  box-shadow:0 1px 2px rgba(16,24,40,.04);
}
body.light .notice-icon{flex:none;width:54px;height:54px;display:grid;place-items:center}
body.light .notice-icon svg{width:100%;height:100%;display:block}
body.light .notice-text p{
  margin:0 0 10px;font-size:13.5px;line-height:1.9;color:#5b6472;
}
body.light .notice-text p:last-child{margin-bottom:0}
body.light .notice-text a{color:#2f6fd0;border-bottom:1px solid rgba(47,111,208,.3)}
body.light .notice-cta{
  display:flex;justify-content:flex-end;
  width:100%;max-width:880px;margin:14px auto 0;
}
body.light .cta{
  display:inline-flex;align-items:center;gap:6px;
  padding:9px 18px;border-radius:3px;
  background:#e0673f;color:#fff;font-size:13px;letter-spacing:.02em;
  transition:background .15s ease;
}
body.light .cta:hover{background:#cf5b35}

body.light .foot{
  background:#f6f7f8;border-top:1px solid var(--line);
  color:#9aa2ad;padding:26px 20px;
}

@media (max-width:760px){
  body.light .home{padding:36px 16px 54px}
  body.light .hero{margin-bottom:32px}
  body.light .hero .sub{font-size:13px}
  body.light .sec-cards,
  body.light .sec-cards.two{flex-direction:column;max-width:460px;gap:16px}
  body.light .sec-cards .entry{flex:1 1 auto}
  body.light .entry-thumb{aspect-ratio:2/1}
  body.light .entry-thumb svg{width:36%;height:60%}
  body.light .notice{flex-direction:column;gap:16px;margin-top:38px;padding:22px 20px}
  body.light .notice-icon{width:46px;height:46px}
  body.light .notice-text p{font-size:13px}
  body.light .notice-cta{justify-content:center;margin-top:12px}
}

