/* puzzle.mathduel.games 共享导航样式 —— 对齐主站 mathduel.games 设计语言
   深蓝灰侧边栏 + 青绿主色 + 移动端底部导航 */
:root {
  --primary:#0D9488; --primary-dark:#0F766E; --primary-light:#2DD4BF;
  --accent:#F59E0B; --accent-dark:#D97706;
  --sidebar-bg:#1E293B; --sidebar-text:#E2E8F0; --sidebar-text-dim:#94A3B8;
  --sidebar-active:rgba(13,148,136,.18);
  --bg:#F8FAFC; --surface:#fff; --border:#E2E8F0;
  --text:#0F172A; --text-light:#475569; --text-muted:#94A3B8;
  --success:#10B981; --danger:#EF4444;
  --radius:.75rem; --radius-sm:.5rem; --radius-card:20px;
  --touch:44px;
  --shadow:0 2px 4px -1px rgba(0,0,0,.06),0 1px 2px -1px rgba(0,0,0,.04);
  --shadow-lg:0 8px 16px -4px rgba(0,0,0,.1),0 4px 8px -4px rgba(0,0,0,.04);
  --shadow-soft:0 4px 16px 0 rgba(0,27,56,.08);
  --font-base:-apple-system,BlinkMacSystemFont,'Segoe UI','Noto Sans SC','PingFang SC',sans-serif;
}
*{margin:0;padding:0;box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{font-family:var(--font-base);background:var(--bg);color:var(--text);line-height:1.6;min-height:100vh;overflow-x:hidden;-webkit-tap-highlight-color:transparent}
a{color:var(--primary);text-decoration:none}

/* ═══ 侧边栏 + 主区布局 ═══ */
.layout{display:flex;min-height:100vh}
.sidebar{width:247px;flex-shrink:0;background:var(--sidebar-bg);color:var(--sidebar-text);display:flex;flex-direction:column;padding:1rem .75rem;position:sticky;top:0;height:100vh;overflow-y:auto;gap:.25rem}
.sidebar-brand{display:flex;align-items:center;gap:.5rem;font-weight:800;font-size:1.15rem;color:#fff;text-decoration:none;padding:.5rem .75rem .75rem}
.sidebar-group-label{font-size:.7rem;letter-spacing:.12em;text-transform:uppercase;color:var(--sidebar-text-dim);padding:.9rem .75rem .35rem;font-weight:600}
.sidebar-link{display:flex;align-items:center;gap:.6rem;color:var(--sidebar-text);text-decoration:none;font-weight:500;font-size:.9rem;padding:.55rem .75rem;border-radius:8px;min-height:40px;transition:background .15s,color .15s}
.sidebar-link:hover{background:rgba(255,255,255,.08);color:#fff}
.sidebar-link.active{background:var(--sidebar-active);color:var(--primary-light)}
.sidebar-link .ico{width:22px;text-align:center;font-size:1rem;flex-shrink:0}
.sidebar-spacer{flex:1}
.sidebar-footer{display:flex;gap:.25rem;padding:.5rem .25rem;flex-wrap:wrap}
.sidebar-footer a{color:var(--sidebar-text-dim);font-size:.78rem;padding:.25rem .5rem;text-decoration:none;border-radius:6px}
.sidebar-footer a:hover{color:#fff;background:rgba(255,255,255,.08)}
.layout-main{flex:1;min-width:0;background:var(--bg)}
.layout-main>.container{max-width:1200px;margin:0 auto;padding:1.25rem}
.layout-main>.container.narrow{max-width:720px}

/* 移动端顶栏 */
.mobile-topbar{display:none}

/* ═══ 游戏页统一标题区 ═══ */
.gm-head{display:flex;align-items:center;gap:.75rem;margin-bottom:.75rem}
.gm-head .gm-ico{width:48px;height:48px;border-radius:12px;background:var(--primary);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:1.4rem;flex-shrink:0}
.gm-head .gm-title{font-size:1.4rem;font-weight:800;margin:0;line-height:1.2;color:var(--text)}
.gm-head .gm-sub{font-size:.85rem;color:var(--text-light);margin:0}

/* ═══ 移动端：抽屉 + 顶栏 ═══ */
@media (max-width:820px){
  .layout{display:block}
  .mobile-topbar{display:flex;align-items:center;gap:.5rem;position:sticky;top:0;z-index:60;background:var(--sidebar-bg);color:#fff;padding:.4rem .75rem;box-shadow:0 2px 8px rgba(15,23,42,.25)}
  .mobile-topbar .topbar-brand{display:flex;align-items:center;gap:.4rem;font-weight:800;font-size:1.05rem;color:#fff;text-decoration:none;white-space:nowrap}
  .hamburger{width:var(--touch);height:var(--touch);flex-shrink:0;display:flex;align-items:center;justify-content:center;background:none;border:none;color:#fff;font-size:1.5rem;line-height:1;cursor:pointer;border-radius:8px;-webkit-tap-highlight-color:transparent}
  .hamburger:hover,.hamburger:focus-visible{background:rgba(255,255,255,.1)}
  .hamburger .close-ico{display:none}
  body.drawer-open .hamburger .open-ico{display:none}
  body.drawer-open .hamburger .close-ico{display:inline}
  .sidebar{position:fixed;top:0;left:0;width:280px;max-width:82vw;height:100dvh;flex-direction:column;flex-wrap:nowrap;padding:1rem .75rem;z-index:100;transform:translateX(-100%);transition:transform .4s cubic-bezier(.25,.8,.25,1);box-shadow:4px 0 24px rgba(15,23,42,.35)}
  body.drawer-open .sidebar{transform:translateX(0)}
  .sidebar-brand{padding:.5rem .75rem .75rem}
  .sidebar-group-label{display:block}
  .sidebar-spacer,.sidebar-footer{display:flex}
  .sidebar-footer{margin-top:auto}
  .drawer-backdrop{position:fixed;inset:0;z-index:90;background:rgba(15,23,42,.55);opacity:0;pointer-events:none;transition:opacity .3s ease}
  body.drawer-open .drawer-backdrop{opacity:1;pointer-events:auto}
  body.drawer-open{overflow:hidden}
  .layout-main>.container{padding:.75rem}
  .gm-head{flex-direction:column;align-items:flex-start;gap:.5rem}
  .gm-head .gm-ico{width:42px;height:42px;font-size:1.15rem;border-radius:10px}
  .gm-head .gm-title{font-size:1.3rem}
}

/* ═══ 移动端底部导航 ═══ */
.bottom-nav{display:none;position:fixed;left:0;right:0;bottom:0;z-index:80;background:var(--sidebar-bg);border-top:1px solid rgba(255,255,255,.08);box-shadow:0 -4px 16px rgba(15,23,42,.22);padding-bottom:env(safe-area-inset-bottom,0)}
.bottom-nav-inner{display:flex;align-items:stretch;justify-content:space-around;max-width:560px;margin:0 auto}
.bottom-nav-item{flex:1 1 0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-height:calc(var(--touch) + 12px);padding:.35rem .2rem .3rem;color:var(--sidebar-text-dim);text-decoration:none;font-size:.66rem;font-weight:600;letter-spacing:.01em;-webkit-tap-highlight-color:transparent;transition:color .15s,background .15s}
.bottom-nav-item .bn-ico{font-size:1.3rem;line-height:1.25;transition:transform .15s}
.bottom-nav-item.active{color:var(--primary-light)}
.bottom-nav-item.active .bn-ico{transform:translateY(-1px)}
.bottom-nav-item:active{background:rgba(255,255,255,.08)}
@media (max-width:820px){
  .bottom-nav{display:block}
  .layout-main{padding-bottom:calc(var(--touch) + 28px)}
}
