  @font-face {
    font-family: 'Fraunces';
    src: url('fonts/Fraunces-VariableFont_SOFT,WONK,opsz,wght.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
  }

    @font-face {
      font-family: 'IBM Plex Sans';
      src: url('fonts/IBMPlexSans-VariableFont_wdth,wght.woff2') format('woff2');
      font-weight: 100 700;
      font-style: normal;
      font-display: swap;
    }

    @font-face {
      font-family: 'IBM Plex Mono';
      src: url('fonts/IBMPlexMono-Regular.woff2') format('woff2');
      font-weight: 400;
      font-style: normal;
      font-display: swap;
    }
  
    @font-face {
      font-family: 'IBM Plex Mono';
      src: url('fonts/IBMPlexMono-Medium.woff2') format('woff2');
      font-weight: 500;
      font-style: normal;
      font-display: swap;
    }
  
    @font-face {
      font-family: 'IBM Plex Mono';
      src: url('fonts/IBMPlexMono-SemiBold.woff2') format('woff2');
      font-weight: 600;
      font-style: normal;
      font-display: swap;
    }

:root {
  --ink: #f5f5f5;
  --panel: #ffffff;
  --panel-2: #f2efe5;
  --rule-rgb: 30, 40, 38;
  --rule: rgba(var(--rule-rgb), 0.07);
  --rule-strong: rgba(var(--rule-rgb), 0.15);
  --chalk: #212e29;
  --chalk-dim: #5b6d66;
  --amber-rgb: 178, 108, 20;
  --amber: rgb(var(--amber-rgb));
  --amber-dim: rgba(var(--amber-rgb), 0.28);
  --amber-hover: #98591a;
  --sage-rgb: 53, 118, 89;
  --sage: rgb(var(--sage-rgb));
  --rust-rgb: 163, 55, 36;
  --rust: rgb(var(--rust-rgb));
  --radius: 14px;
  --placeholder: #8b9994;
  --text-faint: #7c8c86;
  --negative-text: #9c3a26;
  --on-amber: #241705;
  --on-amber-rgb: 36, 23, 5;
}

[data-theme="dark"] {
  --ink: #10181b;
  --panel: #16232a;
  --panel-2: #1c2b33;
  --rule-rgb: 237, 230, 214;
  --rule: rgba(var(--rule-rgb), 0.08);
  --rule-strong: rgba(var(--rule-rgb), 0.16);
  --chalk: #ede6d6;
  --chalk-dim: #9fb0ac;
  --amber-rgb: 227, 162, 60;
  --amber: rgb(var(--amber-rgb));
  --amber-dim: rgba(var(--amber-rgb), 0.35);
  --amber-hover: #eeb15c;
  --sage-rgb: 111, 169, 140;
  --sage: rgb(var(--sage-rgb));
  --rust-rgb: 193, 85, 59;
  --rust: rgb(var(--rust-rgb));
  --placeholder: #5a6b6e;
  --text-faint: #4f6063;
  --negative-text: #f0b8a9;
  --on-amber: #1a1206;
  --on-amber-rgb: 26, 18, 6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--chalk);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

header {
  margin-bottom: 24px;
}

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8em;
  letter-spacing: 0.04em;
  color: var(--amber);
  margin: 0 0 6px;
}

h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 2em;
  margin: 0 0 10px;
  color: var(--chalk);
}

header p {
  color: var(--chalk-dim);
  max-width: 60ch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
}

.matrices-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.matrix-field {
  flex: 1 1 260px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px;
}

/* The plain <fieldset> wrapping A+B/A-B/A*B has no UA-style reset by
   default (border, padding, min-width all come from the browser), which
   is what was pushing B onto its own row -- reset it here and keep it
   narrow/centered instead of stretching like the two .matrix-field
   columns either side of it. */
.matrix-op-field {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  flex: 0 0 auto;
  align-self: center;
}

.matrix-field legend {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  padding: 0 6px;
  color: var(--chalk);
}

.grid-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.dim-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
  color: var(--chalk-dim);
}

.dim-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--rule-strong);
  background: var(--panel-2);
  color: var(--chalk);
  cursor: pointer;
  font-size: 0.9em;
  line-height: 1;
}

.dim-btn:hover { border-color: var(--amber); color: var(--amber); }

.clear-btn {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--text-faint);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85em;
}

.clear-btn:hover { color: var(--rust); }

.matrix-grid {
  display: grid;
  gap: 4px;
}

.matrix-cell {
  width: 100%;
  padding: 6px 4px;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95em;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--chalk);
}

.matrix-cell:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 2px var(--amber-dim);
}

.matrix-textarea {
  width: 100%;
  min-height: 150px;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  color: #222;
  font-family: monospace;
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}

.matrix-textarea:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.15);
}

.matrix-textarea::placeholder {
  color: #888;
  opacity: 1;
}

.ops-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

/* .busy sits on #panel (the whole matrices+ops area) so it also disables
   the add/subtract/multiply buttons between the matrix fields, not just
   the grouped op buttons below -- only .op-btn/.target-btn are dimmed,
   the matrix grids stay editable while a request is in flight. */
.panel.busy .op-btn,
.panel.busy .target-btn {
  opacity: 0.6;
  pointer-events: none;
}

.target-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.target-select-label {
  font-size: 0.85em;
  color: var(--chalk-dim);
}

.target-btn {
  border: 1px solid var(--rule-strong);
  background: var(--panel-2);
  color: var(--chalk-dim);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
}

.target-btn:hover { border-color: var(--amber); color: var(--amber-hover); }

.target-btn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--on-amber);
}

.op-group {
  margin-bottom: 14px;
}

.op-group:last-child { margin-bottom: 0; }

