/* Tool detail composition only. Markdown keeps its article-reader layout.
   The frame uses the previewer's glass treatment; functional roots also own
   the external rankings so moving them cannot break scoped game selectors. */
body[data-page-section="tools"] .tool-detail-layout{
  --tool-ink:#2d3936;
  --tool-muted:#62716a;
  --tool-line:rgba(86,115,102,.27);
  --tool-accent:#547d6d;
  --tool-soft:rgba(84,125,109,.10);
  --tool-field:rgba(237,244,238,.76);
  width:100%;max-width:960px;margin:clamp(24px,8svh,76px) auto 32px;
}
body.dark[data-page-section="tools"] .tool-detail-layout{
  --tool-ink:#e5edf1;--tool-muted:#a4b2bb;--tool-line:rgba(167,191,211,.22);
  --tool-accent:#a9c8bc;--tool-soft:rgba(169,200,188,.10);--tool-field:rgba(15,29,49,.86);
}
body[data-page-section="tools"] .tool-detail-layout--game,
body[data-page-section="tools"] .tool-detail-layout--compact{max-width:740px}
body[data-page-section="tools"] .tool-page{padding:0!important;min-height:0!important;overflow:visible}
html body[data-page-section="tools"] .tool-detail-surface{
  --text:var(--tool-ink);--muted:var(--tool-muted);--border:var(--tool-line);
  --accent-2:var(--tool-accent);--soft-blue:var(--tool-soft);--panel:var(--tool-field);
  position:relative;box-sizing:border-box;width:100%!important;max-width:none;
  margin:0!important;padding:24px!important;
  color:var(--tool-ink);
  background:linear-gradient(138deg,rgba(218,232,223,.63),rgba(200,220,211,.53))!important;
  border:1px solid rgba(235,244,237,.42)!important;border-radius:26px!important;
  box-shadow:0 24px 64px rgba(52,78,66,.20),inset 0 1px rgba(255,255,255,.32)!important;
  backdrop-filter:blur(18px) saturate(108%)!important;
  -webkit-backdrop-filter:blur(18px) saturate(108%)!important;
  transform:none!important;transition:none!important;
}
html body.dark[data-page-section="tools"] .tool-detail-surface{
  background:linear-gradient(138deg,rgba(10,22,40,.82),rgba(12,27,47,.72))!important;border-color:rgba(187,211,232,.15)!important;
  box-shadow:0 26px 70px rgba(0,0,0,.42),inset 0 1px rgba(229,240,255,.07)!important;
}
body[data-page-section="tools"] .tool-detail-title{
  display:flex;align-items:center;min-height:44px;margin:0 0 24px!important;
  padding:0 0 0 56px;font-size:clamp(22px,3vw,28px)!important;line-height:1.3;
  font-weight:700;letter-spacing:0;color:var(--tool-ink);
}
/* A shared rhythm, with compositions suited to each tool rather than repeated
   rows of equal-weight boxes. Keep these selectors inside non-Markdown glass. */
