/* ─── IDE custom properties ──────────────────────────────────────── */
:root {
  --ide-bg: #0d1117;
  --ide-surface: #161b22;
  --ide-border: #30363d;
  --ide-text: #c9d1d9;
  --ide-dim: #6e7681;
  --ide-accent: #7c3aed;
  --ide-cursor: #3b82f6;
  --ide-green: #4ade80;
  --ide-amber: #f59e0b;
  --ide-key-bg: #21262d;
  --ide-key-act: #30363d;
  --touch-target: 2.6rem;
}

/* iPhone / Safari home-screen safe-area support (notch and bottom inset) */
:root {
  /* Prefer modern env(); fall back to legacy constant() for older iOS Safari. */
  --safe-area-top: env(safe-area-inset-top, constant(safe-area-inset-top, 0px));
  --safe-area-bottom: env(safe-area-inset-bottom, constant(safe-area-inset-bottom, 0px));
}

html {
  font-size: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  /* dark background so the safe-area behind the notch is visually consistent */
  background: var(--ide-bg);
  color: var(--ide-text);
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

input {
  outline: none;
}

.ide-app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  height: 100dvh;
}

/* Apply conservative safe-area offsets — cap them so they don't add huge gaps */
.ide-app {
  padding-top: min(var(--safe-area-top), 12px);
  padding-bottom: min(var(--safe-area-bottom), 10px);
}

.ide-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 0 0 0.6rem;
  /* keep header a predictable height; use a small top inset instead of enlarging it */
  padding-top: min(var(--safe-area-top), 10px);
  height: 2.8rem;
  background: var(--ide-surface);
  border-bottom: 1px solid var(--ide-border);
  gap: 0.5rem;
  overflow: visible;
}

.ide-logo {
  font-size: 1.1rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  padding-bottom: 0.6rem;
}

.logo-p {
  color: #a78bfa;
}

.logo-i {
  color: #60a5fa;
}

.logo-x {
  color: #34d399;
}

.logo-y {
  color: #fbbf24;
}

.hdr-meta {
  flex: 1;
  color: var(--ide-dim);
  font-size: 0.7rem;
  padding-left: 0.4rem;
  padding-bottom: 0.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-bar {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 100%;
  padding-top: 6px;
}

/* Ensure tabs sit above the main content and remain clickable */
.tab-btn {
  position: relative;
  z-index: 3;
}

.tab-btn {
  min-height: unset;
  height: 100%;
  background: var(--ide-key-bg);
  border: 1px solid var(--ide-border);
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  color: var(--ide-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0 0.9rem;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  /* Cover the header's bottom border so tab connects to content */
  margin-bottom: -1px;
}

.tab-btn::before {
  /* Accent stripe shown on hover */
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  border-radius: 5px 5px 0 0;
  transition: background 0.12s;
}

.tab-btn:hover,
.dark-mode .tab-btn:hover {
  color: var(--ide-text);
  background: var(--ide-bg);
  border-color: var(--ide-border);
}

.tab-btn:hover::before {
  background: var(--ide-border);
}

.tab-btn.tab-active,
.dark-mode .tab-btn.tab-active {
  color: #e6edf3;
  background: #000;
  border-color: var(--ide-border);
  z-index: 1;
}

.tab-btn.tab-active::before {
  background: var(--ide-accent);
}

/* ─── Inline SVG icon helper ──────────────────────────────────── */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  pointer-events: none;
  line-height: 0;
}

.icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Tint icons to match their context */
.tab-btn .icon svg path {
  fill: currentColor;
}

.btn-clr .icon svg path {
  fill: #f87171;
}

.run-btn .icon svg path {
  fill: #fff;
}

.reset-btn .icon svg path {
  fill: var(--ide-dim);
}

.prog-label .icon svg path {
  fill: var(--ide-dim);
}

.tab-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.byte-grid {
  flex: 1;
  overflow: auto;
  padding: 0.4rem;
  background: #000;
   font-size: 12px;
   line-height: 1.7;
  -webkit-overflow-scrolling: touch;
}

.byte-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 1px;
  white-space: nowrap;
}

