/* 2026-10-31 third design round, site-wide layer: brings every general page in line with the
   homepage (thin dark outlines, 10–12px radii, hard offset shadows, press feedback, no yolk
   scribble under headings). Loaded after header-v3.css on every general page. Independent quizzes
   never load it. Only frames, panels and primary buttons are restyled; tool and game logic,
   layouts inside the panels and every control stay as they were. */

/* ---------- One page width everywhere (same edges as 山姆蛋名牌工具) ----------
   Some tools and games set their own 1120–1200px containers or restyle the header; align them all
   to --v3-page from header-v3.css. 出遊分帳小幫手 keeps its centred phone-width app. */
body.se-site .se-header-v3 .lab-site-header-inner,body.se-site .lab-site-footer-inner,
body.se-site :is(.container,.wrap>main:not(.sb-page),main.shell,main.barcode-tool,#price-label-app,.office-app,.lab-item-toolbar,main.kol-tool>.content,main.draw-tool,main.tp-app){width:var(--v3-page)!important;max-width:1400px!important;margin-left:auto!important;margin-right:auto!important}
body.se-site main.shell{padding-left:0!important;padding-right:0!important}

/* Keep the two-line brand (name over SAMEGG LAB) even where a tool restyles the brand block */
body.se-site .se-header-v3 .samegg-brand-copy{display:flex!important;flex-direction:column!important;gap:3px!important;align-items:flex-start!important}

/* ---------- Headings: same quiet titles as the homepage ---------- */
body.se-site .se-underlined::after{display:none}
body.se-site :is(.se-directory-hero,.lab-content-page) h1{font-weight:700;letter-spacing:-.03em}

/* ---------- Item-page toolbar (← category / name · 收藏) ---------- */
body.se-site .lab-item-toolbar{padding-top:16px;padding-bottom:4px}
body.se-site .lab-item-back a{font-weight:700;color:var(--se-link)}
body.se-site .lab-page-actions>a[href="/?view=favorites"]{display:none} /* 我的收藏 now lives in the header */
body.se-site .lab-item-toolbar .lab-favorite{min-height:44px;padding:0 14px;border:1.5px solid var(--v3-line);border-radius:10px;background:var(--se-surface);color:var(--se-ink);box-shadow:3px 3px 0 var(--v3-shadow);transition:transform .18s ease,box-shadow .18s ease}
body.se-site .lab-item-toolbar .lab-favorite[aria-pressed=true]{background:var(--se-mint);color:var(--se-link)}
body.se-site .lab-item-back>a,body.se-site .lab-item-toolbar .lab-page-actions{flex-shrink:0}
body.se-site :is(.directory-card,.lab-quick-link,.lab-item-back>a,.lab-favorite,.lab-related-head>a,.se-footer-links>a):focus-visible{outline:3px solid var(--se-focus);outline-offset:4px}

/* Shared navigation outside the header keeps a comfortable touch target and readable labels. */
body.se-site .lab-site-footer .se-footer-links>a{display:inline-flex;align-items:center;gap:8px;min-height:44px;line-height:1.5;text-underline-offset:4px}
body.se-site .lab-site-footer .se-footer-links>a>svg{flex:none}
body.se-site .directory-card :is(h2,h3){line-height:1.45;overflow-wrap:anywhere}
body.se-site .directory-main #lab-recent-list{min-width:0;max-width:100%}

/* ---------- Directory pages (實用工具・小遊戲・測驗) ---------- */
body.se-site .se-directory-hero{position:relative;isolation:isolate;padding:clamp(28px,4vw,48px) clamp(24px,4.5vw,56px);border:1.5px solid var(--v3-line);border-radius:16px;background-color:var(--v3-paper);background-image:linear-gradient(var(--v3-grid) 1px,transparent 1px),linear-gradient(90deg,var(--v3-grid) 1px,transparent 1px);background-size:36px 36px;margin-bottom:40px}
body.se-site .se-directory-hero h1{font-size:clamp(38px,4.6vw,60px);line-height:1.1;margin:10px 0 16px}
body.se-site .se-directory-hero .se-breadcrumb a{font-weight:700;color:var(--se-link)}
body.se-site .se-directory-hero p{color:var(--se-muted)}
body.se-site .directory-card{padding:0;overflow:hidden;border:1.5px solid var(--v3-line);border-radius:12px;background:var(--se-surface);box-shadow:4px 4px 0 var(--v3-shadow);transition:transform .18s ease,box-shadow .18s ease}
body.se-site .directory-card:hover{border-color:var(--v3-line)}
body.se-site .directory-card>img,body.se-site .directory-card .lab-directory-preview{display:block;width:100%;height:auto;aspect-ratio:16/9;object-fit:cover;margin:0;border-radius:0;border-bottom:1.5px solid var(--v3-line)}
body.se-site .directory-card>:not(img){margin-left:16px;margin-right:16px}
body.se-site .directory-card>.tag{display:none} /* status labels are hidden on the homepage too */
body.se-site .directory-card>h2{margin-top:14px;font-weight:700}
body.se-site .directory-card>:last-child{margin-bottom:16px}
body.se-site .directory-card .directory-action{font-weight:700;color:var(--se-link)}

/* 最近使用 as a strip, like the homepage */
body.se-site .directory-main .lab-personal{margin:0 0 40px}
body.se-site .directory-main .lab-personal-panel{display:flex;flex-wrap:wrap;align-items:center;gap:10px 12px;padding:0;border:0;border-radius:0;background:transparent}
body.se-site .directory-main .lab-personal-head{display:contents}
body.se-site .directory-main .lab-personal-head h2{display:flex;align-items:center;gap:8px;margin:0;padding-right:6px;font:700 16px/1.4 var(--se-font);color:var(--se-ink)}
body.se-site .directory-main .lab-personal-head h2::before{content:'';width:10px;height:10px;border-radius:50%;background:var(--v3-yolk);box-shadow:0 0 0 4px var(--se-mint)}
body.se-site .directory-main #lab-recent-list{display:flex;flex-wrap:wrap;gap:10px}
body.se-site .directory-main .lab-quick-link{display:inline-flex;align-items:center;min-height:44px;padding:0 14px;border-radius:10px;border:1.5px solid var(--se-border);background:var(--se-surface);color:var(--se-ink);font:500 14px/1.4 var(--se-font);text-decoration:none}
body.se-site .directory-main .lab-quick-link:hover{border-color:var(--v3-line)}
body.se-site .directory-main [data-lab-clear-recent]{order:2;min-height:44px;padding:0 6px;border:0;background:transparent;color:var(--se-muted);font:500 13px/1.4 var(--se-font);text-decoration:underline;text-underline-offset:3px}

/* ---------- Main panels of tools, games and content pages ---------- */
body.se-site main :is(.tool-panel,.pos-app,.morse-panel,.morse-player,.morse-tap,.morse-exam,.morse-chart,.timeline-map-panel,.timeline-export,.calculator,.se-calculator-help,.converter,.meal-card,#meal-result,.igdl-browser-card,.igdl-widget,.rt-config,.ig-way,.ig-help,.bc-panel,.bc-sheet-preview-panel,#stage,.setup-sidebar,#editArea,#previewArea,#sizeArea,#promptForm,aside.preview,.sb-card,.sb-suggest,#tp-create-form,.volley-panel,#volley-room-panel,.ttt-panel,#ttt-play-area,.space-ranking,.battle-solo-panel,.battle-lobby,.battle-settings,.battle-help,.hello-form,.hello-entry,#se-studio,.ws-panel,.ty-panel,.ty-record,.ws-record,.ws-daily),
body.se-site[data-se-page=kol-compare] main :is(.panel,#budget-panel),
body.se-site[data-se-page=nameplate] main :is(section.panel,.preview-panel){border:1.5px solid var(--v3-line)!important;border-radius:12px!important;box-shadow:4px 4px 0 var(--v3-shadow)!important}

/* ---------- Primary actions: outlined, with a hard shadow that presses in ---------- */
body.se-site main :is(.btn-primary,.btn.primary,.igdl-download,.sb-button.sb-primary,#barcode-png,#barcode-sheet-print,#refresh,#ig-compare,#add-creator,#go-compare,#prepare-roster,#addBulk,#startBtn,#importAppend,#png,#countText,#tp-create,#copy,#morse-play,#meal-draw,#meal-custom-use,#battle-play,#battle-create,#block-rank-submit,#volley-online,#volley-create,#volley-ready,#startGame,#rankSubmit,#ttt-next,#hello-submit,#game-fullscreen,#ws-start,#ws-check,#ws-next,#ws-edit-save,#ws-r-weak,#ty-again,#ty-submit-btn,#ws-daily-start){border:1.5px solid var(--v3-line)!important;border-radius:10px!important;box-shadow:3px 3px 0 var(--v3-shadow)!important;transition:transform .18s ease,box-shadow .18s ease}

/* Hover lifts; pressing pushes into the shadow */
@media(hover:hover){
 body.se-site :is(.directory-card,.lab-item-toolbar .lab-favorite):hover{transform:translate(-2px,-2px);box-shadow:6px 6px 0 var(--v3-shadow)}
 body.se-site main :is(.btn-primary,.btn.primary,.igdl-download,.sb-button.sb-primary,#barcode-png,#barcode-sheet-print,#refresh,#ig-compare,#add-creator,#go-compare,#prepare-roster,#addBulk,#startBtn,#importAppend,#png,#countText,#tp-create,#copy,#morse-play,#meal-draw,#meal-custom-use,#battle-play,#battle-create,#block-rank-submit,#volley-online,#volley-create,#volley-ready,#startGame,#rankSubmit,#ttt-next,#hello-submit,#game-fullscreen,#ws-start,#ws-check,#ws-next,#ws-edit-save,#ws-r-weak,#ty-again,#ty-submit-btn,#ws-daily-start):not(:disabled):hover{transform:translate(-1px,-1px);box-shadow:4px 4px 0 var(--v3-shadow)!important}
}
body.se-site :is(.directory-card,.lab-item-toolbar .lab-favorite):active{transform:translate(3px,3px);box-shadow:0 0 0 transparent}
body.se-site main :is(.btn-primary,.btn.primary,.igdl-download,.sb-button.sb-primary,#barcode-png,#barcode-sheet-print,#refresh,#ig-compare,#add-creator,#go-compare,#prepare-roster,#addBulk,#startBtn,#importAppend,#png,#countText,#tp-create,#copy,#morse-play,#meal-draw,#meal-custom-use,#battle-play,#battle-create,#block-rank-submit,#volley-online,#volley-create,#volley-ready,#startGame,#rankSubmit,#ttt-next,#hello-submit,#game-fullscreen,#ws-start,#ws-check,#ws-next,#ws-edit-save,#ws-r-weak,#ty-again,#ty-submit-btn,#ws-daily-start):not(:disabled):active{transform:translate(3px,3px);box-shadow:0 0 0 transparent!important}

@media(max-width:767px){
 body.se-site .se-directory-hero{padding:24px 20px;margin-bottom:28px}
 body.se-site .se-directory-hero h1{font-size:34px}
}
@media(prefers-reduced-motion:reduce){
 body.se-site :is(.directory-card,.lab-item-toolbar .lab-favorite){transition:none}
 body.se-site :is(.directory-card,.lab-item-toolbar .lab-favorite):is(:hover,:active){transform:none}
}

/* Related experiments at the end of tool and game pages. */
body.se-site .lab-related{width:var(--v3-page);max-width:1400px;margin:56px auto 64px}
body.se-site .lab-related-head{display:flex;align-items:baseline;justify-content:space-between;gap:16px;flex-wrap:wrap}
body.se-site .lab-related-head h2{margin:0;font-size:24px;line-height:1.4;font-weight:800;color:var(--se-ink)}
body.se-site .lab-related-head a{font-size:15px;font-weight:700;color:var(--se-link)}
body.se-site .lab-related .directory-grid{margin-top:18px}
body.se-site .lab-related .directory-card>h3{margin-top:14px;margin-bottom:8px;font-size:18px;line-height:1.45;font-weight:700;color:var(--se-ink)}
body.se-site .lab-related .directory-card p{font-size:15px;line-height:1.7;color:var(--se-muted);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
@media(max-width:900px){body.se-site .lab-related .directory-grid{grid-template-columns:repeat(2,minmax(0,1fr))}body.se-site .lab-related .directory-card:nth-child(3){display:none}}
@media(max-width:600px){body.se-site .lab-related{margin:40px auto 48px}body.se-site .lab-related .directory-grid{grid-template-columns:1fr}body.se-site .lab-related .directory-card:nth-child(3){display:flex}}

/* Tool output alone belongs on paper; shared navigation and recommendations stay on screen. */
@media print{body.se-site :is(.lab-site-header,.lab-item-toolbar,.lab-related,.lab-site-footer,#lab-toast){display:none!important}}

body.lab-shell.se-site .timeline-workspace{width:var(--v3-page);max-width:1400px}
/* Tool FAQ (2026-11-22 SEO check): a short 常見問題 list under the tool, in the page's outlined-panel language. */
body.se-site .lab-faq{max-width:880px;margin:48px 0 0;padding:0}
body.se-site .lab-faq h2{margin:0 0 14px;font-size:clamp(20px,2.4vw,24px)}
body.se-site .lab-faq details{border:1.5px solid var(--v3-line);border-radius:12px;background:var(--se-surface);margin:0 0 10px;padding:0}
body.se-site .lab-faq summary{cursor:pointer;list-style:none;padding:14px 44px 14px 18px;font-weight:700;position:relative;color:var(--se-ink)}
body.se-site .lab-faq summary::-webkit-details-marker{display:none}
body.se-site .lab-faq summary::after{content:"+";position:absolute;right:18px;top:50%;transform:translateY(-50%);font-size:20px;line-height:1;color:var(--se-muted)}
body.se-site .lab-faq details[open] summary::after{content:"−"}
body.se-site .lab-faq summary:focus-visible{outline:3px solid var(--se-focus);outline-offset:2px;border-radius:10px}
body.se-site .lab-faq details p{margin:0;padding:0 18px 16px;color:var(--se-muted);line-height:1.75}