.op-group-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.op-group-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.op-btn {
  border: 1px solid var(--rule-strong);
  background: var(--panel-2);
  color: var(--chalk);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.88em;
  cursor: pointer;
  font-family: 'IBM Plex Sans', sans-serif;
}

.op-btn:hover {
  border-color: var(--amber);
  color: var(--amber-hover);
}

.two-matrix-op {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
}

.op-with-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.small-input {
  width: 3.4em;
  padding: 6px 6px;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--chalk);
}

.error-box {
  display: none;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(var(--rust-rgb), 0.1);
  color: var(--negative-text);
  font-size: 0.9em;
}

.help-toggle {
  margin-top: 16px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.85em;
  padding: 6px 0;
}

.help-panel {
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}

.help-section { margin-bottom: 10px; }

.help-section-title {
  font-weight: 600;
  font-size: 0.85em;
  margin-bottom: 4px;
  color: var(--chalk);
}

.help-text {
  font-size: 0.85em;
  color: var(--chalk-dim);
  margin: 0;
}

.help-text code {
  background: var(--panel-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
}

.mk-mount {
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.mk-keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mk-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.mk-key {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--chalk);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95em;
  cursor: pointer;
}

.mk-key:hover { border-color: var(--amber); color: var(--amber-hover); }

.mk-key--muted { color: var(--chalk-dim); }

.mk-key-with-menu {
  display: inline-flex;
  position: relative;
}

.mk-key-with-menu .mk-key { border-radius: 8px 0 0 8px; }

.mk-key-caret {
  min-width: 18px;
  height: 34px;
  padding: 0 4px;
  border: 1px solid var(--rule-strong);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: var(--panel-2);
  color: var(--chalk-dim);
  font-size: 0.7em;
  cursor: pointer;
}

.mk-key-caret:hover { border-color: var(--amber); color: var(--amber-hover); }

.mk-row--menus { padding-top: 2px; }

.mk-menu-wrapper { position: relative; }

.mk-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--chalk-dim);
  padding: 5px 12px;
  font-size: 0.82em;
  cursor: pointer;
  font-family: 'IBM Plex Sans', sans-serif;
}

.mk-menu-btn:hover { border-color: var(--amber); color: var(--amber-hover); }

.mk-menu-caret { font-size: 0.75em; }

.mk-popover {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  margin-top: 6px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.mk-popover-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 260px;
}

.mk-popover-item { min-width: 44px; }

.results {
  margin-top: 24px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
}

.result-block { margin-bottom: 10px; }

.input-echo {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--chalk-dim);
  font-size: 0.85em;
  margin-bottom: 10px;
}

.result-main {
  font-size: 1.05em;
  overflow-x: auto;
  padding: 6px 0;
}

.warning-note {
  margin-top: 10px;
  font-size: 0.85em;
  color: var(--amber-hover);
}

.steps {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step {
  border-left: 2px solid var(--rule-strong);
  padding: 2px 0 2px 14px;
}

.step-title {
  font-weight: 600;
  font-size: 0.92em;
  color: var(--chalk);
  margin-bottom: 3px;
}

.step-detail {
  font-size: 0.92em;
  color: var(--chalk-dim);
  overflow-x: auto;
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: var(--panel);
  cursor: pointer;
  font-size: 1.1em;
  z-index: 10;
}

#resdiv p, .wrap > p {
  color: var(--chalk-dim);
  font-size: 0.9em;
  margin-top: 28px;
}

@media (max-width: 560px) {
  .matrices-row { flex-direction: column; }
  .matrix-op-field { align-self: stretch; }
  .two-matrix-op { flex-direction: row; flex-wrap: wrap; justify-content: center; }
}


    .verify-note {
      margin: 28px 0 8px;
      padding: 18px 20px;
      border: 1px solid rgba(127, 127, 127, .3);
      border-radius: 12px;
    }
  
    .verify-note-title {
      font-size: 1.05rem;
      margin: 0 0 10px;
    }
  
    .verify-note ul {
      margin: 0 0 12px;
      padding-left: 20px;
    }
  
    .verify-note li+li {
      margin-top: 8px;
    }
  
    .verify-note .disclaimer {
      margin: 0;
    }
  
   
.site-footer {
  margin-top: 48px;
  padding: 28px 16px 24px;
  border-top: 1px solid var(--rule-strong, rgba(127,127,127,.3));
  font-size: 14px;
  line-height: 1.5;
  color: var(--chalk-dim, #98a4b3);    
  background: transparent;
}

.site-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px 32px;
}

.footer-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--chalk, #edf2f7);        
}

.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li + li { margin-top: 6px; }

.site-footer a {
  color: var(--chalk-dim, #98a4b3);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule-strong, rgba(127,127,127,.4));
  transition: color .15s ease, text-decoration-color .15s ease;
}
.site-footer a:hover {
  color: var(--amber, #8176ff);
  text-decoration-color: currentColor;
}

.footer-copy {
  max-width: 960px;
  margin: 22px auto 0;
  color: var(--text-faint, #667384);
  font-size: 13px;
}


.page-header { padding: 20px 0 4px; }

.page-home {
  color: var(--chalk-dim, #98a4b3);
  text-decoration: none;
  transition: color .15s ease;
}
.page-home:hover {
  color: var(--amber, #8176ff);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-content {
  max-width: 960px;
  margin: 0 auto;
  color: var(--chalk-dim, #98a4b3);
}

.page-content h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 12px 0 20px;
  color: var(--chalk, #edf2f7);
}

.page-content ul { padding-left: 22px; }
.page-content li + li { margin-top: 6px; }

.page-content a {
  color: var(--amber, #8176ff);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.page-content a:hover { color: var(--amber-hover, #9b92ff); }

.contact-email {
  font-size: 1.15rem;
  color: var(--amber, #8176ff);
}
