/* =============================================================
   /tools/open-source-games  开源游戏大全
   设计令牌放在 :root —— 详情抽屉 / 对比弹窗 / toast 都挂在 body 下，
   挂在 .osg 上的变量在这些浮层里会解析失败（本站常见坑）。
   ============================================================= */
:root {
    color-scheme: dark;
    --osg-bg: #0f1419;
    --osg-card: #161b22;
    --osg-card-2: #1c232c;
    --osg-card-3: #212a35;
    --osg-line: rgba(127, 127, 127, .22);
    --osg-line-2: rgba(127, 127, 127, .38);
    --osg-fg: #e6edf3;
    --osg-sub: #a2acb8;
    --osg-faint: #7f8b98;
    --osg-accent: #58a6ff;
    --osg-accent-2: #a371f7;
    --osg-accent-soft: rgba(88, 166, 255, .13);
    --osg-on-accent: #08111b;
    --osg-ok: #3fb950;
    --osg-ok-soft: rgba(63, 185, 80, .13);
    --osg-warn: #d29922;
    --osg-warn-soft: rgba(210, 153, 34, .14);
    --osg-gold: #e3b341;
    --osg-danger: #f85149;
    --osg-shadow: 0 10px 34px rgba(0, 0, 0, .30);
    --osg-shadow-sm: 0 3px 14px rgba(0, 0, 0, .18);
    --osg-zebra: rgba(127, 127, 127, .055);
    --osg-r-lg: 16px;
    --osg-r-md: 11px;
    --osg-r-sm: 8px;
    --osg-side-w: 292px;
}
[data-theme="light"] {
    color-scheme: light;
    --osg-bg: #f7f9f9;
    --osg-card: #ffffff;
    --osg-card-2: #f0f3f5;
    --osg-card-3: #e8edf1;
    --osg-line: rgba(15, 20, 25, .12);
    --osg-line-2: rgba(15, 20, 25, .24);
    --osg-fg: #0f1419;
    --osg-sub: #53616e;
    --osg-faint: #6d7887;
    --osg-accent: #0969da;
    --osg-accent-2: #8250df;
    --osg-accent-soft: rgba(9, 105, 218, .09);
    --osg-on-accent: #ffffff;
    --osg-ok: #1a7f37;
    --osg-ok-soft: rgba(26, 127, 55, .10);
    --osg-warn: #9a6700;
    --osg-warn-soft: rgba(154, 103, 0, .10);
    --osg-gold: #9a6700;
    --osg-danger: #cf222e;
    --osg-shadow: 0 10px 28px rgba(15, 20, 25, .11);
    --osg-shadow-sm: 0 3px 12px rgba(15, 20, 25, .08);
    --osg-zebra: rgba(15, 20, 25, .038);
}

/* 电脑端满屏（保留左侧导航）；overflow:visible 把滚动权交还 html，
   否则站点 body{overflow-y:scroll} 会让页内 sticky 全部失效。 */
body.page-osg-full .app { max-width: 100%; }
body.page-osg-full .main-content { max-width: 100%; width: 100%; border-right: 0; }
body.page-osg-full .page-container { max-width: 100%; }
body.page-osg-full { overflow: visible; }

.osg { max-width: 100%; margin: 0; padding: 18px 22px 72px; box-sizing: border-box; color: var(--osg-fg); font-size: 14px; }
.osg *, .osg *::before, .osg *::after { box-sizing: border-box; }
.osg [hidden], .osg-mask[hidden], .osg-cmp-mask[hidden], .osg-toast[hidden] { display: none !important; }
/* 只继承字体族：font:inherit 简写会把 font-size 一并重置，
   且 .osg input 特异性高于 .osg-q，会让手机端 16px 规则失效（iOS 聚焦放大页面）。 */
.osg button, .osg select, .osg input, .osg textarea { font-family: inherit; }
.osg button { cursor: pointer; }
.osg a { color: var(--osg-accent); text-decoration: none; }
.osg a:hover { text-decoration: underline; }
.osg :focus-visible { outline: 2px solid var(--osg-accent); outline-offset: 2px; }
.osg ::selection { background: var(--osg-accent-soft); }

