/* Shared surfaces for the tool pages and the standalone homepage. */
html[data-site-theme] body { background: var(--bg-primary); color: var(--text-primary); font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; line-height: 1.65; }
html[data-site-theme] .glass { background: var(--bg-card); border-color: var(--border-primary); }
html[data-site-theme] .glass:hover { background: var(--bg-card-hover); }
html[data-site-theme] .hero-bg { background: radial-gradient(ellipse at top, var(--bg-secondary), var(--bg-primary) 75%); }
html[data-site-theme] body > nav, html[data-site-theme] body > footer { background: var(--bg-primary); border-color: var(--border-primary); }
html[data-site-theme] :is(h1,h2,h3,h4,h5,h6,label).text-white { color: var(--text-primary); }
html[data-site-theme] :is(.text-slate-100,.text-slate-200) { color: var(--text-primary); }
html[data-site-theme] :is(.text-slate-300,.text-slate-400) { color: var(--text-secondary); }
html[data-site-theme] :is(.text-slate-500,.text-slate-600) { color: var(--text-muted); }
html[data-site-theme] :is(input:not([type=color]),select,textarea) { color: var(--text-primary); }
html[data-site-theme] select option { background: var(--bg-secondary); color: var(--text-primary); }
html[data-site-theme] input::placeholder, html[data-site-theme] textarea::placeholder { color: var(--text-muted); opacity: 1; }
html[data-site-theme] :is(a,button,input,select,textarea):focus-visible { outline: 2px solid var(--theme-primary); outline-offset: 3px; }
html[data-site-theme] { scrollbar-color: var(--text-muted) var(--bg-primary); }
.theme-control { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 110; }
.theme-toggle { display:flex; align-items:center; gap:8px; min-height:44px; padding:10px 16px; border:1px solid var(--border-primary); border-radius:999px; background:var(--bg-secondary); color:var(--text-primary); box-shadow:0 4px 20px #0002; cursor:pointer; }
.theme-panel { position:absolute; bottom:58px; right:0; width:min(340px,calc(100vw - 32px)); max-height:calc(100dvh - 100px); overflow:auto; padding:20px; background:var(--bg-primary); color:var(--text-primary); border:1px solid var(--border-primary); border-radius:20px; box-shadow:0 16px 60px #0004; }
.theme-panel[hidden] { display:none; }
.theme-panel-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.theme-panel h2 { font-size:16px; font-weight:700; margin:0; }
.theme-panel p { font-size:12px; color:var(--text-muted); margin:6px 0 16px; }
.theme-close { width:36px; height:36px; border-radius:10px; cursor:pointer; background:var(--bg-secondary); color:var(--text-primary); }
.theme-options { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.theme-option { padding:12px; text-align:left; border:1px solid var(--border-primary); border-radius:12px; background:var(--bg-card); color:var(--text-primary); cursor:pointer; }
.theme-option:hover { background:var(--bg-card-hover); }
.theme-option.active { border-color:var(--theme-primary); box-shadow:inset 0 0 0 1px var(--theme-primary); }
.theme-swatch { display:block; height:32px; border-radius:6px; margin-bottom:8px; background:linear-gradient(110deg,var(--swatch-bg) 65%,var(--swatch-accent) 65%); border:1px solid #94a3b844; }
.theme-option strong { font-size:13px; display:block; }
.theme-option small { font-size:11px; color:var(--text-muted); }
.theme-current { padding-top:14px; margin-top:14px; border-top:1px solid var(--border-primary); font-size:12px; color:var(--text-secondary); }
@media (prefers-reduced-motion: reduce) { html[data-site-theme] *, html[data-site-theme] *::before, html[data-site-theme] *::after { scroll-behavior:auto !important; transition-duration:0.01ms !important; animation-duration:0.01ms !important; animation-iteration-count:1 !important; } }
html[data-site-theme] [class~="bg-slate-800"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-800/20"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-800/30"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-800/40"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-800/50"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-800/60"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-800/70"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-800/80"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-800/90"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-800/95"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-900"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-900/20"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-900/30"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-900/40"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-900/50"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-900/60"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-900/70"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-900/80"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-900/90"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-900/95"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-950"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-950/20"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-950/30"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-950/40"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-950/50"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-950/60"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-950/70"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-950/80"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-950/90"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="bg-slate-950/95"] { background-color:var(--bg-secondary); }
html[data-site-theme] [class~="border-white/5"] { border-color:var(--border-primary); }
html[data-site-theme] [class~="border-white/10"] { border-color:var(--border-primary); }
html[data-site-theme] [class~="border-slate-700"] { border-color:var(--border-primary); }
html[data-site-theme] [class~="border-slate-800"] { border-color:var(--border-primary); }
html[data-site-theme] [class~="border-slate-800/50"] { border-color:var(--border-primary); }
html[data-site-theme="light"] :is(.text-indigo-400,.text-purple-400,.text-sky-400) { color:#4338ca; }

/* Surface utilities must not flatten glass cards into the secondary layer. */
html[data-site-theme] .glass { background:var(--bg-card); }
html[data-site-theme] .glass:hover { background:var(--bg-card-hover); }
/* 浅色主题: 实色按钮/徽标/图标块内的白色文字保持白色（覆盖 bg-indigo-600 等 6xx 家族） */
html[data-site-theme="light"] :is(p,span,a,td,th,div).text-white:not([class*="bg-"]):not([class*="bg-gradient-"] *):not([class*="bg-indigo-"] *):not([class*="bg-purple-"] *):not([class*="bg-blue-"] *):not([class*="bg-sky-"] *):not([class*="bg-cyan-"] *):not([class*="bg-green-"] *):not([class*="bg-emerald-"] *):not([class*="bg-pink-"] *):not([class*="bg-rose-"] *):not([class*="bg-red-"] *):not([class*="bg-orange-"] *):not([class*="bg-amber-"] *):not([class*="bg-yellow-"] *):not([class*="bg-violet-"] *):not([class*="bg-fuchsia-"] *) { color:var(--text-primary); }
html[data-site-theme="light"] [class~="hover:bg-slate-800/50"]:hover { background-color:var(--bg-card-hover); }

/* Live mirror metrics use semantic colors in every theme. */
html[data-site-theme] .mirror-status-frame { background:var(--bg-card); border-color:var(--border-primary); }
html[data-site-theme] .mirror-status thead { background:var(--bg-secondary); }
html[data-site-theme] .mirror-status :is(th,.mirror-status-name,.mirror-status-value) { color:var(--text-primary); }
html[data-site-theme] .mirror-status tr { border-color:var(--border-primary); }
html[data-site-theme] .mirror-status-body > tr + tr { border-top:1px solid var(--border-primary); }
html[data-site-theme] .mirror-status-body > tr:hover { background:var(--bg-card-hover); }
