:root{
  --bg: #f2f2f2;
  --panel: #ffffff;
  --text: #111111;
  --muted: #555555;
  --border: rgba(0,0,0,.12);
  --shadow: 0 10px 28px rgba(0,0,0,.08);

  --accent: #2d6cdf;
  --accent2: #1f4fa5;

  --bit-off: #d8d8d8;
  --bit-on: #1a73e8;

  --focus: rgba(45,108,223,.35);

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

:root[data-theme="dark"]{
  --bg: #0f1115;
  --panel: #171a21;
  --text: #e8e8e8;
  --muted: #a6a6a6;
  --border: rgba(255,255,255,.12);
  --shadow: 0 12px 34px rgba(0,0,0,.4);

  --accent: #6ea8ff;
  --accent2: #4d82f5;

  --bit-off: #2b2f38;
  --bit-on: #5aa3ff;

  --focus: rgba(110,168,255,.35);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
}

.mono{ font-family: var(--mono); }

.topbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg) 82%, var(--panel));
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
}

.logo{
  width: 70px;
  height: auto;
  border-radius: 90px;
  display: grid;
  place-items: center;
  display: block;
}
.title{ font-weight: 800; letter-spacing: .2px; }
.subtitle{ color: var(--muted); font-size: 12px; margin-top: 2px; }

.theme{
  display: flex;
  align-items: center;
  gap: 10px;
}

.label{ color: var(--muted); font-size: 13px; }

.wrap{
  max-width: 980px;
  margin: 18px auto;
  padding: 0 16px 28px;
}

.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.h1, .h2{
  margin: 0 0 12px;
}
.h1{ font-size: 18px; }
.h2{ font-size: 16px; color: var(--muted); font-weight: 700; }

.row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: color-mix(in oklab, var(--panel) 90%, var(--bg));
}
.field.inline{
  padding: 12px;
}

.k{ color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.v{ font-size: 22px; font-weight: 800; }
.v.mono{ font-size: 18px; word-break: break-word; }

.bit-grid{
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: color-mix(in oklab, var(--panel) 85%, var(--bg));
}

.bit{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 8px;
  background: var(--bit-off);
  color: #000;
  text-align: center;
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 6px;
  position: relative;
}
:root[data-theme="dark"] .bit{ color: var(--text); }

.bit.on{
  background: var(--bit-on);
  color: #fff;
  border-color: color-mix(in oklab, var(--bit-on) 60%, white 10%);
}

.bit .idx{
  font-size: 12px;
  color: color-mix(in oklab, currentColor 75%, transparent);
}
.bit.on .idx{ color: rgba(255,255,255,.9); }

.bit .val{
  font-family: var(--mono);
  font-weight: 900;
  font-size: 18px;
}

.controls{
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn{
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .05s ease, background .15s ease;
}
.btn:hover{ background: var(--accent2); }
.btn:active{ transform: translateY(1px); }

.btn.ghost{
  background: transparent;
  color: var(--text);
}

.btn.small{
  padding: 10px 10px;
  font-weight: 800;
}

.input-row{
  display: flex;
  gap: 10px;
  align-items: center;
}

.input, .select{
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--panel) 92%, var(--bg));
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}

.input{ max-width: 220px; }
.select{ max-width: 220px; }

.form{
  margin-top: 12px;
  grid-template-columns: 1fr 1fr;
}

.hint{
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.list{
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}
.list b{ color: var(--text); }

:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 10px;
}

/* petite adaptation */
@media (max-width: 720px){
  .row{ grid-template-columns: 1fr; }
  .form{ grid-template-columns: 1fr; }
}