/* ---------------- hero ---------------- */
.osg-hero { position: relative; background: var(--osg-card); background: linear-gradient(135deg, var(--osg-accent-soft), var(--osg-card) 42%); border: 1px solid var(--osg-line); border-radius: var(--osg-r-lg); box-shadow: var(--osg-shadow-sm); padding: 20px 22px 18px; margin-bottom: 16px; }
.osg-hero-top { display: flex; gap: 16px; align-items: flex-start; }
.osg-hero-ic { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 27px; background: var(--osg-accent-soft); border: 1px solid var(--osg-line); }
.osg-hero-t { flex: 1 1 auto; min-width: 0; }
.osg-title { margin: 2px 0 6px; font-size: 25px; line-height: 1.25; font-weight: 750; letter-spacing: .3px; }
.osg-sub { margin: 0; color: var(--osg-sub); font-size: 13.5px; line-height: 1.72; max-width: 92ch; }
.osg-hero-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.osg-htag { font-size: 11.5px; color: var(--osg-sub); background: var(--osg-card-2); border: 1px solid var(--osg-line); padding: 3px 9px; border-radius: 999px; }
.osg-fold-btn { flex: 0 0 auto; width: 30px; height: 30px; border: 0; background: transparent; color: var(--osg-sub); border-radius: var(--osg-r-sm); display: grid; place-items: center; }
.osg-fold-btn:hover { background: var(--osg-card-2); color: var(--osg-fg); }
.osg-fold-btn svg { transition: transform .18s ease; }
.osg-hero.is-collapsed .osg-fold-btn svg { transform: rotate(180deg); }
.osg-hero.is-collapsed .osg-hero-extra { display: none; }
.osg-hero.is-collapsed .osg-sub, .osg-hero.is-collapsed .osg-hero-tags { display: none; }
.osg-hero.is-collapsed .osg-title { margin: 0; font-size: 20px; }
.osg-hero.is-collapsed { padding: 12px 18px; }
.osg-hero-extra { margin-top: 16px; }
.osg-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; border: 1px solid var(--osg-line); border-radius: var(--osg-r-md); overflow: hidden; background: var(--osg-card); }
.osg-stat { padding: 10px 12px; border-left: 1px solid var(--osg-line); min-width: 0; }
.osg-stat:first-child { border-left: 0; }
.osg-stat b { display: block; font-size: 19px; font-weight: 750; line-height: 1.2; font-variant-numeric: tabular-nums; }
.osg-stat:nth-child(1) b { color: var(--osg-accent); }
.osg-stat:nth-child(2) b { color: var(--osg-ok); }
.osg-stat:nth-child(3) b { color: var(--osg-accent-2); }
.osg-stat:nth-child(4) b { color: var(--osg-gold); }
.osg-stat:nth-child(5) b { color: var(--osg-warn); }
.osg-stat em { display: block; font-style: normal; font-size: 11.5px; color: var(--osg-faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osg-source-note { margin: 10px 2px 0; font-size: 12px; color: var(--osg-faint); line-height: 1.6; }

/* ---------------- work ---------------- */
.osg-work { display: grid; grid-template-columns: var(--osg-side-w) minmax(0, 1fr); gap: 16px; align-items: start; }
.osg-side { position: sticky; top: 12px; align-self: start; max-height: calc(100dvh - 24px); display: flex; flex-direction: column; background: var(--osg-card); border: 1px solid var(--osg-line); border-radius: var(--osg-r-lg); box-shadow: var(--osg-shadow-sm); overflow: hidden; }
.osg-side-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--osg-line); }
.osg-side-title { font-weight: 700; font-size: 13.5px; }
.osg-link-btn { border: 0; background: transparent; color: var(--osg-accent); font-size: 12px; padding: 3px 4px; }
.osg-link-btn:hover { text-decoration: underline; }
.osg-side-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 14px; scrollbar-width: thin; }
.osg-fsec { border-bottom: 1px dashed var(--osg-line); padding: 8px 0 11px; }
.osg-fsec:last-child { border-bottom: 0; }
.osg-fsec-t { margin: 0; font-size: 12.5px; }
.osg-fsec-fold { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: transparent; color: var(--osg-sub); font-weight: 700; font-size: 12.5px; padding: 5px 2px; }
.osg-fsec-fold:hover { color: var(--osg-fg); }
.osg-fsec-fold i { width: 8px; height: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); transition: transform .18s ease; }
.osg-fsec-fold[aria-expanded="false"] i { transform: rotate(-45deg); }
.osg-fsec-body { padding-top: 5px; }
.osg-fsec.is-collapsed .osg-fsec-body { display: none; }

