/* 牛夫子錯題本：全站頁首導覽＋圖示（2026-10-19）；配 wb-nav.js、wb-icons.js */
:root {
  --wn-wine: #5c222b; --wn-wine-2: #7a2e3c; --wn-ink: #2b2024; --wn-soft: #7d6a6f; --wn-line: #eee3df;
  --wn-bg: #fff; --wn-hover: #faf3f1; --wn-shadow: 0 18px 40px -12px rgba(60, 22, 29, .22), 0 2px 6px rgba(60, 22, 29, .06);
  --c-wine: #7a2e3c; --c-wine-bg: #fbeef0; --c-amber: #b45f0e; --c-amber-bg: #fff3e3;
  --c-teal: #0f766e; --c-teal-bg: #e6f5f2; --c-violet: #6d3fb0; --c-violet-bg: #f1ebfb;
}
/* 舊頁面黏在頂端的分頁列、搜尋列要讓出導覽列的高度 */
html { --wn-h: 64px; }
html .wb-tabs, html .tabs { top: var(--wn-h); }
html .gd-search { top: calc(var(--wn-h) + 4px); }
.wbi { width: 1.25em; height: 1.25em; flex: 0 0 auto; vertical-align: -.22em; }

.wn { position: sticky; top: 0; z-index: 100; background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--wn-line); font-family: inherit; }
.wn-bar { max-width: 1180px; margin: 0 auto; height: 64px; padding: 0 20px; display: flex; align-items: center; gap: 8px; }
.wn a { text-decoration: none; }
.wn-brand { display: flex; align-items: center; gap: 8px; margin-right: 14px; color: var(--wn-wine); white-space: nowrap; flex: 0 0 auto; }
.wn-brand img { height: 40px; width: auto; }
.wn-brand span { display: flex; flex-direction: column; line-height: 1.1; }
.wn-brand b { font-size: 1.12rem; letter-spacing: .03em; }
.wn-brand small { font-size: .72rem; color: var(--wn-soft); letter-spacing: .12em; font-weight: 600; }

.wn-menu { display: flex; align-items: stretch; height: 100%; flex: 1 1 auto; min-width: 0; }
.wn-top { position: relative; display: flex; align-items: center; }
.wn-btn { display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 13px; border: 0; background: none; border-radius: 10px;
  font: inherit; font-size: .97rem; font-weight: 600; color: var(--wn-ink); white-space: nowrap; cursor: pointer; }
.wn-btn:hover, .wn-top.open > .wn-btn { background: var(--wn-hover); color: var(--wn-wine); }
.wn-top.on > .wn-btn { color: var(--wn-wine); box-shadow: inset 0 -2px 0 var(--wn-wine); border-radius: 10px 10px 0 0; }
.wn-car { width: 15px; height: 15px; opacity: .55; transition: transform .2s; }
.wn-top.open .wn-car { transform: rotate(180deg); }

.wn-panel { position: absolute; top: calc(100% + 4px); left: -8px; min-width: 320px; background: var(--wn-bg); border: 1px solid var(--wn-line);
  border-radius: 16px; box-shadow: var(--wn-shadow); padding: 14px; opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .16s, transform .16s, visibility .16s; }