.row-addr {
  color: var(--ide-dim);
  width: 4ch;
  flex-shrink: 0;
  margin-right: 8px;
  user-select: none;
}

.byte-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2ch;
  border-radius: 2px;
  color: var(--ide-text);
  margin-right: 1px;
  cursor: pointer;
}

.col-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2ch;
  margin-right: 1px;
  color: var(--ide-dim);
  user-select: none;
}

.col-header-row {
  margin-bottom: 3px;
  border-bottom: 1px solid var(--ide-border);
  padding-bottom: 2px;
}

.byte-cell.byte-cursor {
  background: var(--ide-cursor);
  color: #fff;
}

/* ─── Edit main (grid + inspector side-by-side) ────────────── */
.edit-main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.edit-main > .byte-grid {
  flex: 1;
  min-width: 0;
}

/* ─── Byte inspector sidebar ──────────────────────────────── */
.byte-inspector {
  flex-shrink: 0;
  width: 10rem;
  overflow-y: auto;
  background: var(--ide-bg);
  border-left: 1px solid var(--ide-border);
  padding: 0.4rem 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.insp-title {
  font-size: 0.6rem;
  color: var(--ide-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 0.25rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--ide-border);
}

.insp-empty {
  color: var(--ide-dim);
  font-style: italic;
  font-size: 0.7rem;
  padding-top: 0.15rem;
}

.insp-addr {
  color: var(--ide-dim);
  font-size: 0.6rem;
  letter-spacing: 0.03em;
}

.insp-hex {
  font-size: 1.15rem;
  font-weight: bold;
  color: #e6edf3;
  line-height: 1.3;
}

.insp-secondaries {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding-top: 0.15rem;
}

.insp-secondary {
  color: var(--ide-dim);
  font-size: 0.62rem;
  line-height: 1.35;
}

.insp-secondary.insp-ascii {
  color: #fde68a;
}

.insp-sep {
  border: none;
  border-top: 1px solid var(--ide-border);
  margin: 0.35rem 0;
}

.insp-badge {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.35rem;
  border-radius: 3px;
  line-height: 1;
}

.insp-badge-op {
  background: #065f46;
  color: #86efac;
}

.insp-badge-lit {
  background: #78350f;
  color: #fde68a;
}

.insp-inst-name {
  font-size: 0.95rem;
  font-weight: bold;
  color: #86efac;
  line-height: 1.3;
  padding: 0.2rem 0 0.1rem;
}

.insp-flags {
  display: flex;
  gap: 0.2rem;
  padding-bottom: 0.15rem;
  min-height: 1.3rem;
}

.insp-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  background: #1d1830;
  color: #a78bfa;
  border: 1px solid var(--ide-border);
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: bold;
  line-height: 1;
}

.insp-effect {
  color: var(--ide-dim);
  font-size: 0.62rem;
  line-height: 1.35;
  padding: 0.1rem 0;
}

.insp-note {
  color: var(--ide-dim);
  font-size: 0.62rem;
  line-height: 1.4;
  padding-top: 0.1rem;
}

/* On narrow screens: compact horizontal strip below the grid */
@media (max-width: 540px) {
  .edit-main {
    flex-direction: column;
  }

  .byte-inspector {
    width: 100%;
    height: 3.5rem;
    border-left: none;
    border-top: 1px solid var(--ide-border);
    flex-shrink: 0;
    overflow: hidden;
    padding: 0.25rem 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.5rem;
  }

  .insp-title {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
    margin-right: 0.15rem;
  }

  .insp-addr {
    font-size: 0.6rem;
  }

  .insp-hex {
    font-size: 0.8rem;
  }

  .insp-secondaries {
    flex-direction: row;
    gap: 0.5rem;
    padding-top: 0;
  }

  .insp-sep {
    display: none;
  }

  .insp-badge {
    font-size: 0.55rem;
    padding: 0.1rem 0.3rem;
  }

  .insp-inst-name {
    font-size: 0.75rem;
    padding: 0;
  }

  .insp-flags {
    gap: 0.15rem;
    padding-bottom: 0;
  }

  .insp-flag {
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.6rem;
  }

  .insp-effect {
    padding: 0;
  }

  .insp-note {
    padding-top: 0;
  }
}

