:root { --bg: #fff; --fg: #111; --muted: #666; --card: #f7f7f7; --border: #e5e5e5; --focus: #0a66ff; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: 'Noto Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--fg); background: var(--bg); line-height: 1.6; }
.container { width: min(1100px, 92vw); margin-inline: auto; }

.site-header { position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--border); z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; }
.brand { font-weight: 700; letter-spacing: 0.5px; color: var(--fg); text-decoration: none; }
.site-nav ul { display: flex; gap: 1rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--fg); text-decoration: none; padding: 0.5rem 0.25rem; border-bottom: 2px solid transparent; }
.site-nav a.active { border-color: var(--fg); }
.nav-toggle { display: none; }

.section { padding: 3.5rem 0; border-bottom: 1px solid var(--border); }
.hero .lead { font-size: 1.15rem; color: var(--muted); margin-bottom: 1.25rem; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.hero-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; transition: transform .2s ease; }
.hero-card:hover { transform: translateY(-2px); }

.tool { margin-top: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; }
.tool h3 { margin-top: 0; }

.byte-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.5rem; margin-top: 0.5rem; }
.bit { font-family: 'Space Mono', monospace; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 0; cursor: pointer; transition: background .15s ease, transform .05s ease; }
.bit[aria-pressed="true"] { background: #111; color: #fff; }
.bit:active { transform: translateY(1px); }
.byte-readout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-top: 0.75rem; }
.label { color: var(--muted); margin-right: 0.25rem; }

.storage-grid, .conv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; padding: 0.65rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus, button:focus { outline: 3px solid color-mix(in srgb, var(--focus) 40%, transparent); outline-offset: 1px; }
button { border: 1px solid var(--border); background: #fff; padding: 0.6rem 0.9rem; border-radius: 8px; cursor: pointer; }
button:hover { background: #f2f2f2; }

.note { background: #fff; border: 1px dashed var(--border); padding: 0.75rem; border-radius: 8px; color: #333; }
.bullets { line-height: 1.8; }
.timeline { list-style: none; padding: 0; }
.timeline li { padding: 0.35rem 0; border-left: 2px solid var(--border); padding-left: 0.75rem; margin-left: 0.25rem; }

.tool-vm .vm-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; }
.vm-editor textarea { min-height: 220px; font-family: 'Space Mono', monospace; }
.vm-buttons { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.regs { display: grid; grid-template-columns: repeat(4, auto); gap: 0.75rem; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; font-family: 'Space Mono', monospace; }
.mem-view { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.25rem; margin-top: 0.5rem; max-height: 260px; overflow: auto; }
.mem-view div { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 0.4rem; text-align: center; font-family: 'Space Mono', monospace; font-size: 0.9rem; }

.back-to-top { position: fixed; right: 1rem; bottom: 1rem; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.back-to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }

.code-example { margin: 0.5rem 0; padding: 0.75rem; background: #fff; border: 1px solid var(--border); border-radius: 6px; font-family: 'Space Mono', monospace; overflow: auto; }

.site-footer { padding: 2rem 0; text-align: center; color: var(--muted); }

@media (max-width: 860px) {
  .tool-vm .vm-layout { grid-template-columns: 1fr; }
  .site-nav ul { display: none; position: absolute; right: 1rem; top: 3rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; flex-direction: column; }
  .site-nav ul.show { display: flex; }
  .nav-toggle { display: inline-flex; }
}