.wn-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }  /* 滑鼠移到面板的橋 */
.wn-top.open > .wn-panel { opacity: 1; visibility: visible; transform: none; }
.wn-panel.wide { left: 50%; transform: translate(-42%, 6px); width: min(1040px, calc(100vw - 40px)); }
.wn-top.open > .wn-panel.wide { transform: translate(-42%, 0); }
.wn-cols { display: flex; gap: 6px; }
.wn-ho { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--wn-line); }
.wn-ho-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px 6px; }
.wn-col { flex: 1 1 0; min-width: 230px; }
.wn-ct { display: flex; align-items: center; gap: 8px; padding: 4px 10px 8px; font-size: .78rem; font-weight: 700; letter-spacing: .1em; color: var(--wn-soft); }
.wn-ct span { font-size: .72rem; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; background: var(--wn-hover); color: var(--wn-wine); }
.wn-it { display: flex; gap: 12px; align-items: flex-start; padding: 9px 10px; border-radius: 12px; color: var(--wn-ink); }
.wn-it:hover { background: var(--wn-hover); }
.wn-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--c-wine-bg); color: var(--c-wine); flex: 0 0 auto; }
.wn-ic .wbi { width: 19px; height: 19px; }
.wn-tx { display: flex; flex-direction: column; min-width: 0; }
.wn-tx b { font-size: .95rem; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.wn-tx small { font-size: .82rem; color: var(--wn-soft); line-height: 1.45; margin-top: 1px; }
.wn-ext { width: 13px; height: 13px; opacity: .45; transform: rotate(-45deg); }
.wn-badge { font-style: normal; font-size: .68rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: #fdf0d8; color: #9a5a06; }
.c-amber .wn-ic { background: var(--c-amber-bg); color: var(--c-amber); } .c-amber .wn-ct span { background: var(--c-amber-bg); color: var(--c-amber); }
.c-teal .wn-ic { background: var(--c-teal-bg); color: var(--c-teal); } .c-teal .wn-ct span { background: var(--c-teal-bg); color: var(--c-teal); }
.c-violet .wn-ic { background: var(--c-violet-bg); color: var(--c-violet); } .c-violet .wn-ct span { background: var(--c-violet-bg); color: var(--c-violet); }
.wn-foot { display: flex; align-items: center; gap: 8px; margin: 10px 4px 0; padding: 11px 14px; border-radius: 12px; background: var(--wn-hover);
  color: var(--wn-wine) !important; font-weight: 700; font-size: .92rem; }
.wn-foot .wbi:last-child { margin-left: auto; }
.wn-foot:hover { background: #f5e7e4; }

.wn-act { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
.wn-login { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--wn-ink); font-weight: 600; white-space: nowrap; }
.wn-login:hover { background: var(--wn-hover); color: var(--wn-wine); }
.wn-ava { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--wn-wine); color: #fff; font-style: normal; font-size: .82rem; font-weight: 700; }
.wn-cta { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: 10px; background: var(--wn-wine); color: #fff !important;
  font-weight: 700; white-space: nowrap; box-shadow: 0 4px 12px -4px rgba(92, 34, 43, .5); }
.wn-cta:hover { background: var(--wn-wine-2); }
.wn-burger { display: none; width: 42px; height: 42px; border: 0; background: none; border-radius: 10px; color: var(--wn-ink); cursor: pointer; }
.wn-burger .wbi { width: 24px; height: 24px; } .wn-close { display: none; }
.wn-xrow, .wn-ph { display: none; }   /* 手機選單打開時才出現（下面） */

/* 平板、手機：漢堡選單＋手風琴 */
@media (max-width: 1023px) {
  html { --wn-h: 58px; }
  .wn { backdrop-filter: none; background: #fff; }   /* backdrop-filter 會讓 fixed 的選單改以頁首為基準，手機抽屜只剩一行 */
  .wn-bar { height: 58px; padding: 0 12px; }
  .wn-brand img { height: 34px; }
  .wn-burger { display: grid; place-items: center; }
  .wn-login.in span { display: none; } .wn-login { padding: 0 9px; gap: 4px; }   /* 甲 4（11-24）：沒登入時手機也顯示「登入」兩字；登入後只留頭像 */
  .wn-cta { height: 38px; padding: 0 14px; }
  .wn-menu { display: none; position: fixed; top: 58px; left: 0; right: 0; height: calc(100vh - 58px); height: calc(100dvh - 58px); overflow-y: auto; background: #fff; flex-direction: column;
    padding: 8px 12px 40px; border-top: 1px solid var(--wn-line); }
  .wn.mob .wn-menu { display: flex; }
  .wn.mob .wn-open { display: none; } .wn.mob .wn-close { display: block; }
  .wn-top { flex-direction: column; align-items: stretch; border-bottom: 1px solid var(--wn-line); }
  .wn-btn { height: 54px; width: 100%; justify-content: space-between; font-size: 1.04rem; padding: 0 8px; }
  .wn-top.on > .wn-btn { box-shadow: none; }
  .wn-panel, .wn-panel.wide { position: static; width: auto; min-width: 0; transform: none; box-shadow: none; border: 0; padding: 0 0 10px;
    display: none; opacity: 1; visibility: visible; }
  .wn-top.open > .wn-panel, .wn-top.open > .wn-panel.wide { display: block; }
  .wn-ho-list { grid-template-columns: 1fr; }
  .wn-top.open > .wn-panel.wide { transform: none; }
  .wn-cols { flex-direction: column; gap: 4px; }
  .wn-col { min-width: 0; }
  /* 選單打開（2026-10-28 評審 P0-1）：只鎖 html 的捲動（鎖 body 會讓 body 變成捲動容器，黏住的頁首就跑到畫面外），
     頁首改成 fixed 固定在最上面，✕ 一定看得到；.wn-ph 補回頁首的高度避免內容跳動 */
  html.wn-lock { overflow: hidden; }
  .wn.mob { position: fixed; top: 0; left: 0; right: 0; }
  .wn-ph { height: var(--wn-h); }
  html.wn-lock .wn-ph { display: block; }
  .wn.mob .wn-xrow { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 44px; margin: 0 0 4px; border: 0; border-radius: 12px;
    background: var(--wn-hover); color: var(--wn-wine); font: inherit; font-size: .95rem; font-weight: 700; cursor: pointer; }
  .wn-xrow .wbi { width: 18px; height: 18px; }
  .wn.mob .wn-menu { padding-bottom: 120px; }   /* 選單下方留一段空白，點空白處也會關 */
}
/* ══════════ 手機選單：快速入口、年段列、次要類別（2026-10-28 評審 P1-3）══════════ */
.wn-quick, .wn-lv { display: none; }
html[data-wblv="jh"] .wn-it[data-lv="hs"], html[data-wblv="hs"] .wn-it[data-lv="jh"] { }   /* 桌機兩個年段都列 */
@media (max-width: 1023px) {
  .wn.mob .wn-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 8px; }
  .wn-quick a { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 12px; border-radius: 14px; background: var(--wn-hover); color: var(--wn-wine); font-weight: 800; font-size: 1rem; }
  .wn-quick a .wbi { width: 24px; height: 24px; }
  .wn-quick em { font-style: normal; margin-left: auto; background: var(--c-amber); color: #fff; font-size: .72rem; padding: 2px 8px; border-radius: 99px; }
  .wn.mob .wn-lv { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px 4px; font-size: .82rem; color: var(--wn-soft); }
  .wn-lv b { color: var(--wn-ink); } .wn-lv a { color: var(--wn-wine); font-weight: 700; text-decoration: underline; }
  html[data-wblv="jh"] .wn-it[data-lv="hs"], html[data-wblv="hs"] .wn-it[data-lv="jh"] { display: none; }   /* 手機只顯示目前年段的工具 */
  .wn-top.wn-sm .wn-btn { height: 46px; font-size: .95rem; font-weight: 600; color: var(--wn-soft); }
}

/* ══════════ 底部導覽列（2026-10-28 評審 P1-1；wb-nav.js 注入）══════════
 * z-index 55：低於「拍一題錯題」視窗（.wb-snap 60）與「開啟每日提醒」引導視窗（.wb-pn 150），高於浮動鈕（40）。 */
.wn-bn, .wn-more { display: none; }
@media (max-width: 767px) {
  html.wn-hasbn body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  html.wn-hasbn .wb-tabs, html.wn-hasbn #tabs, html.wn-hasbn .wb-fab { display: none !important; }
  .wn-bn { position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; height: calc(60px + env(safe-area-inset-bottom)); padding: 0 0 env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--wn-line); display: flex; align-items: stretch; box-shadow: 0 -6px 20px -14px rgba(60, 22, 29, .3); }
  .wn-bn a, .wn-bn button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none;
    font: inherit; font-size: .68rem; font-weight: 700; color: var(--wn-soft); text-decoration: none; position: relative; padding: 0; cursor: pointer; }
  .wn-bn .wbi { width: 24px; height: 24px; }
  .wn-bn .on { color: var(--wn-wine); }
  .wn-bn .bn-c { flex: 0 0 76px; }
  .wn-bn .bn-c i { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--wn-wine); color: #fff; margin-top: -26px;
    box-shadow: 0 6px 16px -4px rgba(92, 34, 43, .55); border: 4px solid #fbf6f0; }
  .wn-bn .bn-c i .wbi { width: 28px; height: 28px; }
  .wn-bn .bn-c span { color: var(--wn-wine); }
  .wn-bn .bn-badge { position: absolute; top: 6px; left: 50%; margin-left: 4px; font-style: normal; background: var(--c-amber); color: #fff; font-size: .62rem; line-height: 1; padding: 3px 6px; border-radius: 99px; }
  .wn-bn .bn-badge[hidden] { display: none; }
  .wn-more { position: fixed; inset: 0; z-index: 58; background: rgba(40, 20, 24, .5); display: flex; align-items: flex-end; justify-content: center; }
  .wn-more-box { background: #fbf6f0; width: 100%; max-width: 480px; border-radius: 22px 22px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
  .wn-more-h { display: flex; align-items: center; margin: 2px 4px 10px; } .wn-more-h b { flex: 1; font-size: 1.05rem; color: var(--wn-wine); }
  .wn-more-x { width: 40px; height: 40px; border: 0; background: none; color: var(--wn-ink); cursor: pointer; display: grid; place-items: center; } .wn-more-x .wbi { width: 22px; height: 22px; }
  .wn-more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .wn-more-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px; background: #fff; border: 1px solid var(--wn-line); border-radius: 14px;
    font-size: .78rem; font-weight: 700; color: var(--wn-ink); text-decoration: none; text-align: center; min-height: 44px; }
  .wn-more-grid a .wbi { width: 24px; height: 24px; color: var(--c-wine); }
  .wn-more-grid .wn-badge { display: block; margin: 2px auto 0; width: max-content; }
  .wn-more-acct { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--wn-line); font-size: .9rem; color: var(--wn-ink); text-decoration: none; }
  .wn-more-acct .wbi { width: 20px; height: 20px; color: var(--c-wine); } .wn-more-acct b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; } .wn-more-acct small { color: var(--wn-soft); }
}

/* 功能畫面的「？」（2026-10-28 教學頁；wb-nav.js helpMark） */
.wb-help { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 8px; border-radius: 50%; border: 1.5px solid var(--wn-line); background: #fff; color: var(--wn-soft);
  font-size: .9rem; font-weight: 700; text-decoration: none; vertical-align: middle; line-height: 1; }
.wb-help:hover { border-color: var(--wn-wine); color: var(--wn-wine); }
@media (max-width: 640px) { .wb-help { width: 32px; height: 32px; } }

/* ══════════ 頁首區精簡（2026-10-28 評審 P1-2）：手機上一行小牛＋標題，灰字介紹收起 ══════════ */
.wb-hero-q { display: none; }
@media (max-width: 640px) {
  .wb-hero { align-items: center; gap: 10px; margin: 2px 0 8px; flex-wrap: nowrap; }
  .wb-hero > img { width: 44px !important; height: auto; }
  .wb-hero h1 { font-size: 1.25rem; }
  .wb-hero p { display: none; margin-top: 4px; font-size: .9rem; }
  .wb-hero.open p { display: block; }
  .wb-hero-q { display: inline-block; border: 0; background: none; padding: 4px 0; font: inherit; font-size: .8rem; color: var(--wn-soft); cursor: pointer; text-decoration: underline dotted; }
}
@media print { .wn-bn, .wn-more { display: none !important; } }
@media (max-width: 380px) { .wn-brand small { display: none; } .wn-cta { padding: 0 11px; } }
/* 甲 4（11-24）：手機顯示「登入」兩字後頂部會超出畫面（原本 360px 就多 4px）：窄螢幕收緊間距，340px 以下才只留圖示 */
@media (max-width: 430px) { .wn-bar { padding: 0 8px; } .wn-brand { margin-right: 4px; gap: 6px; } .wn-brand b { font-size: 1rem; } .wn-act { gap: 2px; }
  .wn-login { padding: 0 6px; } .wn-cta { padding: 0 10px; } .wn-burger { width: 38px; } }
@media (max-width: 340px) { .wn-login:not(.in) span { display: none; } .wn-brand img { height: 30px; } }
@media print { .wn { display: none; } }
/* 站長後台入口（只有站長帳號看得到；11-25） */
.wn-admin { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px; border-radius: 999px; border: 1px dashed var(--wn-wine); color: var(--wn-wine); font-size: .85rem; font-weight: 700; white-space: nowrap; }
.wn-admin:hover { background: var(--wn-hover); }
.wn-admin svg { width: 16px; height: 16px; }
@media (max-width: 640px) { .wn-admin span { display: none; } .wn-admin { padding: 0 8px; } }
.wn-more-adm { border-top: 1px dashed var(--wn-line, #e7ddd5); }