.osg-seg { display: flex; gap: 3px; background: var(--osg-card-2); border: 1px solid var(--osg-line); border-radius: var(--osg-r-sm); padding: 3px; }
.osg-seg button { flex: 1 1 0; min-width: 0; border: 0; background: transparent; color: var(--osg-sub); font-size: 12px; padding: 6px 2px; border-radius: 6px; white-space: nowrap; }
.osg-seg button.is-on { background: var(--osg-card); color: var(--osg-accent); font-weight: 700; box-shadow: var(--osg-shadow-sm); }
.osg-cats { display: flex; flex-direction: column; gap: 2px; }
.osg-cat { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; color: var(--osg-fg); text-align: left; padding: 6px 8px; border-radius: var(--osg-r-sm); font-size: 12.5px; }
.osg-cat:hover { background: var(--osg-card-2); }
.osg-cat.is-on { background: var(--osg-accent-soft); color: var(--osg-accent); font-weight: 700; }
.osg-cat-ic { width: 18px; text-align: center; font-size: 13px; }
.osg-cat-n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osg-cat small { flex: 0 0 auto; color: var(--osg-faint); font-variant-numeric: tabular-nums; font-size: 11px; }
.osg-field { display: block; margin-bottom: 8px; }
.osg-field > span { display: block; font-size: 11.5px; color: var(--osg-faint); margin-bottom: 4px; }
.osg-select, .osg-input { width: 100%; height: 34px; padding: 0 9px; color: var(--osg-fg); background: var(--osg-card-2); border: 1px solid var(--osg-line); border-radius: var(--osg-r-sm); font-size: 12.5px; }
.osg-select:focus, .osg-input:focus { border-color: var(--osg-accent); }
.osg-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.osg-chip { border: 1px solid var(--osg-line); background: var(--osg-card-2); color: var(--osg-sub); border-radius: 999px; padding: 4px 9px; font-size: 11.5px; line-height: 1.3; }
.osg-chip:hover { border-color: var(--osg-accent); color: var(--osg-fg); }
.osg-chip.is-on { background: var(--osg-accent-soft); border-color: var(--osg-accent); color: var(--osg-accent); font-weight: 700; }
.osg-chip i { font-style: normal; opacity: .7; margin-left: 3px; font-size: 10.5px; }
.osg-switch { display: flex; align-items: center; gap: 8px; padding: 5px 2px; font-size: 12.5px; color: var(--osg-sub); cursor: pointer; }
.osg-switch input { width: 16px; height: 16px; accent-color: var(--osg-accent); flex: 0 0 auto; }
.osg-switch:hover { color: var(--osg-fg); }

/* ---------------- main / toolbar ---------------- */
.osg-main { min-width: 0; }
.osg-toolbar { position: sticky; top: 8px; z-index: 30; background: var(--osg-card); border: 1px solid var(--osg-line); border-radius: var(--osg-r-lg); box-shadow: var(--osg-shadow-sm); padding: 10px 12px; margin-bottom: 12px; }
.osg-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.osg-bar-sub { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--osg-line); }
.osg-search { position: relative; flex: 1 1 260px; min-width: 180px; display: flex; align-items: center; }
.osg-search-ic { position: absolute; left: 11px; color: var(--osg-faint); pointer-events: none; }
.osg-q { width: 100%; height: 38px; padding: 0 34px 0 34px; background: var(--osg-card-2); color: var(--osg-fg); border: 1px solid var(--osg-line); border-radius: 999px; font-size: 13.5px; }
.osg-q:focus { border-color: var(--osg-accent); box-shadow: 0 0 0 3px var(--osg-accent-soft); outline: none; }
.osg-q::-webkit-search-cancel-button { display: none; }
.osg-q-clear { position: absolute; right: 7px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--osg-card-3); color: var(--osg-sub); font-size: 17px; line-height: 1; }
.osg-btn { flex: 0 0 auto; min-height: 38px; padding: 0 12px; border: 1px solid var(--osg-line-2); border-radius: var(--osg-r-sm); background: var(--osg-card-2); color: var(--osg-fg); font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.osg-btn:hover { border-color: var(--osg-accent); color: var(--osg-accent); }
.osg-btn-pri { background: var(--osg-accent); border-color: var(--osg-accent); color: var(--osg-on-accent); font-weight: 700; }
.osg-btn-pri:hover { color: var(--osg-on-accent); filter: brightness(1.08); }
.osg-btn-sm { min-height: 30px; padding: 0 9px; font-size: 12px; }
.osg-btn b { font-variant-numeric: tabular-nums; color: var(--osg-accent); }
.osg-sort { width: 158px; height: 38px; flex: 0 0 auto; }
.osg-per { width: 112px; height: 30px; flex: 0 0 auto; font-size: 12px; }
.osg-side-btn { display: none; }
.osg-viewseg { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--osg-line); border-radius: var(--osg-r-sm); overflow: hidden; background: var(--osg-card-2); }
.osg-viewseg button { min-height: 36px; padding: 0 10px; border: 0; background: transparent; color: var(--osg-sub); font-size: 12px; }
.osg-viewseg button + button { border-left: 1px solid var(--osg-line); }
.osg-viewseg button.is-on { background: var(--osg-accent-soft); color: var(--osg-accent); font-weight: 700; }
.osg-export { position: relative; flex: 0 0 auto; }
.osg-export > summary { list-style: none; }
.osg-export > summary::-webkit-details-marker { display: none; }
.osg-export-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 45; min-width: 210px; background: var(--osg-card); border: 1px solid var(--osg-line-2); border-radius: var(--osg-r-md); box-shadow: var(--osg-shadow); padding: 6px; }
.osg-export-menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--osg-fg); font-size: 12.5px; padding: 8px 10px; border-radius: 6px; }
.osg-export-menu button:hover { background: var(--osg-accent-soft); color: var(--osg-accent); }
.osg-count { flex: 0 0 auto; font-size: 12.5px; color: var(--osg-sub); font-variant-numeric: tabular-nums; }
.osg-count b { color: var(--osg-accent); font-size: 14px; }
.osg-active { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.osg-active-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--osg-accent-soft); color: var(--osg-accent); border: 1px solid var(--osg-line); border-radius: 999px; padding: 2px 8px; font-size: 11.5px; }
.osg-active-chip button { border: 0; background: transparent; color: inherit; font-size: 13px; padding: 0 1px; line-height: 1; }

