/* Day Tradle app — always dark, Clear Sans, Wordle-ish tiles (see design/canvas.html) */
:root {
  --bg: #121213; --panel: #1a1a1b; --line: #3a3a3c; --line2: #565758; --text: #f8f8f8; --muted: #818384;
  --green: #538d4e; --yellow: #b59f3b; --red: #c9483f; --up: #6aaa64; --down: #e0645c;
  --gold: #c9a227; --silver: #9ea3a8; --bronze: #a8672f; --liberty: #4e9f8f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .even { color: var(--yellow); }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 30; height: 64px; background: var(--bg); border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr minmax(320px, 640px) 1fr; align-items: center; gap: 16px; padding: 0 18px; }
.logo { font-weight: 700; font-size: 30px; letter-spacing: .02em; white-space: nowrap; background: none; border: 0; padding: 0; justify-self: start; }
.mid { display: flex; gap: 8px; align-items: center; position: relative; }
.catbtn { height: 42px; display: flex; align-items: center; gap: 7px; padding: 0 13px 0 10px; border: 2px solid var(--line); border-radius: 6px;
  background: none; font-weight: 700; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; flex: none; }
.catbtn svg, .search svg, .ib svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.catbtn.on { background: var(--line); border-color: var(--line); }
.search { flex: 1; display: flex; align-items: center; gap: 10px; height: 42px; border: 2px solid var(--line); border-radius: 6px; padding: 0 12px; color: var(--muted); }
.search:focus-within { border-color: var(--line2); color: var(--text); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 15px; }
.search input::placeholder { color: var(--muted); }
.right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.ind { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.ind small { font-size: 10px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.ind b { font-size: 16px; }
.ib { width: 40px; height: 40px; border-radius: 6px; display: grid; place-items: center; background: none; border: 0; }
.ib svg { width: 24px; height: 24px; }
.ib:hover, .ib.on { background: #2a2a2c; }
.badge { min-width: 46px; height: 30px; padding: 0 9px; border-radius: 5px; display: inline-grid; place-items: center; font-weight: 700; font-size: 14px;
  color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.35); border: 0; }
.badge.g1 { background: var(--gold); } .badge.g2 { background: var(--silver); } .badge.g3 { background: var(--bronze); } .badge.gx { background: var(--liberty); }

/* clock strip (simulation controls live in Settings) */
.strip { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 34px 0; font-size: 12px; color: var(--muted);
  letter-spacing: .05em; text-transform: uppercase; font-weight: 700; }
.strip .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--up); margin-right: 6px; vertical-align: 1px; }
.strip .dot.off { background: var(--muted); }

/* pages */
main { min-height: calc(100vh - 64px); }
.page { padding: 18px 34px 40px; max-width: 1400px; margin: 0 auto; }
.h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.h h2 { font-size: 15px; letter-spacing: .08em; text-transform: uppercase; margin: 0; }
.h span { font-size: 13px; color: var(--muted); }
.sumrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.sum { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.sum small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.sum b { font-size: 24px; }

/* tiles */
.grid6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.tile { aspect-ratio: 1; border: 2px solid var(--line); display: flex; flex-direction: column; align-items: stretch; padding: 8px 7px 7px;
  background: var(--bg); text-align: center; text-decoration: none; position: relative; min-width: 0; }
button.tile { font: inherit; }
.tile { cursor: pointer; }
.tile:hover { border-color: var(--line2); }
.tile-close { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); box-shadow: 0 4px 14px rgba(0,0,0,.5); height: 28px; padding: 0 12px; border: 0; border-radius: 4px;
  background: var(--text); color: var(--bg); font-size: 12px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; opacity: 0; transition: opacity .12s; }
.tile:hover .tile-close, .tile:focus-within .tile-close { opacity: 1; }
@media (hover: none) { .tile-close { opacity: .92; position: static; transform: none; margin: 4px auto 0; height: 26px; } }
.tile-close:disabled { opacity: .5 !important; }
.news { list-style: none; padding: 0; margin: 0; }
.news li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid #262628; font-size: 14px; align-items: baseline; }
.news li time { color: var(--muted); font-size: 12px; min-width: 64px; font-variant-numeric: tabular-nums; }
.news li a { text-decoration: none; font-weight: 700; margin-right: 6px; }
.lbtabs { display: flex; gap: 4px; justify-content: center; margin-bottom: 10px; }
.lbtabs button { padding: 5px 12px; border-radius: 4px; border: 1px solid var(--line); background: none; font-size: 13px; font-weight: 700; }
.lbtabs button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.ktag { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 5px; border-radius: 3px; margin-right: 6px; vertical-align: 1px; }
.ktag.k1 { background: var(--green); color: #fff; } .ktag.k2 { background: var(--line); color: #d0d1d4; } .ktag.k3 { background: var(--yellow); color: #121213; }
.fire { color: #ff9f43; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.about { color: #c9cace; font-size: 14px; line-height: 1.5; margin: 14px 0 0; }
.tile .sym { font-weight: 700; font-size: 20px; letter-spacing: .06em; line-height: 1; }
.tile canvas { flex: 1; width: 100%; min-height: 0; display: block; margin: 5px 0 2px; }
.tile .chg { font-size: 13px; font-weight: 700; }
.tile .sub { font-size: 11px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.o-up { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.tile.o-even { border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); }
.tile.o-down { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.tile.ghost { border-style: dashed; color: var(--muted); justify-content: center; align-items: center; font-size: 13px; background: none; }
.tile.pending { opacity: .45; border-style: dashed; }
.tile.pending:hover { opacity: .7; }
.tag-pending { color: var(--bg); background: var(--muted); padding: 0 5px; border-radius: 3px; font-size: 10px; letter-spacing: .04em; font-weight: 700; }
.tag-short { color: #fff; background: var(--red); padding: 0 5px; border-radius: 3px; font-size: 10px; letter-spacing: .06em; font-weight: 700; }
.small .tile .sym { font-size: 17px; }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

/* search popup */
.pop[hidden], [hidden] { display: none !important; }
.pop { position: absolute; left: 50%; transform: translateX(-50%); top: 52px; width: min(1060px, calc(100vw - 32px)); max-height: calc(100vh - 90px);
  background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.6);
  display: grid; grid-template-columns: 210px 1fr; overflow: hidden; z-index: 40; }
.rail { border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.rail .sec { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.rail button { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 5px; font-size: 14px; background: none; border: 0; text-align: left; }
.rail button span { color: var(--muted); font-size: 12px; }
.rail button:hover { background: #242426; }
.rail button.on { background: #2c2c2e; box-shadow: inset 3px 0 0 var(--green); }
.popmain { padding: 14px 16px 16px; overflow: auto; }
.popmain .grid6 { gap: 10px; }

/* catalog */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 34px; border-bottom: 1px solid var(--line); background: #161617; }
.field { height: 38px; border: 2px solid var(--line); border-radius: 6px; display: flex; align-items: center; padding: 0 10px; gap: 8px; color: var(--muted); background: none; }
.field input, .field select { background: none; border: 0; outline: 0; color: var(--text); }
.field select option { background: var(--panel); }
.chip { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); background: none; font-size: 13px; color: #d0d1d4; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 700; }
.seg2 { display: flex; border: 2px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg2 button { padding: 6px 11px; background: none; border: 0; }
.seg2 button.on { background: var(--line); font-weight: 700; }
.more { display: block; margin: 20px auto 0; height: 42px; padding: 0 22px; border: 2px solid var(--line); border-radius: 6px; background: none; font-weight: 700; }

/* stock page */
.sp { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 26px; }
.letters { display: flex; gap: 6px; }
.letters i { width: 52px; height: 52px; border: 2px solid var(--line2); display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 28px; color: #fff; }
.letters.up i { background: var(--green); border-color: var(--green); } .letters.down i { background: var(--red); border-color: var(--red); }
.price { font-size: 40px; font-weight: 700; letter-spacing: -.02em; }
.tabs { display: flex; gap: 6px; margin: 16px 0 8px; }
.tabs button { padding: 6px 12px; border-radius: 5px; border: 1px solid var(--line); background: none; font-size: 13px; font-weight: 700; }
.tabs button.on { background: var(--text); color: var(--bg); }
.tabs button:disabled { opacity: .4; cursor: default; }
.chartbox { border: 1px solid var(--line); border-radius: 6px; padding: 10px; height: 320px; }
.chartbox canvas { width: 100%; height: 100%; display: block; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 14px; border: 1px solid var(--line); border-radius: 6px; }
.facts div { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts div:nth-child(4n) { border-right: 0; } .facts div:nth-last-child(-n+4) { border-bottom: 0; }
.facts small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.facts b { font-size: 15px; }
.trade { border: 1px solid var(--line); border-radius: 8px; padding: 18px; align-self: start; position: sticky; top: 84px; }
.trade.short { border-color: #6b3330; }
.trade h3 { margin: 0 0 12px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.money { height: 56px; border: 2px solid var(--line2); border-radius: 6px; display: flex; align-items: center; padding: 0 14px; font-size: 28px; font-weight: 700; }
.money input { width: 100%; background: none; border: 0; outline: 0; font-weight: 700; }
.quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0; }
.quick button { height: 36px; background: #2c2c2e; border: 0; border-radius: 4px; font-size: 13px; font-weight: 700; }
.bs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.bs button { height: 50px; border: 0; border-radius: 4px; font-weight: 700; font-size: 16px; letter-spacing: .06em; text-transform: uppercase; color: #fff; }
.bs .buy { background: var(--green); } .bs .sell { background: #5a5b5e; } .bs .shortbtn { background: var(--red); }
.bs button:disabled { opacity: .35; cursor: default; }
.kv { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 6px 0; border-bottom: 1px solid #262628; }
.kv b { color: var(--text); }
.fine { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.45; }
.linkbtn { display: block; margin: 12px auto 0; border: 1px solid var(--line2); border-radius: 14px; padding: 5px 12px; background: none; font-size: 12px; }
.msg { min-height: 18px; font-size: 13px; margin-top: 8px; }
.orders { margin-top: 10px; font-size: 12px; }
.orders div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); }

/* popovers & modals */
.popover { position: absolute; right: 16px; top: 58px; width: 400px; max-height: calc(100vh - 90px); overflow: auto; background: var(--panel);
  border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.6); padding: 14px 16px; z-index: 40; }
.popover h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.lbr { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #262628; font-size: 14px; }
.lbr .rk { color: var(--muted); text-align: center; }
.lbr.me { background: #1d2a1c; margin: 0 -16px; padding: 6px 16px; }
.bot { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-left: 6px; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #262628; font-size: 14px; }
.toggle select, .toggle input[type=text] { background: #2c2c2e; border: 0; border-radius: 4px; padding: 6px 8px; max-width: 170px; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { background: var(--bg); border: 1px solid #2a2a2c; box-shadow: 0 4px 23px rgba(0,0,0,.6); border-radius: 8px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow: auto; padding: 18px 22px 24px; position: relative; text-align: center; }
.modal h2 { font-size: 16px; letter-spacing: .08em; text-transform: uppercase; margin: 6px 0 12px; }
.modal p, .modal li { font-size: 14px; line-height: 1.5; text-align: left; }
.modal .close { position: absolute; right: 8px; top: 8px; width: 36px; height: 36px; background: none; border: 0; font-size: 22px; }
.big { font-size: 44px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0; }
.squares { font-size: 22px; letter-spacing: 2px; margin: 10px 0; }
.share { background: var(--green); border: 0; border-radius: 4px; color: #fff; font-weight: 700; font-size: 17px; text-transform: uppercase; padding: 13px 22px; margin-top: 10px; }
.toasts { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); font-weight: 700; font-size: 14px; padding: 11px 14px; border-radius: 4px; transition: opacity .3s; max-width: 90vw; }

@media (max-width: 1100px) {
  .top { grid-template-columns: auto minmax(0, 1fr) auto; }
  .logo { font-size: 22px; }
  .grid6 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sp { grid-template-columns: 1fr; }
  .trade { position: static; }
}
@media (max-width: 720px) {
  .top { grid-template-columns: 1fr auto; height: auto; padding: 10px 12px; row-gap: 10px; }
  .mid { grid-column: 1 / -1; order: 3; }
  .right .ind:nth-of-type(2) { display: none; }
  .grid6 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .page, .filters, .strip { padding-left: 12px; padding-right: 12px; }
  .sumrow { grid-template-columns: repeat(2, 1fr); }
  .pop { grid-template-columns: 1fr; top: 50px; }
  .rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail .sec { display: none; }
  .rail button { white-space: nowrap; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .facts div { border-right: 1px solid var(--line) !important; border-bottom: 1px solid var(--line) !important; }
  .facts div:nth-child(2n) { border-right: 0 !important; }
  .facts div:nth-last-child(-n+2) { border-bottom: 0 !important; }
  .popover { left: 8px; right: 8px; width: auto; }
}
