/* Market board only. Scoped so desk, nav, and trade rules stay untouched. */

@media (min-width: 900px) {
  body.desk-mode #content .desk.market-page {
    width: min(1120px, 100%);
  }
}

.market-page {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #e8eef8;
}

.market-page .mkt-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid #3a5478;
  background: #162440;
  color: #93a4bf;
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.market-page .mkt-pulse i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6d7f99;
  box-shadow: none;
}

.market-page .mkt-pulse.is-on {
  color: #d9ffe9;
  border-color: rgba(18, 196, 139, 0.45);
}

.market-page .mkt-pulse.is-on i {
  background: #12c48b;
  animation: mkt-pulse 1.8s ease-out infinite;
}

.market-page .mkt-tools {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 6px 7px 7px;
  border-radius: 12px;
  border: 1px solid #3a5478;
  background:
    linear-gradient(180deg, rgba(240, 215, 138, 0.06), rgba(240, 215, 138, 0) 42%),
    #162440;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.market-page .mkt-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.market-page .mkt-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.market-page .mkt-search {
  display: block;
  min-width: 0;
}

.market-page .mkt-search input {
  width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #2a4264;
  background: #122440;
  box-shadow: inset 0 1px 0 rgba(240, 215, 138, 0.08);
  color: #f4f8ff;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
}

.market-page .mkt-search input::placeholder {
  color: #7f93ad;
  font-weight: 500;
}

.market-page .mkt-filters::-webkit-scrollbar,
.market-page .mkt-sorts::-webkit-scrollbar {
  display: none;
}

