/* PROTOTYPE overlay: compact retro handheld look, system monospace, high contrast. */
.sm-root {
  --sm-bg: #101317;
  --sm-bg2: #1b2028;
  --sm-fg: #f3efdc;
  --sm-dim: #a9a690;
  --sm-line: #e8e2c8;
  --sm-acc: #ffd23f;
  --sm-gain: #7ee07e;
  --sm-loss: #ff8a78;
  --sm-warn: #ffb347;
  font: 13px/1.35 ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  color: var(--sm-fg);
}
.sm-root [hidden] { display: none !important; }
.sm-root button, .sm-root input { font: inherit; color: inherit; }
.sm-root kbd {
  display: inline-block; padding: 0 4px; border: 1px solid var(--sm-dim); border-radius: 2px;
  font: inherit; font-size: 11px; line-height: 15px; color: var(--sm-acc);
}
.sm-root small { color: var(--sm-dim); font-size: 11px; }

.sm-box {
  pointer-events: auto;
  background: var(--sm-bg);
  border: 2px solid var(--sm-line);
  box-shadow: 4px 4px 0 #000;
  padding: 8px 10px;
}
.sm-root button {
  pointer-events: auto;
  background: var(--sm-bg2); border: 2px solid var(--sm-line); padding: 2px 8px; cursor: pointer;
  box-shadow: 2px 2px 0 #000;
}
.sm-root button:hover:not(:disabled) { background: #2c3440; }
.sm-root button:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: 1px 1px 0 #000; }
.sm-root button:disabled { opacity: 0.45; cursor: not-allowed; }
.sm-root button:focus-visible, .sm-root input:focus-visible { outline: 2px solid var(--sm-acc); outline-offset: 1px; }
.sm-root button[aria-pressed='true'] { background: var(--sm-acc); color: #000; }
.sm-root button[aria-pressed='true'] kbd { color: #000; border-color: #000; }

.sm-gain { color: var(--sm-gain); }
.sm-loss { color: var(--sm-loss); }
.sm-up { color: var(--sm-loss); }    /* buy price up = worse for a buyer; arrow + word carry the meaning */
.sm-down { color: var(--sm-gain); }

/* HUD */
.sm-hud-wrap { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; max-width: 300px; }
.sm-hud { min-width: 250px; }
.sm-hud-row { display: flex; justify-content: space-between; gap: 12px; }
.sm-hud-goods { color: var(--sm-dim); text-align: right; margin-bottom: 2px; }
.sm-k { color: var(--sm-acc); letter-spacing: 0.05em; }
.sm-hud-buttons { display: flex; flex-wrap: wrap; gap: 6px; }

.sm-topcenter {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(560px, 46vw);
}
.sm-tip {
  background: var(--sm-acc); color: #000; border: 2px solid #000; padding: 4px 10px; font-weight: bold;
  box-shadow: 3px 3px 0 #000; text-align: center;
}
.sm-toasts { display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.sm-toast {
  background: var(--sm-bg); border: 2px solid var(--sm-line); padding: 4px 10px; box-shadow: 3px 3px 0 #000;
  animation: sm-in 120ms steps(3);
}
.sm-toast-gain { border-color: var(--sm-gain); color: var(--sm-gain); }
.sm-toast-loss { border-color: var(--sm-loss); color: var(--sm-loss); }
.sm-toast-error { border-color: var(--sm-loss); border-style: dashed; }
@keyframes sm-in { from { transform: translateY(-6px); opacity: 0; } }

.sm-prompt {
  position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%);
  background: #000; color: var(--sm-acc); border: 2px solid var(--sm-acc); padding: 6px 14px;
  font-weight: bold; letter-spacing: 0.05em;
}

.sm-help { position: absolute; left: 10px; bottom: 10px; max-width: 380px; }
.sm-help-title { color: var(--sm-acc); font-weight: bold; }
.sm-help ul { margin: 4px 0; padding-left: 16px; }
.sm-help-note { color: var(--sm-dim); margin-bottom: 6px; }

/* Modals: centred, never full screen, so the map stays visible around them. */
.sm-modal {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(640px, 92vw); max-height: 82vh; overflow: auto; padding: 10px 14px;
}
.sm-notebook { width: min(760px, 92vw); }
.sm-head { display: flex; align-items: baseline; gap: 10px; border-bottom: 2px solid var(--sm-line); padding-bottom: 6px; margin-bottom: 8px; }
.sm-head h2 { margin: 0; font-size: 16px; color: var(--sm-acc); letter-spacing: 0.06em; text-transform: uppercase; }
.sm-sub { color: var(--sm-dim); flex: 1; }
.sm-root h3 { margin: 10px 0 4px; font-size: 13px; color: var(--sm-acc); letter-spacing: 0.06em; }

.sm-table { border-collapse: collapse; width: 100%; }
.sm-table th, .sm-table td { padding: 2px 6px; text-align: right; white-space: nowrap; }
.sm-table th { color: var(--sm-dim); font-weight: normal; border-bottom: 1px solid #444; }
.sm-table th:first-child, .sm-table td:first-child, .sm-table td:nth-child(2) { text-align: left; }
.sm-goods tbody tr { cursor: pointer; }
.sm-goods tbody tr:hover { background: var(--sm-bg2); }
.sm-goods tr.sm-sel { background: #2e2a12; outline: 1px solid var(--sm-acc); }
.sm-goods td:first-child { color: var(--sm-acc); width: 1em; }

.sm-order { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.sm-seg, .sm-qty { display: flex; gap: 4px; align-items: center; }
.sm-qty input {
  width: 4.5em; background: #000; border: 2px solid var(--sm-line); padding: 2px 4px; text-align: right;
}
.sm-preview { background: var(--sm-bg2); padding: 6px 10px; min-height: 7.5em; }
.sm-preview dl, .sm-stats { display: grid; grid-template-columns: max-content 1fr; gap: 1px 14px; margin: 0; }
.sm-preview dt, .sm-stats dt { color: var(--sm-dim); }
.sm-preview dd, .sm-stats dd { margin: 0; }
.sm-preview dl > dt:first-child { color: var(--sm-acc); font-weight: bold; }
.sm-bad { color: var(--sm-loss); }
.sm-msg { min-height: 1.4em; margin: 6px 0; }
.sm-msg-ok { color: var(--sm-gain); }
.sm-msg-error { color: var(--sm-loss); }
.sm-msg-warn { color: #000; background: var(--sm-warn); padding: 4px 8px; font-weight: bold; }
.sm-actions { display: flex; justify-content: flex-end; }
.sm-root .sm-confirm { background: var(--sm-acc); color: #000; font-weight: bold; padding: 4px 12px; }
.sm-root .sm-confirm.sm-warn { background: var(--sm-warn); }
.sm-root .sm-confirm:disabled { background: var(--sm-bg2); color: var(--sm-fg); }
.sm-receipts { margin-top: 8px; color: var(--sm-dim); font-size: 12px; }
.sm-receipts-title { color: var(--sm-acc); }
.sm-keys { margin-top: 8px; color: var(--sm-dim); font-size: 11px; border-top: 1px solid #444; padding-top: 4px; }

.sm-stash td.sm-xfer { text-align: center; }
.sm-xfer span { display: inline-flex; gap: 3px; align-items: center; margin: 0 4px; }
.sm-xfer button { padding: 0 5px; }

.sm-note { margin: 0 0 6px; color: var(--sm-dim); }
.sm-tips { margin: 0; padding-left: 18px; }
.sm-nb-market { margin: 6px 0 8px; }
.sm-nb-mhead { display: flex; gap: 10px; align-items: center; margin-bottom: 2px; }
.sm-nb-mhead b { color: var(--sm-fg); min-width: 7em; }
.sm-nb-mhead button { padding: 0 8px; }
.sm-here { color: var(--sm-acc); }
.sm-stale { color: #000; background: var(--sm-warn); padding: 0 3px; font-weight: bold; }
.sm-is-stale td { color: var(--sm-dim); }
.sm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Inspector: non-modal side panel on the right. */
.sm-inspector {
  position: absolute; top: 10px; right: 10px; bottom: 10px; width: min(680px, 54vw); overflow: auto;
  border-color: #79c0ff; font-size: 12px;
}
.sm-inspector .sm-head h2 { color: #79c0ff; }
.sm-inspector fieldset { border: 1px solid #444; margin: 0 0 6px; padding: 4px 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.sm-inspector legend { color: #79c0ff; }
.sm-inspector input[type='number'] { width: 6em; background: #000; border: 1px solid var(--sm-line); }
.sm-flag { display: block; width: 100%; }
.sm-flag code { color: var(--sm-dim); }
.sm-true tr.sm-group td { border-top: 1px solid #333; }
.sm-spark svg { display: block; }
.sm-spark polyline { fill: none; stroke: #79c0ff; stroke-width: 1; }