/* ---------------- distribution ---------------- */
.osg-dist { background: var(--osg-card); border: 1px solid var(--osg-line); border-radius: var(--osg-r-lg); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--osg-shadow-sm); }
.osg-dist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.osg-dist-col h3 { margin: 0 0 9px; font-size: 12.5px; color: var(--osg-sub); }
.osg-bar-row2 { display: grid; grid-template-columns: minmax(74px, 118px) minmax(0, 1fr) 34px; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 11.5px; }
.osg-bar-lb { color: var(--osg-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osg-bar-track { height: 9px; border-radius: 999px; background: var(--osg-card-3); overflow: hidden; }
.osg-bar-fill { height: 100%; border-radius: 999px; background: var(--osg-accent); min-width: 3px; }
.osg-bar-row2:nth-child(3n+2) .osg-bar-fill { background: var(--osg-accent-2); }
.osg-bar-row2:nth-child(3n+3) .osg-bar-fill { background: var(--osg-ok); }
.osg-bar-n { text-align: right; color: var(--osg-faint); font-variant-numeric: tabular-nums; }
.osg-dist-note { margin: 12px 0 0; font-size: 11.5px; color: var(--osg-faint); line-height: 1.6; }

/* ---------------- list ---------------- */
.osg-loading { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 46px 12px; color: var(--osg-faint); font-size: 13px; }
.osg-spin { width: 16px; height: 16px; border: 2px solid var(--osg-line-2); border-top-color: var(--osg-accent); border-radius: 50%; animation: osg-spin .8s linear infinite; }
@keyframes osg-spin { to { transform: rotate(360deg); } }
.osg-list { display: grid; gap: 12px; }
.osg-list--grid { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.osg-list--compact { grid-template-columns: minmax(0, 1fr); gap: 7px; }
.osg-list--table { display: block; }
.osg-card { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--osg-card); border: 1px solid var(--osg-line); border-radius: var(--osg-r-lg); padding: 13px 14px 11px; box-shadow: var(--osg-shadow-sm); transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.osg-card:hover { border-color: var(--osg-accent); transform: translateY(-1px); box-shadow: var(--osg-shadow); }
.osg-card.is-fav { border-left: 3px solid var(--osg-gold); }
.osg-card.is-cmp { border-color: var(--osg-accent); background: var(--osg-accent-soft); }
.osg-card-top { display: flex; align-items: flex-start; gap: 8px; }
.osg-card-ic { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--osg-accent-soft); font-size: 17px; }
.osg-card-name { flex: 1 1 auto; min-width: 0; }
.osg-card-name h3 { margin: 0; font-size: 14.5px; line-height: 1.35; font-weight: 700; overflow-wrap: anywhere; }
.osg-card-name-btn { display: inline; margin: 0; padding: 0; border: 0; background: transparent; color: var(--osg-fg); font-family: inherit; font-size: inherit; font-weight: 700; text-align: left; overflow-wrap: anywhere; }
.osg-card-name-btn:hover { color: var(--osg-accent); }
.osg-card-name mark, .osg-card-cn mark { background: var(--osg-warn-soft); color: var(--osg-fg); border-radius: 2px; }
.osg-card-cn { display: block; font-size: 11.5px; color: var(--osg-faint); margin-top: 2px; overflow-wrap: anywhere; }
.osg-card-acts { flex: 0 0 auto; display: flex; align-items: center; gap: 3px; }
.osg-star, .osg-cmp-add { width: 28px; height: 28px; border: 1px solid var(--osg-line); background: var(--osg-card-2); color: var(--osg-faint); border-radius: 7px; display: grid; place-items: center; font-size: 14px; line-height: 1; }
.osg-star:hover { color: var(--osg-gold); border-color: var(--osg-gold); }
.osg-star.is-on { color: var(--osg-gold); background: var(--osg-warn-soft); border-color: var(--osg-gold); }
.osg-cmp-add { font-size: 12px; }
.osg-cmp-add.is-on { color: var(--osg-accent); border-color: var(--osg-accent); background: var(--osg-accent-soft); font-weight: 700; }
.osg-card-meta { display: flex; flex-wrap: wrap; gap: 4px; margin: 9px 0 8px; }
.osg-meta { font-size: 10.5px; color: var(--osg-sub); background: var(--osg-card-2); border: 1px solid var(--osg-line); border-radius: 5px; padding: 2px 6px; }
.osg-meta--cat { color: var(--osg-accent); border-color: var(--osg-accent); background: var(--osg-accent-soft); }
.osg-meta--host { color: var(--osg-ok); }
.osg-card-desc { margin: 0 0 9px; font-size: 12px; line-height: 1.62; color: var(--osg-sub); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.2em; overflow-wrap: anywhere; }
.osg-card-desc.is-none { color: var(--osg-faint); font-style: italic; }
.osg-card-desc mark { background: var(--osg-warn-soft); color: var(--osg-fg); border-radius: 2px; padding: 0 1px; }
.osg-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--osg-line); padding-top: 8px; }
.osg-card-tags { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.osg-tag { font-size: 10px; color: var(--osg-faint); border: 1px dashed var(--osg-line-2); border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
.osg-card-open { flex: 0 0 auto; border: 0; background: transparent; color: var(--osg-accent); font-size: 11.5px; padding: 3px 2px; }
.osg-card-open:hover { text-decoration: underline; }

/* compact view */
.osg-list--compact .osg-card { flex-direction: row; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--osg-r-md); }
.osg-list--compact .osg-card-ic { width: 30px; height: 30px; font-size: 15px; }
.osg-list--compact .osg-card-top { flex: 0 1 280px; min-width: 0; }
.osg-list--compact .osg-card-meta { margin: 0; flex: 0 1 210px; }
.osg-list--compact .osg-card-desc { flex: 1 1 auto; min-width: 0; margin: 0; -webkit-line-clamp: 1; min-height: 0; }
.osg-list--compact .osg-card-foot { margin: 0; border: 0; padding: 0; flex: 0 0 auto; }
.osg-list--compact .osg-card-tags, .osg-list--compact .osg-card-cn { display: none; }

/* table view */
.osg-table-wrap { overflow-x: auto; overscroll-behavior-x: contain; background: var(--osg-card); border: 1px solid var(--osg-line); border-radius: var(--osg-r-lg); scrollbar-width: thin; }
.osg-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 760px; }
.osg-table th, .osg-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--osg-line); border-right: 1px solid var(--osg-line); vertical-align: middle; }
.osg-table th { position: sticky; top: 0; z-index: 2; background: var(--osg-card-2); color: var(--osg-sub); font-weight: 700; white-space: nowrap; }
.osg-table th:first-child, .osg-table td:first-child { border-left: 0; }
.osg-table th:last-child, .osg-table td:last-child { border-right: 0; }
.osg-table tbody tr:nth-child(even) { background: var(--osg-zebra); }
.osg-table tbody tr:hover { background: var(--osg-accent-soft); }
.osg-table .osg-t-name { font-weight: 650; color: var(--osg-fg); }
.osg-table .osg-t-btn { border: 0; background: transparent; color: var(--osg-accent); padding: 2px 4px; font-size: 12px; text-align: left; }
.osg-table .osg-t-btn:hover { text-decoration: underline; }
.osg-table td.osg-t-desc { max-width: 340px; color: var(--osg-sub); }
.osg-table .osg-t-desc span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.osg-empty { text-align: center; padding: 46px 16px; background: var(--osg-card); border: 1px dashed var(--osg-line-2); border-radius: var(--osg-r-lg); }
.osg-empty-ic { font-size: 34px; opacity: .65; }
.osg-empty-t { margin: 10px 0 4px; font-size: 15px; font-weight: 700; }
.osg-empty-s { margin: 0 0 14px; color: var(--osg-faint); font-size: 12.5px; }
.osg-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; margin: 16px 0 22px; }
.osg-pg { min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid var(--osg-line); background: var(--osg-card); color: var(--osg-sub); border-radius: var(--osg-r-sm); font-size: 12.5px; }
.osg-pg:hover:not(:disabled) { border-color: var(--osg-accent); color: var(--osg-accent); }
.osg-pg.is-on { background: var(--osg-accent); border-color: var(--osg-accent); color: var(--osg-on-accent); font-weight: 700; }
.osg-pg:disabled { opacity: .45; cursor: not-allowed; }
.osg-pg-dots { color: var(--osg-faint); padding: 0 3px; }
.osg-pg-jump { display: inline-flex; align-items: center; gap: 5px; color: var(--osg-faint); font-size: 12px; }
.osg-pg-jump input { width: 52px; height: 32px; text-align: center; background: var(--osg-card-2); color: var(--osg-fg); border: 1px solid var(--osg-line); border-radius: 6px; font-size: 12.5px; }