body[data-page-section="tools"] .tool-detail-surface :is(.btn,.typing-button,.typing-mode){
  min-height:44px;padding:10px 16px;border:1px solid var(--tool-line);border-radius:12px;
  background:var(--tool-soft);color:var(--tool-ink);font:inherit;font-weight:600;
  box-shadow:none;transition:background-color .18s ease,border-color .18s ease,color .18s ease;
}
body[data-page-section="tools"] .tool-detail-surface :is(.btn,.typing-button,.typing-mode):is(:hover,:focus-visible){
  background:var(--tool-field)!important;color:var(--tool-accent)!important;
  border-color:var(--tool-accent)!important;box-shadow:none!important;transform:none!important;
}
body[data-page-section="tools"] .tool-detail-surface :is(button,input,textarea,select):focus-visible{outline:2px solid var(--tool-accent);outline-offset:3px}
body[data-page-section="tools"] .tool-detail-surface :is(.random-form input,.gacha-config-grid select,.typing-input){box-sizing:border-box;background:var(--tool-field);border-color:var(--tool-line);color:var(--tool-ink);border-radius:12px;box-shadow:none}
/* Quiet scoreboards follow the width of their actual play area. */
body[data-page-section="tools"] .tool-detail-surface :is(.game-2048-topbar,.flappy-topbar,.reaction-stats,.snake-head){display:flex;align-items:center;justify-content:space-between;gap:20px;width:100%;max-width:520px;margin:4px auto 22px}
body[data-page-section="tools"] .tool-detail-surface :is(.flappy-topbar,.reaction-stats){max-width:620px}
body[data-page-section="tools"] .tool-detail-surface :is(.game-2048-score-card,.flappy-score-card,.reaction-stat-card,.typing-stat-card){display:grid;gap:5px;min-width:0;padding:0;background:none!important;border:0!important;border-radius:0;box-shadow:none!important;color:var(--tool-muted)}
body[data-page-section="tools"] .tool-detail-surface :is(.game-2048-score-card,.flappy-score-card,.reaction-stat-card,.typing-stat-card) strong{color:var(--tool-ink);font-size:26px;line-height:1.2;letter-spacing:-.025em;font-variant-numeric:tabular-nums}
body[data-page-section="tools"] .tool-detail-surface :is(.game-2048-score-card,.flappy-score-card,.reaction-stat-card):last-child{text-align:right}
body[data-page-section="tools"] .tool-detail-surface :is(.game-2048-score-card,.flappy-score-card,.reaction-stat-card,.typing-stat-card) span{color:var(--tool-muted);font-size:12px;font-weight:500}
body[data-page-section="tools"] .tool-detail-surface .snake-stats{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;width:100%;min-width:0}
body[data-page-section="tools"] .tool-detail-surface .snake-stats > span{display:flex;flex-direction:column;gap:5px;min-width:0;padding:0;background:none!important;border:0!important;border-radius:0;color:var(--tool-muted);font-size:12px;font-weight:500}
body[data-page-section="tools"] .tool-detail-surface .snake-stats b{color:var(--tool-ink);font-size:26px;line-height:1.2;font-variant-numeric:tabular-nums}
body[data-page-section="tools"] .tool-detail-surface .snake-stats > [data-snake-state]{margin-left:auto;align-self:center;max-width:7em;text-align:right}
body[data-page-section="tools"] .tool-detail-surface :is(.snake-stage-wrap,.flappy-board-wrap){box-sizing:border-box;padding:0;border:1px solid var(--tool-line);border-radius:20px;background:var(--tool-soft);box-shadow:none;overflow:hidden}
body[data-page-section="tools"] .tool-detail-surface .flappy-board-wrap{max-width:620px;margin:0 auto}
body[data-page-section="tools"] .tool-detail-surface .snake-canvas{border-radius:inherit}
body[data-page-section="tools"] .tool-detail-surface :is(.snake-overlay,.flappy-overlay,.game-2048-overlay){inset:0;border-radius:inherit;background:rgba(232,240,234,.32);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);color:var(--tool-ink);border:0;box-shadow:none;gap:10px}
body.dark[data-page-section="tools"] .tool-detail-surface :is(.snake-overlay,.flappy-overlay,.game-2048-overlay){background:rgba(9,20,34,.36)}
body[data-page-section="tools"] .tool-detail-surface :is(.snake-overlay,.flappy-overlay,.game-2048-overlay) strong{color:var(--tool-ink);font-size:clamp(26px,4vw,38px);font-weight:650;line-height:1.3;letter-spacing:0}
body[data-page-section="tools"] .tool-detail-surface :is(.snake-overlay span,.flappy-overlay em,.game-2048-overlay span){color:var(--tool-ink);font-size:14px;max-width:30em;padding:0 16px}
body[data-page-section="tools"] .tool-detail-surface .snake-arcade-strip{display:flex;flex-wrap:wrap;justify-content:center;gap:8px 18px;max-width:520px;margin:16px auto 0;padding:0;background:none;border:0;box-shadow:none}
body[data-page-section="tools"] .tool-detail-surface .snake-chip{min-width:0;padding:3px 0;background:none!important;border:0;border-radius:0;box-shadow:none;color:var(--tool-muted);font-size:12px}
body[data-page-section="tools"] .tool-detail-surface .game-2048-board{background:var(--tool-soft);border:1px solid var(--tool-line);border-radius:20px;box-shadow:none}
body[data-page-section="tools"] .tool-detail-surface .game-2048-cell{background:rgba(84,125,109,.12);box-shadow:none}
body.dark[data-page-section="tools"] .tool-detail-surface .game-2048-cell{background:rgba(168,196,215,.12)}
body[data-page-section="tools"] .tool-detail-surface .reaction-stage{max-width:620px;min-height:300px;border:1px solid var(--tool-line);border-radius:20px;box-shadow:none;transform:none;animation:none}
body[data-page-section="tools"] .tool-detail-surface .reaction-stage:is(:hover,:focus-visible){transform:none;box-shadow:none}
body[data-page-section="tools"] .tool-detail-surface .reaction-stage strong{font-size:clamp(28px,4vw,42px);line-height:1.3;letter-spacing:0;font-weight:650}
body[data-page-section="tools"] .tool-detail-surface .reaction-stage em{font-size:14px}
body[data-page-section="tools"] .tool-detail-surface .reaction-stage:is(.is-idle,.is-result){background:radial-gradient(ellipse at 50% 40%,var(--tool-soft),transparent 75%);color:var(--tool-ink)}
body[data-page-section="tools"] .tool-detail-surface .reaction-stage.is-result em{color:var(--tool-muted)}
/* Number generator: the result is the focal point, with a compact range desk. */
body[data-page-section="tools"] .tool-detail-surface .random-workspace{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);align-items:center;gap:32px;padding:18px 0 14px}
body[data-page-section="tools"] .tool-detail-surface .random-result-box{min-width:0;min-height:260px;margin:0;padding:16px;border:0;border-radius:24px;background:radial-gradient(ellipse,var(--tool-soft),transparent 70%)!important;box-shadow:none}
body[data-page-section="tools"] .tool-detail-surface .random-result-box strong{font-size:clamp(56px,7vw,96px);font-weight:600;line-height:1.1;letter-spacing:-.04em;max-width:100%;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
body[data-page-section="tools"] .tool-detail-surface .random-result-box p{font-size:13px;margin-top:14px}
body[data-page-section="tools"] .tool-detail-surface .random-result-box p:empty{display:none}
body[data-page-section="tools"] .tool-detail-surface .random-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 12px;min-width:0;padding-left:28px;border-left:1px solid var(--tool-line)}
body[data-page-section="tools"] .tool-detail-surface .random-form label{min-width:0;font-size:13px;font-weight:500}
body[data-page-section="tools"] .tool-detail-surface .random-form input{min-width:0;min-height:48px;padding:12px;font-size:18px;font-variant-numeric:tabular-nums}
body[data-page-section="tools"] .tool-detail-surface .random-generate-button{grid-column:1/-1;width:100%}
/* Gacha: a settings rail and a result gallery, not three stacked dashboards. */
body[data-page-section="tools"] .tool-detail-surface .gacha-workspace{display:grid;grid-template-columns:minmax(220px,.7fr) minmax(0,1.3fr);gap:32px;padding-top:8px}
body[data-page-section="tools"] .tool-detail-surface .gacha-setup{min-width:0;padding-right:28px;border-right:1px solid var(--tool-line)}
body[data-page-section="tools"] .tool-detail-surface .gacha-head{margin:0 0 22px}
body[data-page-section="tools"] .tool-detail-surface .gacha-status{display:flex;gap:8px}
body[data-page-section="tools"] .tool-detail-surface .gacha-status span{padding:0;border:0;background:none!important;color:var(--tool-muted);font-size:13px;font-weight:500}
body[data-page-section="tools"] .tool-detail-surface .gacha-status b{color:var(--tool-ink);font-size:20px;margin-left:6px}
body[data-page-section="tools"] .tool-detail-surface .gacha-config-grid{grid-template-columns:minmax(0,1fr);gap:16px;margin:0 0 26px}
body[data-page-section="tools"] .tool-detail-surface .gacha-config-grid label{min-width:0;font-size:13px;font-weight:500}
body[data-page-section="tools"] .tool-detail-surface .gacha-config-grid select{min-height:46px;padding:10px;font-size:14px}
body[data-page-section="tools"] .tool-detail-surface .gacha-pity-grid{grid-template-columns:minmax(0,1fr);gap:20px;margin:0 0 26px}
body[data-page-section="tools"] .tool-detail-surface .gacha-pity-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;margin:0;padding:0;border:0;background:none!important;border-radius:0;min-width:0}
body[data-page-section="tools"] .tool-detail-surface .gacha-pity-card > span{font-size:12px}
body[data-page-section="tools"] .tool-detail-surface .gacha-pity-card strong{margin:0;font-size:18px;line-height:1.4;color:var(--tool-ink);white-space:nowrap}
body[data-page-section="tools"] .tool-detail-surface .gacha-bar{grid-column:1/-1;height:4px;background:var(--tool-line)}
body[data-page-section="tools"] .tool-detail-surface .gacha-bar i{background:var(--tool-accent)}
body[data-page-section="tools"] .tool-detail-surface .gacha-actions{display:grid;grid-template-columns:1fr 1.3fr;gap:10px;margin:0}
body[data-page-section="tools"] .tool-detail-surface [data-gacha-pull-ten]{background:var(--tool-accent);color:#fff;border-color:transparent}
body.dark[data-page-section="tools"] .tool-detail-surface [data-gacha-pull-ten]{color:#14252b}
body[data-page-section="tools"] .tool-detail-surface .gacha-result-box{display:flex;flex-direction:column;min-width:0;background:none!important;border:0;box-shadow:none;padding:0;border-radius:0}
body[data-page-section="tools"] .tool-detail-surface .gacha-result-head{display:flex;flex-wrap:wrap;flex-direction:row;align-items:center;gap:10px 16px;margin:0 0 20px}
body[data-page-section="tools"] .tool-detail-surface .gacha-result-head h2{font-size:17px;color:var(--tool-ink);font-weight:600}
body[data-page-section="tools"] .tool-detail-surface .gacha-result-head p{font-size:12px;line-height:1.6;color:var(--tool-muted)}
body[data-page-section="tools"] .tool-detail-surface .gacha-results{flex:1;align-content:start;grid-template-columns:repeat(auto-fill,minmax(105px,1fr));gap:12px;max-height:560px;overflow-y:auto;padding:2px;overscroll-behavior:contain}
body[data-page-section="tools"] .tool-detail-surface .gacha-results:has(.gacha-empty){display:flex}
body[data-page-section="tools"] .tool-detail-surface .gacha-card{min-width:0;min-height:110px;border-radius:14px;box-shadow:none;padding:16px 10px;gap:10px}
body[data-page-section="tools"] .tool-detail-surface .gacha-card small{font-size:11px;line-height:1.6}
body[data-page-section="tools"] .tool-detail-surface .gacha-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;min-height:280px;box-sizing:border-box;border:1px dashed var(--tool-line);border-radius:18px;font-size:14px}
body[data-page-section="tools"] .gacha-empty .ui-icon{--ui-icon-size:38px;opacity:.6}
body[data-page-section="tools"] .gacha-result-head p:empty{display:none}
/* Typing: a quiet mode selector, compact metrics, then side-by-side work. */
body[data-page-section="tools"] .tool-detail-surface .typing-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:20px;padding:4px 0 22px;margin-bottom:22px;border-bottom:1px solid var(--tool-line)}
body[data-page-section="tools"] .tool-detail-surface .typing-topbar{margin:0}
body[data-page-section="tools"] .tool-detail-surface .typing-mode-group{display:flex;gap:4px;padding:4px;background:var(--tool-soft);border-radius:13px}
body[data-page-section="tools"] .tool-detail-surface .typing-mode{padding:8px 12px;min-height:40px;border:0;border-radius:10px;background:transparent;box-shadow:none;font-size:13px;font-weight:500}
body[data-page-section="tools"] .tool-detail-surface .typing-mode.is-active{background:var(--tool-field);color:var(--tool-ink);box-shadow:0 2px 8px rgba(0,0,0,.08)}
body[data-page-section="tools"] .tool-detail-surface .typing-stats{display:flex;flex-wrap:wrap;justify-content:space-between;gap:12px 22px;margin:0}
body[data-page-section="tools"] .tool-detail-surface .typing-stat-card strong{font-size:20px}
body[data-page-section="tools"] .tool-detail-surface .typing-card{border:0;background:none!important;padding:0;box-shadow:none;border-radius:0}
body[data-page-section="tools"] .tool-detail-surface .typing-meta{font-size:15px;font-weight:600;color:var(--tool-ink);margin-bottom:16px}
body[data-page-section="tools"] .tool-detail-surface .typing-workspace{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:stretch}
body[data-page-section="tools"] .tool-detail-surface .typing-text{box-sizing:border-box;min-width:0;max-height:400px;overflow-y:auto;overscroll-behavior:contain;padding:20px;border-radius:16px;background:var(--tool-soft);color:var(--tool-ink);font-size:15px;line-height:1.9;letter-spacing:0;white-space:pre-wrap;word-break:normal;overflow-wrap:anywhere}
body[data-page-section="tools"] .tool-detail-surface .typing-text span{padding:.04em 0}
body[data-page-section="tools"] .tool-detail-surface .typing-entry{display:flex;flex-direction:column;gap:12px;min-width:0}
body[data-page-section="tools"] .tool-detail-surface .typing-input{flex:1;min-height:200px;margin:0;padding:20px;font-size:15px;line-height:1.9}
body[data-page-section="tools"] .tool-detail-surface .typing-input:focus{border-color:var(--tool-accent);box-shadow:none}
body[data-page-section="tools"] .tool-detail-surface .typing-actions{display:flex;justify-content:flex-end;margin:0}
/* Independent right rail; it never participates in the main glass surface. */
body[data-page-section="tools"] main.container:has(.tool-detail-ranking){width:min(1320px,calc(100% - 48px));max-width:none}
body[data-page-section="tools"] .tool-detail-layout:has(> .tool-detail-ranking){
  --ranking-rail-width:220px;--ranking-rail-gap:22px;
  position:relative;display:grid;grid-template-columns:var(--ranking-rail-width) minmax(0,1fr) var(--ranking-rail-width);
  align-items:start;gap:var(--ranking-rail-gap);max-width:1224px;
}
body[data-page-section="tools"] .tool-detail-layout:has(> .tool-detail-ranking) > .tool-detail-surface{grid-column:2;grid-row:1}
body[data-page-section="tools"] .tool-detail-ranking{
  grid-column:3;grid-row:1;
  position:sticky;top:96px;box-sizing:border-box;width:100%!important;margin:0!important;padding:0!important;
  background:rgba(12,22,30,.62)!important;color:#e5edf1;border:1px solid rgba(236,249,250,.20);
  border-radius:16px;box-shadow:none;overflow:hidden;
}
body[data-page-section="tools"] .tool-detail-ranking > summary{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  min-height:48px;padding:12px 18px;box-sizing:border-box;cursor:pointer;list-style:none;
  font-size:15px;font-weight:600;letter-spacing:0;
}
body[data-page-section="tools"] .tool-detail-ranking > summary > span{min-width:0;overflow-wrap:anywhere}
body[data-page-section="tools"] .tool-detail-ranking > summary::-webkit-details-marker{display:none}
body[data-page-section="tools"] .tool-detail-ranking > summary::after{
  content:"";width:8px;height:8px;flex:0 0 8px;border-right:1.5px solid currentColor;
  border-bottom:1.5px solid currentColor;transform:rotate(45deg);transition:transform .18s ease;
}
body[data-page-section="tools"] .tool-detail-ranking[open] > summary::after{transform:rotate(225deg)}
body[data-page-section="tools"] .tool-detail-ranking > summary:is(:hover,:focus-visible){background:rgba(236,249,250,.08)}
body[data-page-section="tools"] .tool-detail-ranking > summary:focus-visible{outline:2px solid #a9c8bc;outline-offset:-4px}
body[data-page-section="tools"] .tool-detail-ranking ol{display:grid;grid-template-columns:1fr!important;gap:0;padding:0 18px 12px;margin:0;list-style:none}
body[data-page-section="tools"] .tool-detail-ranking li{display:flex;align-items:center;justify-content:space-between;padding:12px 0;border-radius:0;background:none;border-top:1px solid rgba(236,249,250,.14);color:#c8d6d8}
body[data-page-section="tools"] .tool-detail-ranking li b{color:#e5edf1;font-size:18px}
/* Icon-only sound controls: keep the original native states and hit area. */
html body[data-page-section="tools"] .tool-detail-surface .tool-sound-toggle{
  position:relative;display:inline-grid;place-items:center;box-sizing:border-box;
  flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;
  padding:0;border:1px solid var(--tool-line);border-radius:12px;
  background:var(--tool-soft)!important;color:var(--tool-ink)!important;box-shadow:none!important;
  cursor:pointer;transition:background-color .18s ease,border-color .18s ease;
}
html body[data-page-section="tools"] .tool-sound-toggle::before,
html body[data-page-section="tools"] .tool-sound-toggle::after{content:none!important;display:none!important}
html body[data-page-section="tools"] .tool-sound-toggle > input{
  position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer;z-index:1;
}
html body[data-page-section="tools"] .tool-sound-toggle > .ui-icon{--ui-icon-size:22px;grid-area:1 / 1;pointer-events:none}
html body[data-page-section="tools"] .tool-sound-toggle > [data-ui-icon="volume-off"]{display:none}
html body[data-page-section="tools"] .tool-sound-toggle:is([aria-pressed="false"],:has(input:not(:checked))) > [data-ui-icon="volume"]{display:none}
html body[data-page-section="tools"] .tool-sound-toggle:is([aria-pressed="false"],:has(input:not(:checked))) > [data-ui-icon="volume-off"]{display:grid}
html body[data-page-section="tools"] .tool-sound-toggle:is(:hover,:focus-visible,:has(input:focus-visible)){background:var(--tool-field)!important;border-color:var(--tool-accent)!important;color:var(--tool-accent)!important;transform:none!important}
html body[data-page-section="tools"] .tool-sound-toggle:has(input:focus-visible){outline:2px solid var(--tool-accent);outline-offset:3px}
body[data-page-section="tools"] .tool-detail-surface .snake-head{align-items:center;justify-content:space-between;flex-direction:row;gap:12px}
body[data-page-section="tools"] .tool-detail-surface .snake-stats{flex:1;min-width:0}
/* Bare icon controls live in the glass header, not in the score row. */
body[data-page-section="tools"] .tool-actionbar{position:absolute;top:24px;right:24px;display:flex;align-items:center;gap:4px;width:max-content;margin:0;z-index:10}
body[data-page-section="tools"] .tool-detail-surface:has(.tool-actionbar) > .tool-detail-title{padding-right:208px}
body[data-page-section="tools"] .tool-detail-surface:has(.tool-actionbar[data-tool-actions="1"]) > .tool-detail-title{padding-right:60px}
body[data-page-section="tools"] .tool-detail-surface:has(.tool-actionbar[data-tool-actions="2"]) > .tool-detail-title{padding-right:108px}
body[data-page-section="tools"] .tool-detail-surface:has(.tool-actionbar[data-tool-actions="3"]) > .tool-detail-title{padding-right:156px}
html body[data-page-section="tools"] .tool-detail-surface :is(.tool-icon-button,.tool-actionbar .tool-sound-toggle){
  display:inline-grid;place-items:center;box-sizing:border-box;flex:0 0 44px;
  width:44px;height:44px;min-width:44px;min-height:44px;margin:0;padding:0;
  border:0!important;border-radius:10px;background:transparent!important;box-shadow:none!important;
  color:var(--tool-ink)!important;cursor:pointer;transform:none!important;
  transition:background-color .18s ease,color .18s ease;
}
html body[data-page-section="tools"] .tool-detail-surface :is(.tool-icon-button,.tool-actionbar .tool-sound-toggle):is(:hover,:focus-visible,:has(input:focus-visible)){background:var(--tool-soft)!important;color:var(--tool-accent)!important}
@media(min-width:981px) and (max-width:1279px){
  body[data-page-section="tools"] .tool-detail-layout:has(> .tool-detail-ranking){--ranking-rail-width:160px;--ranking-rail-gap:16px;max-width:1092px}
  body[data-page-section="tools"] .tool-detail-ranking > summary{padding-inline:12px;gap:8px}
  body[data-page-section="tools"] .tool-detail-ranking ol{padding-inline:12px}
}
@media(max-width:1279px){
  body[data-page-section="tools"] .tool-detail-surface .typing-workspace{grid-template-columns:minmax(0,1fr)}
  body[data-page-section="tools"] .tool-detail-surface .typing-text{max-height:220px}
}
@media(max-width:820px){
  body[data-page-section="tools"] .tool-detail-surface .snake-mobile-pad{grid-template-columns:repeat(3,52px)!important;grid-template-rows:repeat(2,52px)!important;gap:10px!important;margin:18px auto 0!important}
  body[data-page-section="tools"] .tool-detail-surface .snake-mobile-pad button{width:52px!important;height:52px!important;min-width:52px!important;min-height:52px!important;padding:0!important;border-radius:13px!important;border:1px solid var(--tool-line)!important;background:var(--tool-soft)!important;color:var(--tool-ink)!important;box-shadow:none!important;transform:none!important}
  body[data-page-section="tools"] .tool-detail-surface .snake-mobile-pad button:is(:hover,:focus-visible,:active){background:var(--tool-field)!important;color:var(--tool-accent)!important}
  body[data-page-section="tools"] .tool-detail-surface .snake-mobile-pad [data-snake-dir="down"]{grid-row:2!important}
  body[data-page-section="tools"] .tool-detail-surface .snake-mobile-pad button :is(svg,.ui-icon){width:22px!important;height:22px!important}
}
@media(max-width:980px){
  body[data-page-section="tools"] .tool-actionbar{top:18px;right:18px}
  body[data-page-section="tools"] .tool-detail-layout{margin:0 auto 24px}
  body[data-page-section="tools"] .tool-detail-layout:has(> .tool-detail-ranking){display:block;padding-top:60px}
  body[data-page-section="tools"] .tool-detail-ranking{position:absolute;top:0;right:0;width:220px!important;max-width:100%;z-index:30;max-height:calc(100svh - 160px);overflow:auto;background:rgba(12,22,30,.94)!important}
  body[data-page-section="tools"] .tool-detail-surface{padding:18px!important}
  body[data-page-section="tools"] .focus-shell.tool-detail-surface{margin:0 auto 24px!important}
}
@media(max-width:820px){
  html body[data-page-section="tools"] .tool-detail-surface{background:linear-gradient(145deg,rgba(222,235,226,.74),rgba(202,220,211,.66))!important;border-radius:18px!important}
  html body.dark[data-page-section="tools"] .tool-detail-surface{background:linear-gradient(145deg,rgba(10,23,42,.88),rgba(13,29,49,.80))!important}
}
@media(max-width:640px){
  body[data-page-section="tools"] .tool-detail-surface:has([data-tool-actions]) > .tool-detail-title{padding-right:0!important;margin-bottom:12px!important}
  body[data-page-section="tools"] .tool-actionbar{position:static;grid-column:1/-1;justify-self:end;margin:-4px 0 16px auto}
  body[data-page-section="tools"] .tool-actionbar[data-tool-actions="1"]{position:absolute;top:18px;right:18px;margin:0}
  body[data-page-section="tools"] .tool-detail-surface:has(.tool-actionbar[data-tool-actions="1"]) > .tool-detail-title{padding-right:60px!important;margin-bottom:24px!important}
  body[data-page-section="tools"] .tool-detail-title{font-size:22px!important;margin-bottom:18px!important}
  body[data-page-section="tools"] .tool-detail-surface .reaction-stage{min-height:240px;padding:18px}
  body[data-page-section="tools"] .tool-detail-surface .reaction-stage em{text-align:center;line-height:1.6}
  body[data-page-section="tools"] .tool-detail-surface .random-workspace{grid-template-columns:minmax(0,1fr);gap:16px;padding:0}
  body[data-page-section="tools"] .tool-detail-surface .random-result-box{min-height:170px}
  body[data-page-section="tools"] .tool-detail-surface .random-form{border-left:0;border-top:1px solid var(--tool-line);padding:22px 0 0}
  body[data-page-section="tools"] .tool-detail-surface .gacha-workspace{grid-template-columns:minmax(0,1fr);gap:26px}
  body[data-page-section="tools"] .tool-detail-surface .gacha-setup{border-right:0;padding-right:0}
  body[data-page-section="tools"] .tool-detail-surface .gacha-result-box{padding-top:24px;border-top:1px solid var(--tool-line)}
  body[data-page-section="tools"] .tool-detail-surface .gacha-head{margin-bottom:16px}
  body[data-page-section="tools"] .tool-detail-surface .gacha-pity-grid{gap:14px;margin-bottom:20px}
  body[data-page-section="tools"] .tool-detail-surface .gacha-empty{min-height:160px}
  body[data-page-section="tools"] .tool-detail-surface .typing-toolbar{gap:18px}
  body[data-page-section="tools"] .tool-detail-surface .typing-stats{width:100%;gap:10px}
  body[data-page-section="tools"] .tool-detail-surface .typing-stat-card strong{font-size:18px}
  body[data-page-section="tools"] .tool-detail-surface .typing-text{padding:16px;font-size:14px}
  body[data-page-section="tools"] .tool-detail-surface .typing-input{min-height:150px;padding:16px;font-size:14px}
}
@media(min-width:361px) and (max-width:640px){
  body[data-page-section="tools"] .tool-actionbar[data-tool-actions="2"]{position:absolute;top:18px;right:18px;margin:0}
  body[data-page-section="tools"] .tool-detail-surface:has(.tool-actionbar[data-tool-actions="2"]) > .tool-detail-title{padding-right:108px!important;margin-bottom:24px!important}
}
@media(prefers-reduced-motion:reduce){body[data-page-section="tools"] .tool-detail-ranking > summary::after{transition:none}}
