/* The wallet tray, the burn race popover and the HQ card. Loaded after city.css. */

/* ---- the wallet button: address, a live dot, and an unread count ---- */
#btn-signin.connected { display: inline-flex; align-items: center; gap: 8px; font-family: Inter, system-ui, sans-serif; font-size: 13px; position: relative; }
#btn-signin .wdot, .tray .wdot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); flex: none; }
#btn-signin .nb { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; background: var(--green); color: #ffffff; font: 700 11px Inter, sans-serif; font-style: normal; box-shadow: 0 0 0 2px var(--bg); }

/* ---- the tray ---- */
.tray { position: fixed; top: 76px; right: 14px; width: min(380px, calc(100vw - 20px)); max-height: calc(100vh - 92px); display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 24px 60px rgba(39, 39, 42, 0.3); z-index: 25; animation: trayin 0.16s ease; }
@keyframes trayin { from { opacity: 0; transform: translateY(-6px); } }
.tray > header { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.tray .tw { flex: 1; min-width: 0; }
.tray .tw b { display: block; font-size: 13px; font-weight: 600; }
.tray .tw small { color: var(--slate-500); font-size: 11px; }
.tray .tw .hold { font-style: normal; color: var(--green-ink); font-weight: 600; }
.tray .tlink { border: 0; background: none; color: var(--slate-500); font: 600 11px Inter, sans-serif; cursor: pointer; padding: 4px 6px; border-radius: 7px; }
.tray .tlink:hover:not(:disabled) { color: var(--slate-900); background: var(--paper); }
.tray .tlink:disabled { opacity: 0.4; cursor: default; }
.tray .tsub { padding: 10px 14px 4px; font: 700 11px Inter, sans-serif; text-transform: uppercase; letter-spacing: 0.07em; color: var(--slate-500); }
.tray .tlist { list-style: none; margin: 0; padding: 2px 6px 8px; overflow-y: auto; flex: 1; min-height: 60px; scrollbar-width: thin; overscroll-behavior: contain; }
.tray .ti { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 8px; border-radius: 10px; cursor: pointer; position: relative; }
.tray .ti:hover { background: var(--paper); }
.tray .ti.new::before { content: ''; position: absolute; left: 1px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--green); }
.tray .ti-av { position: relative; width: 34px; height: 34px; }
.tray .ti-av img.av { width: 34px; height: 34px; border-radius: 9px; }
.tray .ti-av .k { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--white); background: #8e8e90; }
.tray .ti-av .k.good, .tray .ti-av .k.buy { background: var(--green); }
.tray .ti-av .k.sell { background: var(--red); }
.tray .ti-b { min-width: 0; }
.tray .ti-t { font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray .ti-s { font-size: 11px; color: var(--slate-500); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; }
.tray .ti-s b { font: 600 11px Inter, system-ui, sans-serif; display: inline-flex; align-items: center; gap: 2px; }
.tray .ti-s b.up { color: var(--green-ink); }
.tray .ti-s b.down { color: var(--red-ink); }
.tray .ti-s b.flat { color: var(--slate-700); }
.tray .ti-at { font: 500 11px Inter, system-ui, sans-serif; color: var(--slate-500); align-self: start; padding-top: 2px; }
.tray .te { padding: 22px 14px; color: var(--slate-500); font-size: 13px; text-align: center; line-height: 1.5; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tray > footer { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.tray .tb { display: flex; align-items: center; justify-content: center; text-align: center; height: 34px; padding: 0 8px; border-radius: 10px; border: 0; background: #f4f4f6; box-shadow: inset 0 0 0 1px var(--line); color: var(--slate-900); font: 600 13px Inter, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap; }
.tray .tb:hover { background: #ededef; box-shadow: inset 0 0 0 1px #cbcbcd; }
.tray .tb.out { color: var(--red-ink); }
.tray .tb.out:hover { box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }

/* ---- "Next burn" is a button that opens the race ---- */
button.clock { border: 0; font: inherit; text-align: left; cursor: pointer; }
#btn-race { transition: transform 0.12s, box-shadow 0.12s; }
#btn-race:hover { box-shadow: 0 0 0 3px rgba(39, 39, 42, 0.108); }
#btn-race.open { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35); }
#btn-race small { display: flex; align-items: center; gap: 4px; }
#btn-race .caret { font-style: normal; font-size: 11px; transition: transform 0.15s; }
#btn-race.open .caret { transform: rotate(180deg); }

/* ---- the burn race popover ---- */
#legend.race { position: fixed; right: auto !important; width: 320px; max-height: calc(100vh - 100px) !important; overflow-y: auto; padding: 0 0 8px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 24px 60px rgba(39, 39, 42, 0.3); z-index: 25; animation: trayin 0.16s ease; }
#legend.race > header { display: flex; align-items: center; gap: 8px; padding: 12px 10px 10px 14px; font: 700 11px Inter, sans-serif; text-transform: uppercase; letter-spacing: 0.07em; color: var(--slate-500); }
#legend.race > header b { color: var(--slate-900); }
#legend.race > header .live { width: 7px; height: 7px; border-radius: 50%; background: #ea580c; box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.2); }
#legend.race .rnd { font: 500 11px Inter, system-ui, sans-serif; text-transform: none; letter-spacing: 0; }
#legend.race .x { margin-left: auto; width: 26px; height: 26px; font-size: 16px; }
#legend.race .rhero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 6px; margin: 0 12px; }
#legend.race .rhero > div { background: #f4f4f6; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
#legend.race .rhero small { display: block; font: 700 11px Inter, sans-serif; text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate-500); margin-bottom: 3px; }
#legend.race .rhero b { display: inline-flex; align-items: center; gap: 4px; font: 600 20px Inter, system-ui, sans-serif; color: var(--slate-900); }
#legend.race .rhero em { display: block; font: 500 11px Inter, system-ui, sans-serif; font-style: normal; color: var(--slate-500); margin-top: 1px; }
#legend.race .rbar { height: 4px; margin: 10px 12px 0; border-radius: 999px; background: #e9e9eb; overflow: hidden; }
#legend.race .rbar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #ea580c, #f97316); transition: width 0.5s linear; }
#legend.race .rhow { margin: 10px 14px 4px; font-size: 13px; line-height: 1.5; color: var(--slate-500); }
#legend.race .sub { padding: 12px 14px 6px; font: 700 11px Inter, sans-serif; letter-spacing: 0.07em; }
#legend.race ol, #legend.race ul { list-style: none; margin: 0; padding: 0 8px; counter-reset: r; }
#legend.race li { display: flex; align-items: center; gap: 9px; padding: 7px 6px; border-radius: 9px; cursor: pointer; font-size: 13px; background: none; }
#legend.race li:hover { background: var(--paper); }
#legend.race li.empty { cursor: default; color: var(--slate-500); font-size: 13px; padding: 6px; }
#legend.race li.empty::before { content: none; }
#legend.race .rank li { counter-increment: r; }
#legend.race .rank li:not(.empty)::before { content: counter(r); width: 12px; flex: none; color: var(--slate-500); font: 600 11px Inter, system-ui, sans-serif; }
#legend.race .rank li.lead { background: rgba(251, 146, 60, 0.08); box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.25); }
#legend.race .rank li.lead::before { color: #ea580c; }
#legend.race i.ti { width: 26px; height: 26px; border-radius: 8px; flex: none; background: var(--slate-100) center / cover; display: grid; place-items: center; font-style: normal; color: var(--slate-500); }
#legend.race .rr { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
#legend.race .rr b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#legend.race .rr small { font-size: 11px; color: var(--slate-500); margin-top: -2px; }
#legend.race .rb { display: block; margin: 0; width: 100%; height: 3px; border-radius: 999px; background: #e6e6e8; overflow: hidden; }
#legend.race .rb i { display: block; height: 100%; border-radius: inherit; background: var(--slate-500); }
#legend.race .lead .rb i { background: #ea580c; }
#legend.race .rn { font: 600 11px Inter, system-ui, sans-serif; color: var(--slate-700); white-space: nowrap; }
#legend.race .burns a { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; color: var(--slate-900); font: 600 11px Inter, system-ui, sans-serif; text-decoration: none; }
#legend.race .burns .dim { margin-left: auto; font: 500 11px Inter, system-ui, sans-serif; }
@media (max-width: 900px) { #legend.race:not([hidden]) { display: block; } }

/* ---- HQ: the whole story, no inner scrollbar ---- */
.card .desc.full { max-height: none; overflow: visible; }

/* ---- day / night toggle, bottom right (above the controls hint) ---- */
.daynight { position: fixed; right: 14px; bottom: 54px; z-index: 4; width: 78px; height: 38px; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.9); box-shadow: 0 10px 28px rgba(39, 39, 42, 0.158); cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.daynight .dn-i { position: relative; z-index: 1; width: 38px; height: 36px; display: grid; place-items: center; color: #757577; transition: color 0.3s; }
.daynight .dn-knob { position: absolute; left: 3px; top: 3px; width: 32px; height: 30px; border-radius: 999px; background: #27272a; transition: transform 0.35s cubic-bezier(.3,1.3,.5,1); }
.daynight[data-mode="day"] .dn-sun, .daynight[data-mode="night"] .dn-moon { color: #ffffff; }
.daynight[data-mode="night"] .dn-knob { transform: translateX(38px); }
.daynight:hover { border-color: #cbcbcd; }
@media (max-width: 900px) { .daynight { bottom: 14px; } }

/* ---- the interface at 85%: everything but the 3D view and the labels that
   follow things in it (those position themselves in screen pixels) ---- */
:root { --ui-zoom: 0.75; }   /* the whole UI a quarter smaller (panels, bar, cards, dialogs) */
.bar .daynight { zoom: 1; }  /* (already inside the zoomed bar) */
.bar, .feed, .card, #legend, .modal > .sheet, .tray, .notices, .daynight, .keys, .toast, .clocks.dock, #chip { zoom: var(--ui-zoom); }

/* ---- the top bar: the stats block sits dead centre of the page, search inside it ---- */
.bar { justify-content: space-between; }
.bar > .clocks { position: absolute; left: 50%; transform: translateX(-50%); margin: 0; align-items: center; }
.clocks .search input { width: 210px; height: 40px; box-shadow: none; border: 1px solid var(--line); background: #fbfbfb; }
.clocks .search { margin-right: 4px; }
#t-fees { display: inline-flex; align-items: center; gap: 3px; }

/* scrolling without a visible scrollbar: the feeds, the tray, cards and sheets */
.feed .flist, .feed ul, .tray .tlist, .card, #legend.race, .sheet, .cdd-list, .filters { scrollbar-width: none; -ms-overflow-style: none; }
.feed .flist::-webkit-scrollbar, .feed ul::-webkit-scrollbar, .tray .tlist::-webkit-scrollbar, .card::-webkit-scrollbar, #legend.race::-webkit-scrollbar, .sheet::-webkit-scrollbar, .cdd-list::-webkit-scrollbar, .filters::-webkit-scrollbar { display: none; }

/* feed rows animate from feed.js (slide in from the top, the rest glide down), not the old fade */
.feed li.fi { animation: none; }
.feed .flist { overflow-x: hidden; }

/* ---- trade filters: a panel of their own, to the right of the feeds ---- */
.fpanel.trades { position: relative; overflow: visible; }
.feed .filters { position: absolute; left: calc(100% + 10px); top: 0; margin: 0; width: 340px; max-height: calc(100vh - 110px); overflow-y: auto;
  padding: 14px; gap: 14px; border-radius: var(--r); background: var(--white); border: 1px solid var(--line); box-shadow: 0 14px 36px rgba(39, 39, 42, 0.175); z-index: 6; animation: fin 0.18s cubic-bezier(.22,1,.36,1); }
@keyframes fin { from { opacity: 0; transform: translateX(-8px); } }
.feed .filters::before { content: 'Trade filters'; display: block; font: 700 11px Inter, sans-serif; letter-spacing: 0.07em; text-transform: uppercase; color: var(--slate-900); margin: -2px 0 2px; }
.feed .filters .fwords, .feed .filters .fseg, .feed .filters .fnum, .feed .filters .dd-btn { background: #fbfbfb; border-color: var(--line); }
.feed .filters .fpill { border-color: var(--line); }
.feed .filters .fcheck:hover { background: #f1f1f3; }
.feed .dd-list { background: #f4f4f6 !important; border-color: #d9d9db !important; }
@media (max-width: 900px) { .feed .filters { position: static; width: auto; max-height: 58%; } }

/* zoomed panels: their height limits are in zoomed pixels, so divide by the zoom,
   or the bottom of a long card sits below the screen and can't be scrolled to */
.card { max-height: calc((100vh - 100px) / var(--ui-zoom)) !important; overflow-y: auto; overscroll-behavior: contain; }
.tray { max-height: calc((100vh - 92px) / var(--ui-zoom)); }
#legend.race { max-height: calc((100vh - 100px) / var(--ui-zoom)) !important; }
.modal > .sheet { max-height: calc((100vh - 32px) / var(--ui-zoom)); }
.feed .filters { max-height: calc((100vh - 110px) / var(--ui-zoom)); }