.control-pad {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.5rem;
  background: var(--ide-surface);
  border-top: 1px solid var(--ide-border);
  border-bottom: 1px solid var(--ide-border);
}

.ctrl-arrows {
  display: flex;
  align-items: center;
  gap: 3px;
}

.ctrl-ud {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ctrl-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.ctrl-btn {
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  background: var(--ide-key-bg);
  border: 1px solid var(--ide-border);
  border-radius: 5px;
  color: var(--ide-text);
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0;
  height: auto;
  width: 50px;
  line-height: 1;
}

.ctrl-btn:active,
.dark-mode .ctrl-btn:active {
  background: var(--ide-key-act);
  transform: scale(0.93);
}

.btn-clr {
  color: #f87171;
  border-color: #7f1d1d55;
  font-size: 0.78rem;
}


/* ─── Example program selector ────────────────────────────────── */
.prog-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.4rem;
  background: var(--ide-surface);
  border-bottom: 1px solid var(--ide-border);
}

.prog-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--ide-dim);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: 0.03em;
}

.prog-select {
  flex: 1;
  background: var(--ide-key-bg);
  border: 1px solid var(--ide-border);
  border-radius: 4px;
  color: var(--ide-dim);
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0 0.5rem;
  height: calc(var(--touch-target) * 0.75);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.prog-select:focus {
  border-color: var(--ide-accent);
  outline: none;
}

.prog-select option {
  background: var(--ide-surface);
  color: var(--ide-text);
}

/* ─── Import / Export buttons ─────────────────────────────────── */
.prog-io {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.prog-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--ide-key-bg);
  border: 1px solid var(--ide-border);
  border-radius: 4px;
  color: var(--ide-dim);
  font-family: inherit;
  font-size: 0.7rem;
  padding: 0 0.5rem;
  height: calc(var(--touch-target) * 0.75);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  transition: color 0.12s, border-color 0.12s;
}

.prog-btn:hover,
.dark-mode .prog-btn:hover {
  color: var(--ide-text);
  border-color: var(--ide-accent);
}

.prog-btn:active,
.dark-mode .prog-btn:active {
  background: var(--ide-key-act);
  transform: scale(0.95);
}

.prog-btn .icon svg path {
  fill: currentColor;
}

.keypad {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0.3rem 0.3rem;
  padding-bottom: calc(0.3rem + var(--safe-area-bottom));
  background: var(--ide-surface);
}

.kp-row {
  display: flex;
  gap: 3px;
}

.kp-section {
  display: flex;
  gap: 3px;
}

.kp-hex {
  flex: 4;
}

.kp-ops {
  flex: 4.2;
}

.kp-mode {
  flex: 1;
}

.kp-btn {
  flex: 1;
  min-height: 2.85rem;
  border: 1px solid var(--ide-border);
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1px;
  line-height: 1;
  font-size: 1rem;
  height: auto;
}

.kp-btn:active {
  filter: brightness(1.6);
  transform: scale(0.94);
}

.kp-hex-btn {
  background: var(--ide-key-bg);
  color: #fde68a;
}

.kp-op-btn {
  background: #1a2234;
  color: #86efac;
  letter-spacing: -0.02em;
}

.kp-mode-btn {
  background: #1d1830;
  color: #a78bfa;
  font-weight: bold;
}

.run-pane {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.5rem;
  padding-bottom: calc(0.5rem + var(--safe-area-bottom));
  overflow-y: auto;
  background: #000;
}

.run-section {
  flex-shrink: 0;
}

