/* ---------- 導覽（final11，站長 B15）：返回母版、頁內分頁母版、覆蓋頁、紀錄頁、設定頁。對應 js/back.js、js/subtabs.js、js/history.js、js/settings-view.js ---------- */

/* 「< 返回」：左上角一顆扁平按鈕（沿用翻譯產品 panel-back 的樣子），觸控區 44px */
.panel-back { display: inline-flex; align-items: center; gap: 4px; min-width: 44px; min-height: 44px; padding: 0 6px 0 0;
  border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 1.0625rem; letter-spacing: .1em; cursor: pointer; }
.panel-back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.panel-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.page-back-bar { margin: -10px 0 10px; }

/* 頁內分頁（算號、學說、紀錄共用一個母版）：字 ≥15px（B8），選中的那格底下一條金線 */
.subtabs { display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.subtabs button { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 6px 4px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--muted); font: inherit; font-size: 1.0625rem; letter-spacing: .12em; cursor: pointer; white-space: nowrap; }
.subtabs button[aria-selected="true"] { color: #f1e6cc; border-bottom-color: var(--accent); font-weight: 700; }
.subtabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
@media (hover: hover) { .subtabs button:hover { color: var(--text); } }

/* 覆蓋頁：從頁首下緣開始（遮罩不蓋頁首），內容卡片在上方、左上「< 返回」 */
.layer { position: fixed; left: 0; right: 0; bottom: 0; top: var(--layer-top, 64px); z-index: 15; display: grid; justify-items: center; align-items: start; }
.layer-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); }
.layer-in { position: relative; width: min(560px, calc(100% - 32px)); max-height: calc(100% - 24px); overflow-y: auto; margin-top: 12px; }
.layer-head { display: grid; grid-template-columns: minmax(84px, 1fr) minmax(0, 2fr) minmax(84px, 1fr); align-items: center; margin: -6px 0 8px; }
.layer-head .panel-back { grid-column: 1; justify-self: start; }
.layer-head h2 { grid-column: 2; margin: 0; text-align: center; font-size: 1.25rem; letter-spacing: .2em; color: var(--seal); }
html.layer-open { overflow: hidden; }


/* 紀錄頁 */
.hist-filter button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.hist-filter svg, .hist-fav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.hist-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: stretch; }
.hist-row .hist { grid-template-columns: minmax(0, 1fr); }
.hist-fav { display: inline-grid; place-items: center; width: 48px; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 0, 0, .25);
  color: var(--muted); cursor: pointer; }
.hist-fav[aria-pressed="true"] { color: var(--accent); border-color: rgba(211, 180, 120, .5); }
.hist-fav[aria-pressed="true"] svg { fill: currentColor; }
.hist-fav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hist-empty { padding: 12px 4px; }
.hist-tools { margin-top: 18px; }
.hist-tools h2 { margin-top: 0; font-size: 1.25rem; }
.hist-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.hist-actions .btn { cursor: pointer; }

/* 設定頁 */
.set-list { display: flex; flex-direction: column; gap: 22px; }
.set-row > span, .set-size-head > span { color: var(--accent); }
.set-row p { margin: 0; color: var(--text); }
/* 介面大小（B16，照翻譯產品）：標題列右邊是還原，下面是小 A─拉桿─大 A；拉桿用 px，拖動時不跟著字長大、不在手指下移動 */
.set-size-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.size-reset { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; font: inherit; font-size: 1rem; color: var(--accent);
  background: transparent; border: 1px solid rgba(211, 180, 120, .45); border-radius: 999px; cursor: pointer; }
.size-reset svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.size-reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.size-bar { display: flex; align-items: center; gap: 12px; }
.size-a { flex: none; width: 24px; text-align: center; font-family: var(--num-font); font-size: 16px; line-height: 1; color: var(--text); }
.size-a-large { font-size: 28px; }
#ui-size { flex: 1 1 auto; min-width: 0; -webkit-appearance: none; appearance: none; min-height: 44px; margin: 0; padding: 0; border: 0; background: transparent;
  accent-color: var(--accent); cursor: pointer; touch-action: none; }
#ui-size::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--seal-deep), var(--accent)); }
#ui-size::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--seal-deep), var(--accent)); }
#ui-size::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -13px; border-radius: 50%; background: var(--accent);
  border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--accent), 0 0 10px rgba(211, 180, 120, .45); }
#ui-size::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); }
#ui-size:focus { outline: none; }
#ui-size:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 999px; }
.set-row .btn { align-self: flex-start; }
.set-row .btn svg { transform: rotate(-90deg); }

/* 占卜：即將推出 */
.soon h2 { margin-top: 0; }
.soon .cta { margin-top: 14px; }

/* the 算號 tab row repeated under the page (owner 11-21); same look as the top row, line above instead of below */
.subtabs-bottom.subtabs { margin: 28px 0 8px; border-bottom: 0; border-top: 1px solid var(--line); }
.subtabs-bottom.subtabs button { border-bottom: 0; border-top: 2px solid transparent; margin: -1px 0 0; }
.subtabs-bottom.subtabs button[aria-selected="true"] { border-top-color: var(--accent); }

/* help "?" (js/infotip.js): a 26px ring after a label; ::before widens the finger target to 44px without moving the text */
.infotip { position: relative; display: inline-flex; vertical-align: middle; margin-left: .35em; font-size: 1rem; letter-spacing: 0; font-weight: 400; }
.infotip-btn { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: help;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: transparent; color: var(--accent);
  font: 700 0.9375rem/1 var(--num-font, inherit); position: relative; }
.infotip-btn::before { content: ''; position: absolute; inset: -9px; }
.infotip-btn[aria-expanded="true"] { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.infotip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.infotip-pop { position: absolute; z-index: 30; top: calc(100% + 8px); left: -8px; transform: translateX(var(--tip-shift, 0px));
  width: max-content; max-width: min(340px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 10px;
  background: #1d1813; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
  color: var(--text); font-size: 1rem; line-height: 1.7; letter-spacing: .02em; text-align: left; white-space: normal; }
.infotip-pop[hidden] { display: none; }
.field-head { display: inline-flex; align-items: center; }
.adv-head { display: flex; align-items: center; gap: 4px; align-self: flex-start; }