/* ---------------- links / about ---------------- */
.osg-links { margin: 8px 0 16px; }
.osg-sec-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.osg-sec-note { margin: 0 0 10px; font-size: 12px; color: var(--osg-faint); }
.osg-links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(218px, 1fr)); gap: 8px; }
.osg-linkcard { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--osg-card); border: 1px solid var(--osg-line); border-radius: var(--osg-r-md); color: var(--osg-fg); font-size: 12.5px; min-width: 0; }
.osg-linkcard:hover { border-color: var(--osg-accent); text-decoration: none; }
.osg-linkcard span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osg-linkcard i { font-style: normal; color: var(--osg-faint); }
.osg-about { background: var(--osg-card); border: 1px solid var(--osg-line); border-radius: var(--osg-r-lg); overflow: hidden; }
.osg-about-t { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; cursor: pointer; font-weight: 700; font-size: 13.5px; }
.osg-about-t::-webkit-details-marker { display: none; }
.osg-about-t::marker { content: ''; }
.osg-about[open] .osg-about-t { border-bottom: 1px solid var(--osg-line); }
.osg-about-caret { font-style: normal; color: var(--osg-faint); transition: transform .18s ease; }
.osg-about[open] .osg-about-caret { transform: rotate(180deg); }
.osg-about-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 10px; padding: 12px 16px 16px; }
.osg-about-card { background: var(--osg-card-2); border: 1px solid var(--osg-line); border-radius: var(--osg-r-md); padding: 11px 13px; }
.osg-about-card h3 { margin: 0 0 6px; font-size: 12.5px; color: var(--osg-accent); }
.osg-about-card p { margin: 0; font-size: 12px; line-height: 1.75; color: var(--osg-sub); }
.osg-about-wide { grid-column: 1 / -1; }