.run-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.run-btn {
  flex-shrink: 0;
  background: var(--ide-accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: bold;
  padding: 0 0.7rem;
  height: var(--touch-target);
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  line-height: 1;
}

.run-btn:active,
.dark-mode .run-btn:active {
  background: #5b21b6;
  transform: scale(0.97);
}

.step-btn {
  background: #1e40af;
}

.step-btn:active,
.dark-mode .step-btn:active {
  background: #1e3a8a;
}

.reset-btn {
  background: var(--ide-key-bg);
  border: 1px solid var(--ide-border);
  color: var(--ide-dim);
  font-weight: normal;
}

.reset-btn:active,
.dark-mode .reset-btn:active {
  background: var(--ide-key-act);
}

.last-inst {
  flex: 1;
  color: var(--ide-dim);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-inputs {
  flex-shrink: 0;
  display: flex;
  gap: 0.45rem;
}

.run-inputs .run-input {
  flex: 1;
}

.run-input {
  width: 100%;
  background: var(--ide-surface);
  border: 1px solid var(--ide-border);
  border-radius: 5px;
  color: var(--ide-text);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.45rem 0.6rem;
  line-height: 1.4;
  height: auto;
}

.run-input:focus {
  border-color: var(--ide-accent);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.3);
}

.output-area {
  flex: 1;
  min-height: 3rem;
  overflow-y: auto;
  background: #080c12;
  border: 1px solid var(--ide-border);
  border-radius: 5px;
  padding: 0.45rem 0.6rem;
  -webkit-overflow-scrolling: touch;
}

.output-text {
  margin: 0;
  font-family: inherit;
  font-size: 0.82rem;
  color: #4ade80;
  white-space: pre-wrap;
  word-break: break-all;
}

.output-placeholder {
  color: var(--ide-dim);
  font-size: 0.82rem;
  font-style: italic;
}

.error-banner {
  flex-shrink: 0;
  background: #450a0a;
  border: 1px solid #7f1d1d;
  border-radius: 5px;
  color: #fca5a5;
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
}

.reg-grid {
  flex-shrink: 0;
  border: 1px solid var(--ide-border);
  border-radius: 5px;
  overflow: hidden;
  background: var(--ide-surface);
}

.reg-row {
  display: flex;
}

.reg-row+.reg-row {
  border-top: 1px solid var(--ide-border);
}

.reg {
  flex: 1;
  text-align: center;
  padding: 0.35rem 0;
  font-size: 0.75rem;
  color: var(--ide-text);
}

.reg+.reg {
  border-left: 1px solid var(--ide-border);
}

/* ─── Stack inspector ──────────────────────────────────────────── */
.stack-inspector {
  flex-shrink: 0;
  border: 1px solid var(--ide-border);
  border-radius: 5px;
  overflow: hidden;
  background: var(--ide-surface);
}

.stack-header {
  font-size: 0.65rem;
  color: var(--ide-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-bottom: 1px solid var(--ide-border);
  background: var(--ide-bg);
}

.stack-row {
  display: flex;
  align-items: center;
  padding: 0.3rem 0.5rem;
  gap: 0.4rem;
}

.stack-row+.stack-row {
  border-top: 1px solid var(--ide-border);
}

.stack-label {
  font-size: 0.7rem;
  color: var(--ide-dim);
  width: 1ch;
  flex-shrink: 0;
}

.stack-cells {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.stack-cell {
  font-size: 0.72rem;
  color: var(--ide-text);
  background: var(--ide-key-bg);
  border: 1px solid var(--ide-border);
  border-radius: 3px;
  padding: 0.15rem 0.3rem;
  line-height: 1;
}

.stack-cell.stack-top {
  color: #fff;
  background: var(--ide-accent);
  border-color: var(--ide-accent);
}

.stack-empty {
  font-size: 0.72rem;
  color: var(--ide-dim);
  font-style: italic;
}

/* ─── Help tab ─────────────────────────────────────────────────── */
.help-pane {
  overflow: hidden;
}

.help-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem 1rem;
  padding-bottom: calc(1.2rem + var(--safe-area-bottom));
  background: #000;
  -webkit-overflow-scrolling: touch;
}

.help-h1 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: bold;
  color: #e6edf3;
  letter-spacing: 0.02em;
}

.help-intro {
  margin: 0 0 1rem;
  color: var(--ide-dim);
  font-size: 0.78rem;
  line-height: 1.5;
}

.help-section {
  margin-bottom: 1rem;
}

.help-h2 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: bold;
  color: var(--ide-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--ide-border);
  padding-bottom: 0.2rem;
}

