/* 现代互联网风格样式：柔和配色、卡片+阴影、响应式布局、系统暗色模式适配 */
:root{
  --bg:#f6f7fb;
  --surface:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --primary:#4f46e5;   /* indigo */
  --primary-2:#06b6d4; /* cyan for gradient */
  --success:#12b981;
  --danger:#ef4444;
}
*{box-sizing:border-box}
body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans CJK SC", sans-serif;
  margin:0; color:var(--text); background:radial-gradient(1000px 500px at 10% -10%, #eef2ff, transparent), var(--bg);
}

/* 顶部横幅 */
header{
  padding:28px 16px 36px;
  color:#fff;
  background:linear-gradient(120deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 24px rgba(30, 41, 59, .25);
}
h1{margin:0 0 6px; font-size:28px; letter-spacing:.3px}
.sub{margin:0; opacity:.95}

/* 容器：控制最大宽度 */
.toolbar, .panel, .table, .cards{ max-width: 1080px; margin: 14px auto; }

/* 顶部工具条（卡片） */
.toolbar{
  display:flex; flex-wrap:wrap; gap:10px; align-items:center;
  padding:14px 16px; background:var(--surface);
  border:1px solid var(--border); border-radius:14px;
  box-shadow:0 8px 24px rgba(2,6,23,.06);
}
.toolbar select{
  appearance:none; -webkit-appearance:none;
  padding:10px 12px; border:1px solid var(--border); border-radius:10px;
  background:#fff; color:var(--text); font-size:14px;
}
.toolbar button{ margin-left:2px; }

/* 主内容卡片 */
.panel{ padding:18px 0; }
.question{ font-size:22px; font-weight:700; margin:0 16px 12px; }
.answer-area{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin:0 16px 14px; }
#answer-input{
  padding:12px 14px; font-size:16px; min-width:220px;
  border:1px solid var(--border); border-radius:12px; outline:none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
#answer-input:focus{ border-color:color-mix(in srgb, var(--primary) 50%, #8da2fb); box-shadow:0 0 0 4px rgba(79,70,229,.12); }

/* 通用按钮 */
.toolbar button, .answer-area button{
  padding:10px 14px; border:1px solid transparent; border-radius:12px; cursor:pointer;
  background:linear-gradient(135deg, #6366f1, #8b5cf6); color:#fff; font-weight:600; letter-spacing:.2px;
  box-shadow:0 6px 16px rgba(79,70,229,.25); transition: transform .08s ease, box-shadow .2s ease, filter .2s ease;
}
.toolbar button:hover, .answer-area button:hover{ transform:translateY(-1px); filter:brightness(1.02); box-shadow:0 10px 24px rgba(79,70,229,.3) }
.toolbar button:active, .answer-area button:active{ transform:translateY(0) scale(.98) }

/* 备选项按钮（次级） */
.choices{ display:flex; gap:10px; flex-wrap:wrap }
.choices button{
  background:#fff; color:var(--text); font-weight:600;
  border:1px solid var(--border); border-radius:999px; padding:8px 14px;
  box-shadow:0 4px 14px rgba(2,6,23,.06); transition:all .15s ease;
}
.choices button:hover{ background:#f5f7ff; border-color:#c7d2fe; box-shadow:0 8px 20px rgba(2,6,23,.08) }

/* 结果与提示 */
.result{ min-height:24px; margin:8px 16px; font-weight:700 }
.result.ok{ color:var(--success) }
.result.bad{ color:var(--danger) }
.tip{
  margin:8px 16px; padding:14px 14px; color:#334155; background:linear-gradient(0deg, #fff, #fff);
  border:1px solid #c7d2fe; border-left:4px solid var(--primary); border-radius:12px;
  box-shadow:0 6px 20px rgba(2,6,23,.06);
}

/* 口袋表 */
.table{ padding:0 16px 20px }
.table h2{ margin:12px 0 8px; font-size:18px; color:#0f172a }
.grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:12px }
.cell{
  background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:12px 14px; text-align:center;
  box-shadow:0 8px 22px rgba(2,6,23,.06); transition: transform .12s ease, box-shadow .2s ease;
}
.cell:hover{ transform: translateY(-2px); box-shadow:0 16px 28px rgba(2,6,23,.08) }
.cell .p{ font-weight:800; color:#1d4ed8; font-size:18px }
.cell .n{ color:var(--muted); font-size:13px }
.note{ color:var(--muted); margin-top:8px }

/* 卡片区 */
.cards{ padding:0 16px 24px }
.details, details{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:10px 14px; box-shadow:0 8px 22px rgba(2,6,23,.06) }
summary{ cursor:pointer; font-weight:700 }

/* 右下角得分小胶囊 */
footer{ position:fixed; right:16px; bottom:16px; z-index:30 }
footer #score, footer #wrong{
  display:inline-block; padding:10px 14px; background:#0ea5e9; color:#fff; border-radius:999px; font-weight:700;
  box-shadow:0 12px 26px rgba(14,165,233,.35);
}
footer #wrong{ margin-left:8px; cursor:pointer; }
footer #wrong:hover{ filter:brightness(1.05); }

/* 暗色模式（跟随系统） */
@media (prefers-color-scheme: dark){
  :root{
    --bg:#0b1220; --surface:#0f172a; --text:#e5e7eb; --muted:#94a3b8; --border:#1f2937;
  }
  body{ background: radial-gradient(1000px 500px at 10% -10%, rgba(79,70,229,.25), transparent), var(--bg); }
  .toolbar, .cell, details, .tip{ box-shadow: 0 10px 26px rgba(0,0,0,.35); }
  .choices button{ background:#111827; color:var(--text); border-color:#223; }
  .choices button:hover{ background:#0b1220; }
}




/* 首页 hero 与工具卡样式 + 返回首页按钮 */
.home-link{
  display:inline-flex; align-items:center; gap:6px; text-decoration:none; color:#fff;
  background:rgba(255,255,255,.18); border:1px solid rgba(255,255,255,.35);
  padding:6px 10px; border-radius:999px; backdrop-filter:saturate(120%) blur(2px);
  box-shadow:0 6px 16px rgba(0,0,0,.08);
}
.home-link:hover{ background:rgba(255,255,255,.24) }

.hero{ max-width:1080px; margin:16px auto 10px; padding:8px 16px 0; }
.hero h1{ font-size:32px; margin:0 0 8px; color:#fff }
.hero .lead{ color:rgba(255,255,255,.95); margin:0; }

.tools{ max-width:1080px; margin:14px auto; padding:0 16px; }
.tools-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:14px; }
.tool-card{
  display:block; text-decoration:none; color:inherit; background:var(--surface); border:1px solid var(--border);
  border-radius:16px; padding:16px; box-shadow:0 10px 26px rgba(2,6,23,.06); transition: transform .12s, box-shadow .2s;
}
.tool-card:hover{ transform: translateY(-2px); box-shadow:0 18px 34px rgba(2,6,23,.09) }
.tool-icon{
  width:46px; height:46px; border-radius:12px; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg, #6366f1, #06b6d4); color:#fff; font-weight:800;
}
.tool-title{ font-weight:800; margin:10px 0 6px; }
.tool-desc{ color:var(--muted); font-size:14px; line-height:1.45; min-height:40px }
.tool-tag{ display:inline-block; margin-top:10px; padding:6px 10px; border-radius:999px; background:#eef2ff; color:#3949ab; font-weight:700; font-size:12px }



/* 底部操作条（移动端优先） */
.bottom-bar{
  position:fixed; left:0; right:0; bottom:0; z-index:40; display:none;
  padding:10px 12px; gap:10px; border-top:1px solid var(--border);
  background:rgba(255,255,255,.86); backdrop-filter: blur(8px) saturate(120%);
}
.bottom-bar button{ flex:1 1 auto; }

@media (prefers-color-scheme: dark){
  .bottom-bar{ background: rgba(15,23,42,.75); border-top-color:#243047; }
}

/* 移动端细化适配 */
@media (max-width: 640px){
  header{ padding:22px 14px 26px; }
  h1{ font-size:22px; }
  .toolbar{ padding:12px; gap:8px; }
  .toolbar select{ width:100%; }
  .toolbar button{ flex:1 1 auto; min-width:calc(50% - 6px); }
  .panel{ padding:12px 0; }
  .question{ font-size:20px; margin:0 12px 10px; }
  .answer-area{ margin:0 12px 12px; gap:8px; }
  #answer-input{ min-width:0; width:100%; flex:1 1 160px; }
  .choices{ gap:8px; }
  .choices button{ padding:10px 12px; min-height:40px; }
  .grid{ grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:10px; }
  .cell .p{ font-size:16px; }
  .bottom-bar{ display:flex; }
  .has-bottom-bar footer{ bottom:84px; }
  .has-bottom-bar .panel{ padding-bottom:92px; }

  footer{ left:50%; right:auto; transform:translateX(-50%); bottom:12px; }
  footer #score, footer #wrong{ padding:9px 12px; }
}