.market-page .mkt-filters,
.market-page .mkt-sorts {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.market-page .mkt-chip,
.market-page .mkt-sort {
  flex: none;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #3a5478;
  background: linear-gradient(180deg, #1c3250 0%, #162440 100%);
  color: #d5e4f8;
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.market-page .mkt-sort {
  flex: 1 1 0;
  border-radius: 7px;
  min-width: 0;
  padding: 0 7px;
}

.market-page .mkt-chip[aria-pressed="true"],
.market-page .mkt-sort[aria-pressed="true"] {
  border-color: rgba(240, 215, 138, 0.85);
  background: linear-gradient(180deg, #f6dc92 0%, #c49234 100%);
  color: #241804;
  box-shadow: inset 0 1px 0 rgba(255, 248, 220, 0.7);
}

.market-page .mkt-chip:focus-visible,
.market-page .mkt-sort:focus-visible,
.market-page .mkt-search input:focus-visible,
.market-page .mkt-row:focus-visible {
  outline: 2px solid #f0d78a;
  outline-offset: 2px;
}

.market-page .mkt-count {
  margin: 0;
  color: #cbb98a;
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.market-page .mkt-sheet {
  display: flex;
  flex-direction: column;
}

.market-page .mkt-cols {
  display: none !important;
}

.market-page .mkt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.market-page .mkt-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto auto;
  grid-template-areas:
    "logo id last move"
    "logo spark stats stats";
  align-items: center;
  gap: 1px 6px;
  margin: 0;
  padding: 7px 10px;
  min-height: 52px;
  border-radius: 8px;
  border: 1px solid #4a6288;
  background: #152848;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  color: #e8eef8;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.market-page .mkt-row:active {
  background: #1a3358;
}

.market-page .mkt-row.is-quiet {
  opacity: 0.78;
}

.market-page .mkt-logo {
  grid-area: logo;
  width: 18px;
  height: 18px;
  align-self: center;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.market-page .mkt-logo svg {
  width: 18px;
  height: 18px;
  display: block;
}

.market-page .mkt-id {
  grid-area: id;
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  overflow: visible;
}

.market-page .mkt-id b,
.market-page .mkt-id small {
  flex: 0 0 auto;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.market-page .mkt-id b {
  color: #f7fbff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.market-page .mkt-id small,
.market-page .mkt-id .mkt-tick {
  color: #8aa0bf;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.market-page .mkt-note {
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 3px;
  border: 1px solid rgba(240, 215, 138, 0.5);
  color: #f0d78a;
  font-style: normal;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-transform: uppercase;
  vertical-align: 1px;
}

.market-page .mkt-note.is-off {
  border-color: rgba(147, 164, 191, 0.45);
  color: #93a4bf;
}

.market-page .mkt-spark {
  grid-area: spark;
  width: 44px;
  height: 10px;
  align-self: center;
  background: linear-gradient(#2a4264, #2a4264) center / 100% 1px no-repeat;
}

.market-page .mkt-spark.is-live {
  background: none;
}

.market-page .mkt-last {
  grid-area: last;
  justify-self: end;
  align-self: center;
}

.market-page .mkt-last b {
  color: #f3ead6;
  font-size: 12px;
  font-weight: 860;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

.market-page .mkt-last b.is-up {
  animation: mkt-up 0.7s ease;
}

.market-page .mkt-last b.is-down {
  animation: mkt-down 0.7s ease;
}

.market-page .mkt-move {
  grid-area: move;
  justify-self: end;
  align-self: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.market-page .mkt-move small {
  display: none;
  color: #8aa0bf;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.market-page .mkt-move small:empty {
  display: none;
}

.market-page .mkt-move-val {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.market-page .mkt-move.up .mkt-move-val {
  color: #0ecb81;
  background: rgba(14, 203, 129, 0.12);
  border: 1px solid rgba(14, 203, 129, 0.38);
}

.market-page .mkt-move.down .mkt-move-val {
  color: #f6465d;
  background: rgba(246, 70, 93, 0.12);
  border: 1px solid rgba(246, 70, 93, 0.38);
}

.market-page .mkt-move.flat .mkt-move-val,
.market-page .mkt-move.na .mkt-move-val {
  color: #d5e0ee;
  background: rgba(147, 164, 191, 0.12);
  border: 1px solid rgba(160, 180, 206, 0.28);
}

.market-page .mkt-dir {
  font-style: normal;
  font-size: 8px;
  line-height: 1;
}

.market-page .mkt-move b {
  font-size: 10px;
  font-weight: 860;
  font-variant-numeric: tabular-nums;
}

.market-page .mkt-stats {
  grid-area: stats;
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.market-page .mkt-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  min-width: 0;
}

.market-page .mkt-stat i {
  display: inline;
  font-style: normal;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.market-page .mkt-stat b {
  display: inline;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-page .mkt-hi i,
.market-page .mkt-hi b {
  color: #0ecb81;
}

.market-page .mkt-lo i,
.market-page .mkt-lo b {
  color: #f6465d;
}

.market-page .mkt-vol i,
.market-page .mkt-vol b {
  color: #38bdf8;
}

.market-page .mkt-turn i,
.market-page .mkt-turn b {
  color: #818cf8;
}

.market-page .mkt-turn {
  display: none;
}

.market-page .mkt-empty {
  margin: 8px 0 0;
  padding: 18px 12px;
  border-radius: 14px;
  border: 1px dashed #2a4264;
  color: #93a4bf;
  text-align: center;
  font-size: 14px;
}

.market-page.is-wide .mkt-sheet {
  border: 1px solid #3a5478;
  border-radius: 14px;
  overflow: hidden;
  padding: 6px;
  background:
    linear-gradient(180deg, rgba(240, 215, 138, 0.05), rgba(240, 215, 138, 0) 80px),
    #162440;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.market-page.is-wide .mkt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.market-page.is-wide .mkt-row {
  padding: 7px 12px;
  min-height: 52px;
}

.market-page.is-wide .mkt-stats {
  gap: 12px;
}

.market-page.is-wide .mkt-turn {
  display: inline-flex;
}

.market-page .mkt-row[hidden],
.market-page.is-wide .mkt-row[hidden],
.market-page .mkt-empty[hidden],
.market-page .mkt-note[hidden] {
  display: none;
}

@keyframes mkt-pulse {
  0% { box-shadow: 0 0 0 0 rgba(18, 196, 139, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(18, 196, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(18, 196, 139, 0); }
}

@keyframes mkt-up {
  0% { color: #0ecb81; }
  100% { color: #f3ead6; }
}

@keyframes mkt-down {
  0% { color: #f6465d; }
  100% { color: #f3ead6; }
}

@media (prefers-reduced-motion: reduce) {
  .market-page .mkt-pulse.is-on i,
  .market-page .mkt-last b.is-up,
  .market-page .mkt-last b.is-down {
    animation: none;
  }
}