.help-h3 {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--ide-text);
}

.help-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--ide-text);
}

.help-list li {
  margin-bottom: 0.25rem;
}

.help-list li strong {
  color: #e6edf3;
}

.help-section > p {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--ide-text);
}

.help-code {
  background: var(--ide-key-bg);
  border: 1px solid var(--ide-border);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
  font-family: inherit;
  font-size: 0.72rem;
  color: #fde68a;
  white-space: nowrap;
}

/* ─── Help table ───────────────────────────────────────────────── */
.help-table-wrap {
  margin-bottom: 0.35rem;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  line-height: 1.4;
}

.help-table th {
  text-align: left;
  color: var(--ide-dim);
  font-weight: normal;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid var(--ide-border);
  white-space: nowrap;
}

.help-table td {
  padding: 0.2rem 0.4rem;
  color: var(--ide-text);
  border-bottom: 1px solid #1c2128;
  white-space: normal;
  word-break: break-word;
}

.help-table td:first-child {
  white-space: nowrap;
}

.help-table tr:last-child td {
  border-bottom: none;
}

.help-table tbody tr:hover {
  background: #161b22;
}

/* ─── Instruction card list ────────────────────────────────────── */
.help-inst-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.help-inst {
  background: var(--ide-surface);
  border: 1px solid var(--ide-border);
  border-radius: 4px;
  padding: 0.3rem 0.45rem;
}

.help-inst-head {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.help-inst-name {
  color: #86efac;
  font-size: 0.78rem;
}

.help-inst-stack {
  color: var(--ide-dim);
  font-size: 0.7rem;
  margin-left: auto;
  white-space: nowrap;
}

.help-inst-desc {
  color: var(--ide-text);
  font-size: 0.7rem;
  line-height: 1.5;
  margin-top: 0.15rem;
  opacity: 0.85;
}

/* ─── Mode flag grid ───────────────────────────────────────────── */
.help-mode-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 0.35rem;
}

.help-mode-item {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ide-text);
  padding: 0.2rem 0.4rem;
  background: var(--ide-surface);
  border: 1px solid var(--ide-border);
  border-radius: 3px;
}

/* ─── Help examples ────────────────────────────────────────────── */
.help-example {
  margin-bottom: 0.5rem;
}

.help-pre {
  margin: 0;
  background: #080c12;
  border: 1px solid var(--ide-border);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-family: inherit;
  font-size: 0.7rem;
  line-height: 1.5;
  color: #86efac;
  white-space: pre-wrap;
  word-break: break-all;
}

.help-note {
  margin: 0.2rem 0 0;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--ide-dim);
  font-style: italic;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--ide-border);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: #50575f;
}

@media (orientation: portrait) and (max-width: 430px) {
  :root {
    --touch-target: 2.4rem;
  }

  .ide-header {
    height: 2.4rem;
  }

  .kp-btn {
    min-height: 2.85rem;
  }
}

@media (max-height: 680px) {
  .kp-btn {
    min-height: 2.65rem;
  }
}

@media (max-height: 580px) {
  :root {
    --touch-target: 2.4rem;
  }

  .kp-btn {
    min-height: 2.5rem;
  }

  .kp-op-btn {
    font-size: 0.65rem;
  }

  .keypad {
    gap: 2px;
    padding: 0.2rem 0.25rem;
  }

  .ide-header {
    height: 2.3rem;
  }

  .control-pad {
    padding: 0.2rem 0.4rem;
  }

  .run-pane {
    gap: 0.35rem;
    padding: 0.4rem;
  }
}