/* ---------------- compare bar ---------------- */
.osg-cmpbar { position: sticky; bottom: 12px; z-index: 40; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--osg-card); border: 1px solid var(--osg-accent); border-radius: var(--osg-r-lg); box-shadow: var(--osg-shadow); padding: 9px 12px; margin-top: 14px; }
.osg-cmpbar-t { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--osg-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osg-cmpbar-t b { color: var(--osg-accent); }

/* ---------------- drawer / modal ---------------- */
.osg-mask, .osg-cmp-mask { position: fixed; inset: 0; z-index: 100000; background: rgba(0, 0, 0, .56); display: flex; }
.osg-mask { justify-content: flex-end; }
.osg-cmp-mask { align-items: center; justify-content: center; padding: 20px; }
.osg-drawer { width: min(540px, 100%); height: 100%; background: var(--osg-card); border-left: 1px solid var(--osg-line); display: flex; flex-direction: column; box-shadow: var(--osg-shadow); }
.osg-drawer-head { flex: 0 0 auto; display: flex; align-items: flex-start; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--osg-line); }
.osg-drawer-head-t { flex: 1 1 auto; min-width: 0; }
.osg-dk-kicker { display: block; font-size: 11.5px; color: var(--osg-accent); margin-bottom: 3px; }
.osg-drawer-head h2 { margin: 0; font-size: 19px; line-height: 1.35; overflow-wrap: anywhere; }
.osg-dk-close { flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid var(--osg-line); background: var(--osg-card-2); color: var(--osg-sub); border-radius: 8px; font-size: 20px; line-height: 1; }
.osg-dk-close:hover { color: var(--osg-fg); border-color: var(--osg-accent); }
.osg-drawer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px 24px; scrollbar-width: thin; }
.osg-drawer-foot { flex: 0 0 auto; display: flex; gap: 7px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--osg-line); background: var(--osg-card); }
.osg-drawer-foot .osg-btn { flex: 1 1 0; }
.osg-dk-sec { margin-bottom: 18px; }
.osg-dk-sec > h3 { margin: 0 0 8px; font-size: 12px; color: var(--osg-faint); font-weight: 700; letter-spacing: .4px; }
.osg-dk-desc { font-size: 13.5px; line-height: 1.8; color: var(--osg-fg); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--osg-card-2); border: 1px solid var(--osg-line); border-radius: var(--osg-r-md); padding: 11px 13px; margin: 0; }
.osg-dk-desc.is-none { color: var(--osg-faint); font-style: italic; }
.osg-dk-terms { margin-top: 8px; font-size: 11.5px; line-height: 1.7; color: var(--osg-faint); }
.osg-dk-kv { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 7px 10px; font-size: 12.5px; }
.osg-dk-kv dt { color: var(--osg-faint); }
.osg-dk-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.osg-dk-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.osg-dk-badge { font-size: 11px; border: 1px solid var(--osg-line); background: var(--osg-card-2); color: var(--osg-sub); padding: 2px 8px; border-radius: 999px; }
.osg-dk-links { display: flex; flex-direction: column; gap: 7px; }
.osg-dk-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--osg-line); background: var(--osg-card-2); border-radius: var(--osg-r-sm); min-width: 0; }
.osg-dk-link .osg-dk-lb { flex: 0 0 auto; font-size: 10.5px; color: var(--osg-faint); border: 1px solid var(--osg-line-2); border-radius: 4px; padding: 1px 5px; }
.osg-dk-link a { flex: 1 1 auto; min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.osg-dk-link button { flex: 0 0 auto; border: 0; background: transparent; color: var(--osg-faint); font-size: 11.5px; }
.osg-dk-link button:hover { color: var(--osg-accent); }
.osg-dk-note { width: 100%; min-height: 88px; resize: vertical; padding: 9px 11px; background: var(--osg-card-2); color: var(--osg-fg); border: 1px solid var(--osg-line); border-radius: var(--osg-r-sm); font-size: 13px; line-height: 1.6; }
.osg-dk-note:focus { border-color: var(--osg-accent); outline: none; }
.osg-dk-note-acts { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.osg-dk-note-acts span { font-size: 11.5px; color: var(--osg-faint); }
.osg-dk-none { font-size: 12px; color: var(--osg-faint); }
.osg-cmp { width: min(1000px, 100%); max-height: 88dvh; display: flex; flex-direction: column; background: var(--osg-card); border: 1px solid var(--osg-line); border-radius: var(--osg-r-lg); box-shadow: var(--osg-shadow); overflow: hidden; }
.osg-cmp-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--osg-line); }
.osg-cmp-head h2 { margin: 0; font-size: 16px; }
.osg-cmp-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 14px 16px 20px; }
.osg-cmp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 560px; }
.osg-cmp-table th, .osg-cmp-table td { padding: 9px 10px; border-bottom: 1px solid var(--osg-line); border-right: 1px solid var(--osg-line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.osg-cmp-table th:first-child { width: 112px; color: var(--osg-faint); font-weight: 600; background: var(--osg-card-2); position: sticky; left: 0; z-index: 1; }
.osg-cmp-table thead th { font-size: 13px; color: var(--osg-fg); background: var(--osg-card-2); position: sticky; top: 0; z-index: 2; }
.osg-cmp-table td:last-child, .osg-cmp-table th:last-child { border-right: 0; }
.osg-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 200000; max-width: min(90vw, 520px); padding: 10px 16px; border-radius: 999px; background: var(--osg-card-3); color: var(--osg-fg); border: 1px solid var(--osg-line-2); box-shadow: var(--osg-shadow); font-size: 12.5px; text-align: center; }
.osg-toast.is-err { border-color: var(--osg-danger); color: var(--osg-danger); }

/* ---------------- responsive ---------------- */
@media (min-width: 1600px) {
    .osg { padding: 22px 30px 80px; }
    .osg-list--grid { grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); }
    :root { --osg-side-w: 320px; }
}
@media (min-width: 1280px) and (max-width: 1599px) {
    .osg-list--grid { grid-template-columns: repeat(auto-fill, minmax(276px, 1fr)); }
}
@media (max-width: 1200px) {
    :root { --osg-side-w: 252px; }
    .osg { padding: 16px 16px 64px; }
    .osg-hero-tags .osg-htag:nth-child(n+4) { display: none; }
    .osg-list--grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 1024px) {
    .osg-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .osg-stat:nth-child(4) { border-left: 0; }
    .osg-stat:nth-child(n+4) { border-top: 1px solid var(--osg-line); }
    .osg-sort { width: 138px; }
    .osg-viewseg button { padding: 0 7px; }
}
@media (max-width: 900px) {
    .osg-work { display: block; }
    .osg-side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 100010; width: min(86vw, 330px); max-height: none; border-radius: 0; transform: translateX(-102%); transition: transform .22s ease; }
    .osg-main.is-side-open .osg-side, .osg.is-side-open .osg-side { transform: translateX(0); }
    .osg.is-side-open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 100000; }
    .osg-side-btn { display: inline-flex; }
    .osg-toolbar { top: 53px; }
    .osg-list--grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
    .osg-dist-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
}
@media (max-width: 767px) {
    .osg { padding: 12px 12px 72px; }
    .osg-hero { padding: 14px 14px 12px; }
    .osg-hero-ic { width: 42px; height: 42px; font-size: 22px; }
    .osg-title { font-size: 21px; }
    .osg-sub { font-size: 12.5px; }
    .osg-hero-tags { gap: 5px; }
    .osg-htag { font-size: 11px; padding: 3px 7px; }
    .osg-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .osg-stat:nth-child(odd) { border-left: 0; }
    .osg-stat:nth-child(n+3) { border-top: 1px solid var(--osg-line); }
    .osg-stat b { font-size: 17px; }
    .osg-toolbar { padding: 9px; top: 53px; }
    .osg-bar-row { gap: 6px; }
    .osg-search { flex: 1 1 100%; }
    .osg-q, .osg-select, .osg-input, .osg-note, .osg-dk-note, .osg-pg-jump input { font-size: 16px; }
    .osg-q { height: 42px; }
    .osg-btn, .osg-viewseg button, .osg-select { min-height: 40px; }
    .osg-sort { flex: 1 1 130px; width: auto; }
    .osg-per { width: auto; flex: 1 1 100px; }
    .osg-viewseg { flex: 1 1 auto; }
    .osg-viewseg button { flex: 1 1 0; }
    .osg-list--grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 9px; }
    .osg-card { padding: 11px 11px 9px; }
    .osg-star, .osg-cmp-add { width: 34px; height: 34px; }
    .osg-list--compact .osg-card { flex-wrap: wrap; }
    .osg-list--compact .osg-card-top { flex: 1 1 60%; }
    .osg-list--compact .osg-card-meta { flex: 1 1 100%; order: 3; }
    .osg-list--compact .osg-card-desc { flex: 1 1 100%; order: 4; }
    .osg-list--compact .osg-card-foot { order: 2; }
    .osg-drawer { width: 100%; height: min(88dvh, 100%); align-self: flex-end; border-left: 0; border-top: 1px solid var(--osg-line); border-radius: 18px 18px 0 0; }
    .osg-mask { align-items: flex-end; }
    .osg-drawer-body { padding: 12px 14px 20px; }
    .osg-cmp-mask { padding: 0; align-items: flex-end; }
    .osg-cmp { width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; }
    .osg-cmpbar { bottom: 8px; }
    .osg-pg { min-width: 40px; height: 40px; }
    .osg-toast { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 480px) {
    .osg-hero-tags .osg-htag:nth-child(n+3) { display: none; }
    .osg-title { font-size: 19px; }
    .osg-hero-ic { display: none; }
    .osg-dk-kv { grid-template-columns: 76px minmax(0, 1fr); }
    .osg-bar-sub { flex-wrap: wrap; }
    .osg-active { flex: 1 1 100%; order: 3; }
    .osg-random-hide { display: none; }
}
@media (hover: none) {
    .osg-card:hover { transform: none; }
    .osg-linkcard:hover { border-color: var(--osg-line); }
}
@media (prefers-reduced-motion: reduce) {
    .osg *, .osg *::before, .osg *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media print {
    .osg-toolbar, .osg-side, .osg-cmpbar, .osg-mask, .osg-cmp-mask, .osg-toast, .osg-fold-btn, .osg-pager { display: none !important; }
    .osg-work { display: block; }
    .osg-card { break-inside: avoid; box-shadow: none; }
    .osg-list--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
