:root { --bg:#0b0d10; --panel:#14181d; --line:#232a32; --text:#e6edf3; --dim:#8b97a4; --accent:#3ef0b0; --accent2:#4aa3ff; --warn:#ffb454; }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--text); font:15px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; }
main { max-width:1000px; margin:0 auto; padding:24px 16px 48px; }
header { display:flex; justify-content:space-between; align-items:baseline; flex-wrap:wrap; gap:8px; margin-bottom:20px; }
h1 { margin:0; font-size:22px; letter-spacing:.5px; } h1 span { color:var(--accent); }
nav { display:flex; gap:4px; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
nav::-webkit-scrollbar { display:none; }
nav a { color:var(--dim); text-decoration:none; padding:8px 12px; font-size:13px; border-radius:8px; white-space:nowrap; border:1px solid transparent; }
nav a.on { color:var(--accent); border-color:var(--line); background:var(--panel); }
nav a:hover { color:var(--accent); }
h1 a.home { color:inherit; text-decoration:none; }
.tag { color:var(--dim); font-size:12px; }
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:14px; }
section { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:16px; }
h2 { margin:0 0 12px; font-size:12px; text-transform:uppercase; letter-spacing:1.5px; color:var(--dim); }
.row { display:grid; grid-template-columns:90px 1fr 64px; align-items:center; gap:10px; margin:9px 0; }
.row label { color:var(--dim); font-size:13px; } .row output { text-align:right; font-size:12px; }
select, input[type=text], input[type=number] { width:100%; background:#0e1216; color:var(--text); border:1px solid var(--line); border-radius:8px; padding:8px; font:inherit; }
input[type=range] { width:100%; accent-color:var(--accent); }
button { font:inherit; color:var(--text); background:#0e1216; border:1px solid var(--line); border-radius:8px; padding:8px 12px; cursor:pointer; }
button:hover { border-color:var(--accent); } button:disabled { opacity:.45; cursor:not-allowed; }
button.big { border:0; border-radius:12px; font-weight:700; font-size:20px; padding:20px; transition:transform .08s, filter .15s; }
button.big:active { transform:scale(.98); } button.big:hover { filter:brightness(1.1); }
.primary { background:var(--accent); color:#04130d; box-shadow:0 0 28px #3ef0b030; border:0; }
.secondary { background:var(--panel); border:1px solid var(--line); }
.actions { display:grid; grid-template-columns:2fr 1fr; gap:12px; margin-top:14px; }
#status { margin-top:12px; font-size:12px; color:var(--dim); min-height:18px; } #status.err { color:#ff6b6b; }
footer { margin-top:24px; color:var(--dim); font-size:12px; text-align:center; }
@media (max-width:520px){ .actions{grid-template-columns:1fr;} }

/* ---- mobile ---- */
html { -webkit-text-size-adjust:100%; }
button, select, input, a { -webkit-tap-highlight-color:transparent; touch-action:manipulation; }
button { min-height:40px; }
main { padding-left:max(16px, env(safe-area-inset-left)); padding-right:max(16px, env(safe-area-inset-right)); padding-bottom:max(48px, env(safe-area-inset-bottom)); }
input[type=range] { height:28px; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
@media (max-width:640px) {
  main { padding-top:14px; padding-left:max(10px, env(safe-area-inset-left)); padding-right:max(10px, env(safe-area-inset-right)); }
  header { flex-direction:column; align-items:stretch; margin-bottom:14px; }
  h1 { font-size:19px; }
  section { padding:12px; border-radius:10px; }
  select, input[type=text], input[type=number] { font-size:16px; } /* prevents iOS zoom-on-focus */
  .row { grid-template-columns:72px 1fr 58px; gap:8px; }
  button.big { font-size:17px; padding:16px; }
  .grid { grid-template-columns:1fr; }
}

/* ---- e-reader mode: pure black on white, no motion, thick borders ---- */
nav .einkbtn { margin-left:auto; white-space:nowrap; font-size:12px; padding:6px 10px; min-height:34px; color:var(--dim); border-radius:8px; }
html.eink { --bg:#fff; --panel:#fff; --line:#000; --text:#000; --dim:#222; --accent:#000; --accent2:#000; --warn:#000; }
html.eink body { font-family:Georgia,"Times New Roman",serif; font-size:17px; }
html.eink *, html.eink *::before, html.eink *::after { animation:none !important; transition:none !important; box-shadow:none !important; text-shadow:none !important; }
html.eink section, html.eink select, html.eink input, html.eink button, html.eink textarea { border:2px solid #000 !important; background:#fff !important; color:#000 !important; border-radius:6px; }
html.eink button { min-height:48px; font-weight:700; }
html.eink .primary, html.eink button.on { background:#000 !important; color:#fff !important; }
html.eink nav a.on { border-color:#000; background:#000; color:#fff; }
html.eink #bg { display:none; }
html.eink input[type=range] { accent-color:#000; }
header { min-width:0; } nav { min-width:0; max-width:100%; }
