/* BAWSAQ: late-2000s stock portal. System fonts only (Verdana, Tahoma, Arial), glossy bars, zebra tables. */
:root {
  --navy: #14304f;
  --link: #1a4f8b;
  --frame: #8fa3b8;
  --line: #e1e7ee;
  --zebra: #f2f6fa;
  --text: #1b2533;
  --muted: #5d6b7a;
  --up: #007a1f;
  --down: #c80000;
  --gold: #f0a500;
  --ui: Verdana, Geneva, Tahoma, sans-serif;
  --head: Arial, Helvetica, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 11px/1.45 var(--ui);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 2px, transparent 2px 6px),
    linear-gradient(#6f89a5, #b8c6d4 420px, #c9d4df) fixed;
  background-color: #c9d4df;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 1px dotted #000; outline-offset: 1px; }
.up { color: var(--up); }
.down { color: var(--down); }

/* faint CRT scanlines over everything */
.scan {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.045) 0 1px, transparent 1px 3px);
}

.page {
  max-width: 1120px;
  margin: 16px auto 24px;
  background: #fff;
  border: 1px solid #5f7790;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35), 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* generic glossy button */
.btn {
  padding: 4px 10px;
  border: 1px solid #6d7f92;
  border-radius: 3px;
  background: linear-gradient(#ffffff, #e9edf2 50%, #d6dee7 51%, #e9eef3);
  box-shadow: inset 0 1px 0 #fff;
  color: #1b2b3b;
  font: bold 11px var(--ui);
  white-space: nowrap;
}
.btn:hover { border-color: #3e5670; }
.btn:active { background: linear-gradient(#d6dee7, #e9eef3); }

/* ---------- top line + masthead ---------- */
.topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 12px;
  background: #0b1d33;
  color: #9fb3c8;
  font-size: 10px;
}
.toplinks a { color: #d8e4f0; margin-left: 14px; }

.bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 14px 13px;
  background: linear-gradient(#2b5280 0%, #1b3b61 50%, #10294a 51%, #173556 100%);
  border-bottom: 1px solid #08182b;
  color: #fff;
}
.brand { display: flex; align-items: flex-end; gap: 8px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.mark { width: 18px; height: 25px; fill: #f2b632; filter: drop-shadow(0 0 3px rgba(242, 182, 50, 0.55)); margin-bottom: 2px; }
.word {
  font: italic 900 32px/1 "Arial Black", "Arial Bold", Arial, sans-serif;
  letter-spacing: -1px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5), 0 0 12px rgba(120, 170, 230, 0.35);
}
.tag { color: #b9cbe0; font-size: 11px; margin: 0 0 3px 2px; white-space: nowrap; }

.composite {
  display: flex;
  flex-direction: column;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.c-name { color: #b9cbe0; font-size: 10px; }
.c-val { font: bold 14px var(--ui); color: #fff; }
.c-val.up { color: #63f07e; }
.c-val.down { color: #ff7366; }
.c-sub { color: #93a9c1; font-size: 10px; }

.search { position: relative; display: flex; gap: 4px; margin-left: auto; }
.search input {
  width: 230px;
  height: 24px;
  padding: 2px 6px;
  border: 1px solid #7f9db9;
  border-top-color: #4d6a87;
  background: #fff;
  color: #000;
  font: 11px Tahoma, var(--ui);
  outline: none;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.18);
}
.search .btn { height: 24px; padding: 0 8px; }
.results {
  position: absolute;
  z-index: 30;
  top: 27px;
  left: 0;
  width: 320px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid #4d6a87;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.3);
  max-height: 340px;
  overflow: auto;
  color: var(--text);
}
.results li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; cursor: pointer; border-bottom: 1px solid var(--line); }
.results li:hover, .results li[aria-selected="true"] { background: #fff3c4; }
.results li.none { color: var(--muted); cursor: default; }
.results li.none:hover { background: none; }

.wallet, .go { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.ph { flex: none; width: 16px; height: 16px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18); }
.go .ph { width: 20px; height: 20px; border-radius: 5px; }
.wallet {
  height: 28px;
  padding: 0 12px;
  border-color: #a06c00;
  background: linear-gradient(#ffe39a, #ffcf4d 50%, #f2ae1c 51%, #ffc94a);
  color: #3a2500;
  font-size: 11px;
}
.wallet:hover { border-color: #6d4a00; }
.wallet.on { font-weight: normal; }

/* ---------- tape ---------- */
.tape { display: block; width: 100%; height: 30px; background: #000; border-bottom: 1px solid #2a2a2a; }
.tape.link { cursor: pointer; }

/* ---------- layout ---------- */
.floor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  grid-template-rows: auto auto 1fr;
  grid-template-areas: "board quote" "portfolio quote" "help quote";
  gap: 12px;
  align-items: start;
  padding: 12px;
  background: #f4f6f8;
}
.floor.has-promo { grid-template-rows: auto auto auto auto 1fr; grid-template-areas: "promo promo" "board quote" "portfolio quote" "help quote"; }
.promo { grid-area: promo; }
.board { grid-area: board; }
.portfolio { grid-area: portfolio; }
.help { grid-area: help; }
.quote { grid-area: quote; position: sticky; top: 8px; display: grid; gap: 12px; min-width: 0; }

.box { background: #fff; border: 1px solid var(--frame); min-width: 0; }
.boxhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 25px;
  margin: 0;
  padding: 0 9px;
  border-bottom: 1px solid #23415f;
  background: linear-gradient(#6a8db3, #46698f 50%, #355a82 51%, #45699a);
  color: #fff;
  font: bold 12px var(--head);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}
.boxbody { padding: 10px; }
.updated { font: normal 10px var(--ui); color: #d6e2ef; text-shadow: none; }

.tabs {
  display: flex;
  gap: 3px;
  padding: 6px 6px 0;
  background: #e4eaf0;
  border-bottom: 1px solid var(--frame);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none;
  position: relative;
  top: 1px;
  padding: 4px 10px 5px;
  border: 1px solid var(--frame);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(#fdfdfd, #d9e2eb);
  color: #1a3d63;
  font: bold 11px var(--ui);
}
.tabs button[aria-selected="true"] { background: #fff; color: #000; padding-bottom: 6px; top: 1px; }

/* ---------- featured listing banner ---------- */
.promo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 84px;
  padding: 14px 16px 12px;
  border: 1px solid #b98700;
  background: linear-gradient(#fff7da, #ffe590 50%, #ffd65e 51%, #ffe8a6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 3px rgba(0, 0, 0, 0.18);
  text-align: left;
  overflow: hidden;
}
.promo-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 1px 7px 2px;
  background: var(--navy);
  color: #ffd76a;
  font: bold 9px var(--ui);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.promo-img { flex: none; width: 54px; height: 54px; border: 2px solid #fff; outline: 1px solid #b98700; background: #fff3c4; object-fit: cover; }
.promo-img:not([src]) { visibility: hidden; width: 0; margin-right: -14px; border: 0; outline: 0; }
.promo-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.promo-text b { color: var(--navy); font: italic 900 21px/1.05 "Arial Black", Arial, sans-serif; letter-spacing: -0.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.promo-text > span { color: #4a3a12; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.promo-live { font-weight: bold; color: #2a2108 !important; }
.promo-btn {
  position: relative;
  flex: none;
  padding: 9px 16px;
  border: 1px solid #1d6e26;
  border-radius: 4px;
  background: linear-gradient(#7fdc86, #3fb54a 50%, #2a9a36 51%, #3ab046);
  color: #fff;
  font: bold 14px var(--head);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  white-space: nowrap;
}
.promo-btn::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: shine 3.2s ease-in-out infinite;
}
@keyframes shine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
.promo:hover .promo-btn { filter: brightness(1.06); }
.promo.soon { cursor: default; }
.promo.soon .promo-btn { border-color: #6d7f92; background: linear-gradient(#ffffff, #e9edf2 50%, #d6dee7 51%, #e9eef3); color: #34495e; text-shadow: none; }
.promo.soon .promo-btn::after { display: none; }

/* ---------- tables ---------- */
table.grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.grid th {
  padding: 5px 8px;
  border-bottom: 1px solid #a8b6c4;
  background: linear-gradient(#f7f9fa, #dfe5eb);
  color: #333;
  font: bold 10px var(--ui);
  text-align: right;
}
.grid th.l, .grid td.l { text-align: left; }
.grid th:first-child { width: 34%; }
.grid td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font: 11px var(--ui);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid tbody tr:nth-child(even) { background: var(--zebra); }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: #fff8d6; }
.grid tbody tr.pinned { background: #fffbea; }
.grid tbody tr.pinned td { border-bottom-color: #f1e2b0; }
.grid tbody tr.pinned .sym b::before { content: "\2605\00a0"; color: #e39b00; }
.grid tbody tr.pinned + tr:not(.pinned) td { border-top: 2px solid #d9c27a; }
.grid tbody tr[aria-selected="true"] { background: #ffe8a3; }
.sym { display: flex; align-items: center; gap: 7px; min-width: 0; }
.sym img {
  flex: none;
  width: 20px;
  height: 20px;
  border: 1px solid #9aa8b6;
  background: #eef2f6;
  object-fit: cover;
}
.sym > div { min-width: 0; }
.sym b { color: var(--link); font: bold 11px var(--ui); }
tr:hover .sym b { text-decoration: underline; }
.sym span { display: block; color: #6b7785; font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
.px sub, td sub { font-size: 0.68em; vertical-align: -0.2em; }
.flash-up { animation: flashUp 1.2s ease-out; }
.flash-down { animation: flashDown 1.2s ease-out; }
@keyframes flashUp { from { background: #b9f5c4; } to { background: transparent; } }
@keyframes flashDown { from { background: #ffc9c4; } to { background: transparent; } }
.empty { color: var(--muted); padding: 14px 10px; margin: 0; }
.portfolio .grid th:first-child { width: 40%; }

/* ---------- quote ---------- */
.back { display: none; }
.q-head { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.q-icon { width: 48px; height: 48px; border: 1px solid #9aa8b6; background: #eef2f6; object-fit: cover; }
.q-title { min-width: 0; }
.q-title h1 { margin: 0; color: #13355a; font: bold 22px/1.1 var(--head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-title p { margin: 2px 0 0; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-links { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 10px; }
.ca { padding: 0; border: 0; background: none; color: var(--link); font: 10px var(--ui); }
.ca:hover { text-decoration: underline; }

.q-price { display: flex; align-items: baseline; gap: 10px; margin: 10px 0 8px; flex-wrap: wrap; }
.q-price .px { font: bold 28px/1 var(--head); color: #000; }
.q-price .chg { font: bold 13px var(--ui); }
.q-price .chg small { color: #666; font: normal 10px var(--ui); margin-left: 4px; }

.chart-wrap { position: relative; border: 1px solid #b6c3d0; background: #fff; }
.chart { display: block; width: 100%; height: 200px; cursor: crosshair; touch-action: pan-y; }
.chart-msg { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); }
.ranges { display: flex; gap: 3px; margin-top: 6px; }
.ranges button {
  padding: 2px 9px;
  border: 1px solid #8a9bad;
  border-radius: 3px;
  background: linear-gradient(#fff, #dfe6ed);
  color: #1a3d63;
  font: bold 10px var(--ui);
}
.ranges button[aria-pressed="true"] { background: linear-gradient(#36597f, #4a6f98); border-color: #23415f; color: #fff; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 10px 0 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.stats div { display: flex; justify-content: space-between; gap: 8px; padding: 4px 7px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats div:nth-child(-n + 2) { background: var(--zebra); }
.stats dt { color: #555; }
.stats dd { margin: 0; font-weight: bold; }

/* ---------- order entry ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.seg button {
  height: 28px;
  border: 1px solid #8a9bad;
  border-radius: 3px;
  background: linear-gradient(#fff, #e3e9ef 50%, #d5dde6 51%, #e6ecf1);
  color: #34495e;
  font: bold 12px var(--head);
}
.seg button[data-side="buy"][aria-selected="true"] { background: linear-gradient(#7fdc86, #3fb54a 50%, #2a9a36 51%, #3ab046); border-color: #1d6e26; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.seg button[data-side="sell"][aria-selected="true"] { background: linear-gradient(#ff9184, #e2483a 50%, #c9301f 51%, #dd4334); border-color: #8f1a0e; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  margin-top: 8px;
  padding: 0 8px;
  border: 1px solid #7f9db9;
  border-top-color: #4d6a87;
  background: #fff;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.18);
}
.field input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: #000; font: bold 16px var(--ui); }
.field span { color: #555; font-weight: bold; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.presets { display: flex; gap: 3px; flex-wrap: wrap; }
.presets button {
  padding: 2px 7px;
  border: 1px solid #8a9bad;
  border-radius: 3px;
  background: linear-gradient(#fff, #e0e7ee);
  color: #1a3d63;
  font: 10px var(--ui);
}
.presets button:hover { border-color: #3e5670; }
.bal { color: var(--muted); font-size: 10px; }

.qlines { margin: 10px 0; border-top: 1px dotted #b6c3d0; padding-top: 6px; }
.qlines div { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.qlines dt { color: #555; }
.qlines dd { margin: 0; font-weight: bold; text-align: right; }
#slip { padding: 0; border: 0; background: none; color: var(--link); font: bold 11px var(--ui); text-decoration: underline; }

.go {
  width: 100%;
  height: 36px;
  border: 1px solid #a06c00;
  border-radius: 4px;
  background: linear-gradient(#ffe39a, #ffcf4d 50%, #f2ae1c 51%, #ffc94a);
  color: #3a2500;
  font: bold 14px var(--head);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.2);
}
.go.buy { background: linear-gradient(#7fdc86, #3fb54a 50%, #2a9a36 51%, #3ab046); border-color: #1d6e26; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.go.sell { background: linear-gradient(#ff9184, #e2483a 50%, #c9301f 51%, #dd4334); border-color: #8f1a0e; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.go:disabled { filter: grayscale(0.85); opacity: 0.55; }
.status { min-height: 16px; margin: 8px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.status.err { color: var(--down); }
.status.ok { color: var(--up); font-weight: bold; }

.help p { margin: 0 0 6px; }
.help p:last-child { margin: 0; }

.foot { padding: 10px 14px 14px; border-top: 1px solid #c3ced9; background: #e9eef3; }
.foot p { margin: 0; color: #6b7c8d; font-size: 10px; text-align: center; }

/* ---------- narrow ---------- */
@media (max-width: 1000px) {
  .tag { display: none; }
  .search input { width: 170px; }
  .floor { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 900px) {
  body { font-size: 12px; }
  .page { margin: 0; border: 0; box-shadow: none; }
  .bar { flex-wrap: wrap; gap: 10px 12px; padding: 10px 12px; }
  .word { font-size: 26px; }
  .composite { order: 2; }
  .wallet { order: 3; margin-left: auto; }
  .search { order: 4; flex-basis: 100%; margin: 0; }
  .search input { flex: 1; width: auto; height: 30px; font-size: 14px; }
  .search .btn { height: 30px; }
  .results { width: 100%; }
  .floor { grid-template-columns: minmax(0, 1fr); grid-template-areas: "board" "portfolio" "help"; padding: 8px; gap: 8px; }
  .floor.has-promo { grid-template-rows: none; grid-template-areas: "promo" "board" "portfolio" "help"; }
  .promo { flex-wrap: wrap; gap: 10px 12px; padding: 16px 12px 12px; }
  .promo-text b { font-size: 18px; }
  .promo-btn { flex-basis: 100%; text-align: center; }
  .hide-s { display: none; }
  .grid th:first-child { width: 42%; }
  .grid th { padding: 5px 4px; }
  .grid td { padding: 6px 4px; font-size: 11px; text-overflow: clip; }
  .grid th.l, .grid td.l { padding-left: 6px; }
  .grid th:last-child, .grid td:last-child { padding-right: 6px; }
  .sym img { width: 18px; height: 18px; }
  .quote {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: block;
    overflow-y: auto;
    background: #f4f6f8;
    padding: 8px 8px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.3s;
  }
  .quote .box + .box { margin-top: 8px; }
  .quote.open { transform: none; visibility: visible; transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .back { display: inline-block; margin: 0 0 8px; }
  .field input { font-size: 18px; }
  body.sheet { overflow: hidden; }
}
@media (max-width: 520px) {
  #clock { display: none; }
  .topline { justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  .promo-btn::after { animation: none; display: none; }
  .quote, .quote.open { transition: none; }
  .flash-up, .flash-down { animation: none; }
}
