/* ============================================================
   arkstar_os — shell.css
   Hand-built Win98 desktop shell NOT provided by 98.css.
   Reuses tokens.css (:root vars + .bevel-raised / .bevel-sunken).
   Hard rules: no border-radius, no blurred shadows, 1px hard
   borders, pixel-snapped, 11px Pixelated MS Sans Serif for UI,
   monospace only in the terminal.
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #0a0a18; /* letterbox color outside the 16:9 screen */
  color: var(--text-color);
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
  font-size: 11px;
  /* keep the bitmap font crisp */
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  text-rendering: optimizeSpeed;
  user-select: none;
}

/* ============================================================
   Fixed 16:9 retro-LCD — Option B. The whole OS renders on a
   fixed 1280x720 #screen that contain-fits the viewport (scale.js).
   The 16:9 pixel-art is the full-bleed desktop wallpaper, scaled UP
   so pixels read chunky/low-res. No bezel, no room — hard-edged.
   ============================================================ */
:root {
  --screen-w: 1280px; /* 16:9 retro-LCD */
  --screen-h: 720px;
}

/* letterbox host: plain dark bars only show on non-16:9 windows */
#viewport {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0a0a18;
}

/* the fixed virtual screen — full-bleed pixel-art wallpaper, hard-edged */
#screen {
  position: relative;
  width: var(--screen-w);
  height: var(--screen-h);
  overflow: hidden;
  image-rendering: pixelated;
  background: #0a0a18 url("../assets/wallpaper/vocaloid-lofi-medium.png") center
    center / cover no-repeat;
  transform: scale(var(--scale, 1));
  transform-origin: center center;
}

/* ---------- Desktop ---------- */
#desktop {
  position: absolute;
  inset: 0 0 28px 0; /* leave room for the taskbar */
  background: transparent; /* the #screen wallpaper shows through */
  overflow: hidden;
}

#icons {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 2px;
  max-height: calc(var(--screen-h) - 40px);
}

/* Right-side user-curated column — mirror of #icons, pinned TOP-RIGHT.
   Same .desk-icon styling; new entries append vertically downward. */
#icons-right {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap-reverse;
  align-content: flex-end;
  gap: 2px;
  max-height: calc(var(--screen-h) - 40px);
}

/* ---------- Desktop icons ---------- */
.desk-icon {
  width: 76px;
  padding: 4px 2px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: default;
  color: #ffffff;
}

.desk-icon .icon-glyph {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  image-rendering: pixelated;
  background-size: 32px 32px;
  background-repeat: no-repeat;
  background-position: center;
}

.desk-icon .icon-glyph .icon-img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.desk-icon .icon-label {
  margin-top: 3px;
  padding: 1px 2px;
  font-size: 11px;
  line-height: 13px;
  color: #ffffff;
  border: 1px solid transparent;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
  max-width: 74px;
  word-break: break-word;
}

.desk-icon.selected .icon-glyph {
  filter: drop-shadow(0 0 0 var(--selection-navy));
  opacity: 0.85;
}

.desk-icon.selected .icon-label {
  background: var(--selection-navy);
  color: #ffffff;
  border: 1px dotted #ffffff;
  text-shadow: none;
}

/* ---------- Window layer ---------- */
#windows {
  position: absolute;
  inset: 0;
  pointer-events: none; /* children re-enable */
}

#windows .window {
  position: absolute;
  pointer-events: auto;
  min-width: 180px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
}

#windows .window.maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

#windows .window .title-bar {
  cursor: default;
  user-select: none;
}

/* ---------- Resize grips (8-way) ----------
   Thin hit-areas on the window edges/corners; corners overlap the edges
   (8x8/12x12) and win the cursor. Pixel-snapped, no radius, no blur. */
#windows .window .resize-handle {
  position: absolute;
  pointer-events: auto;
  z-index: 5;
}

/* maximized windows aren't resizable — hide the grips */
#windows .window.maximized .resize-handle {
  display: none;
}

.resize-handle.rh-n {
  top: -2px;
  left: 6px;
  right: 6px;
  height: 5px;
  cursor: ns-resize;
}

.resize-handle.rh-s {
  bottom: -2px;
  left: 6px;
  right: 6px;
  height: 5px;
  cursor: ns-resize;
}

.resize-handle.rh-e {
  top: 6px;
  bottom: 6px;
  right: -2px;
  width: 5px;
  cursor: ew-resize;
}

.resize-handle.rh-w {
  top: 6px;
  bottom: 6px;
  left: -2px;
  width: 5px;
  cursor: ew-resize;
}

.resize-handle.rh-ne {
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
}

.resize-handle.rh-sw {
  bottom: -2px;
  left: -2px;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
}

.resize-handle.rh-nw {
  top: -2px;
  left: -2px;
  width: 10px;
  height: 10px;
  cursor: nwse-resize;
}

/* classic Win98 SE grip — a touch larger, with a 2-line diagonal grip */
.resize-handle.rh-se {
  bottom: 0;
  right: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}

.resize-handle.rh-se::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  background-image:
    linear-gradient(
      135deg,
      transparent 0 44%,
      var(--button-shadow) 44% 56%,
      transparent 56% 70%,
      var(--button-shadow) 70% 82%,
      transparent 82%
    );
}

/* active / inactive title-bar gradients (explicit per spec) */
#windows .window .title-bar {
  background: linear-gradient(
    90deg,
    var(--dialog-blue),
    var(--dialog-blue-light)
  );
}

#windows .window .title-bar.inactive {
  background: linear-gradient(
    90deg,
    var(--dialog-gray),
    var(--dialog-gray-light)
  );
}

.title-bar-text {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.title-bar-text .tb-icon {
  font-size: 12px;
  line-height: 1;
}

.title-bar-text .tb-icon-img {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.window-body {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
}

.window-body.pad {
  margin: 8px;
}

/* helpers used inside app bodies */
.app-scroll {
  overflow: auto;
  height: 100%;
}

.muted {
  color: var(--button-shadow);
}

.app-link {
  color: var(--link-blue);
  cursor: pointer;
  text-decoration: underline;
}

.kv-table th {
  text-align: left;
  padding-right: 10px;
  vertical-align: top;
  white-space: nowrap;
  font-weight: bold;
}

.kv-table td {
  vertical-align: top;
}

.explorer {
  display: flex;
  gap: 6px;
  height: 100%;
  margin: 6px;
}

.explorer .tree-pane {
  width: 46%;
  min-width: 150px;
  overflow-y: auto;
}

.explorer .tree-pane ul.tree-view {
  height: 100%;
}

.explorer .detail-pane {
  flex: 1 1 auto;
}

.explorer .detail-pane .sunken-panel {
  height: 100%;
  padding: 8px;
  background: #ffffff;
}

.tree-node {
  cursor: default;
  display: inline-block;
  padding: 0 2px;
}

.tree-node.active {
  background: var(--selection-navy);
  color: #ffffff;
}

.explorer summary.folder-active {
  background: var(--selection-navy);
  color: #ffffff;
}

/* ---------- Projects.exe — per-type icons ---------- */
.type-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.type-icon-img {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  vertical-align: middle;
}

/* ---------- Projects.exe — detail card ---------- */
.detail-card .detail-title {
  font-size: 13px;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-meta {
  margin: 0 0 6px;
}

.detail-meta .dot,
.block-motif .dot {
  margin: 0 2px;
}

.status-glyph {
  font-weight: bold;
}

/* ---------- Projects.exe — Details-list table ---------- */
.details-list {
  margin-top: 4px;
  max-height: 100%;
}

.details-list table {
  width: 100%;
}

.details-list table > thead > tr > th.sortable {
  cursor: pointer;
  user-select: none;
}

.details-list .type-icon-img {
  margin-right: 2px;
}

/* ---------- Projects.exe — facet chips ---------- */
.facet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0 6px;
}

.facet-chip {
  font-size: 11px;
  padding: 1px 5px;
  background: #ffffff;
}

/* ---------- Projects.exe — decorative on-chain Block motif ---------- */
.block-motif {
  font-family: monospace;
  font-size: 11px;
  color: var(--button-shadow);
}

.block-motif .verified {
  color: #008000;
}

/* ---------- Taskbar ---------- */
#taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  background: var(--surface);
  /* raised bevel via tokens recipe */
  box-shadow:
    inset 0 1px var(--button-highlight),
    inset 0 2px var(--button-face);
  border-top: 1px solid var(--button-highlight);
  z-index: 9000;
}

#start-btn {
  min-width: 54px;
  min-height: 22px;
  height: 22px;
  padding: 0 6px 0 4px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}

#start-btn.active {
  /* sunken while menu open */
  box-shadow:
    inset -1px -1px var(--button-highlight),
    inset 1px 1px var(--window-frame),
    inset -2px -2px var(--button-face),
    inset 2px 2px var(--button-shadow);
}

#start-btn .start-logo {
  font-size: 14px;
  line-height: 1;
}

#task-buttons {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
}

.task-btn {
  min-width: 0;
  max-width: 160px;
  height: 22px;
  min-height: 22px;
  padding: 0 6px;
  flex: 0 1 150px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
  justify-content: flex-start;
}

.task-btn .tb-icon {
  flex: 0 0 auto;
  font-size: 12px;
}

.task-btn .tb-icon-img {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.task-btn .tb-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-btn.active {
  /* sunken / pressed look for the focused window */
  box-shadow:
    inset -1px -1px var(--button-highlight),
    inset 1px 1px var(--window-frame),
    inset -2px -2px var(--button-face),
    inset 2px 2px var(--button-shadow);
  font-weight: bold;
}

/* ---------- System tray ---------- */
#tray {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  padding: 0 8px;
  /* sunken box via tokens recipe */
  box-shadow:
    inset -1px -1px var(--button-highlight),
    inset 1px 1px var(--window-frame),
    inset -2px -2px var(--button-face),
    inset 2px 2px var(--button-shadow);
}

#ticker {
  font-size: 11px;
  white-space: nowrap;
}

#ticker .up {
  color: #007a00;
}

#ticker .down {
  color: #c00000;
}

#clock {
  font-size: 11px;
  white-space: nowrap;
  min-width: 38px;
  text-align: right;
}

/* CRT on/off control in the tray (tiny monitor glyph) */
#crt-toggle {
  min-width: 0;
  min-height: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 12px;
  line-height: 1;
  flex: 0 0 auto;
}

/* ---------- CRT scanline + vignette overlay ---------- */
#crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  /* 3px scanline cycle: 1px dark @15% + 2px clear — visible at 1:1 */
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.15) 0 1px,
    transparent 1px 3px
  );
  box-shadow: inset 0 0 120px 24px rgba(0, 0, 0, 0.45);
  mix-blend-mode: multiply;
}

#screen.crt-off #crt {
  display: none;
}

/* ---------- Start menu ---------- */
#start-menu {
  position: absolute;
  left: 2px;
  bottom: 28px;
  width: 220px;
  display: flex;
  background: var(--surface);
  z-index: 9500;
  /* raised */
  box-shadow:
    inset -1px -1px var(--window-frame),
    inset 1px 1px var(--button-highlight),
    inset -2px -2px var(--button-shadow),
    inset 2px 2px var(--button-face);
  padding: 3px;
}

#start-menu[hidden] {
  display: none;
}

.start-sidebar {
  flex: 0 0 26px;
  background: linear-gradient(
    180deg,
    var(--dialog-blue-light),
    var(--selection-navy)
  );
  color: #ffffff;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: left;
  font-weight: bold;
  font-size: 16px;
  letter-spacing: 2px;
  padding: 8px 4px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

.start-items {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 2px;
}

.start-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  cursor: default;
  color: var(--text-color);
}

.start-row .si-icon {
  font-size: 16px;
  width: 18px;
  text-align: center;
}

.start-row .si-arrow {
  margin-left: auto;
  color: var(--text-color);
}

.start-row:hover {
  background: var(--selection-navy);
  color: #ffffff;
}

.start-sep {
  height: 1px;
  margin: 3px 2px;
  border-top: 1px solid var(--button-shadow);
  border-bottom: 1px solid var(--button-highlight);
}

/* ---------- Context menu ---------- */
#context-menu {
  position: absolute;
  min-width: 130px;
  background: var(--surface);
  z-index: 9700;
  padding: 2px;
  box-shadow:
    inset -1px -1px var(--window-frame),
    inset 1px 1px var(--button-highlight),
    inset -2px -2px var(--button-shadow),
    inset 2px 2px var(--button-face);
}

#context-menu .ctx-row {
  padding: 3px 18px 3px 22px;
  cursor: default;
  white-space: nowrap;
}

#context-menu .ctx-row:hover {
  background: var(--selection-navy);
  color: #ffffff;
}

#context-menu .ctx-row.disabled {
  color: var(--button-shadow);
}

#context-menu .ctx-row.disabled:hover {
  background: transparent;
  color: var(--button-shadow);
}

#context-menu .ctx-sep {
  height: 1px;
  margin: 2px 2px;
  border-top: 1px solid var(--button-shadow);
  border-bottom: 1px solid var(--button-highlight);
}

/* ---------- Boot / BIOS POST ---------- */
#boot {
  position: absolute;
  inset: 0;
  z-index: 10000;
  background: #000000;
  display: none;
}

#boot.show {
  display: block;
}

.post-screen {
  position: absolute;
  inset: 0;
  background: #000000;
  color: #d8d8d8;
  font-family: "Spline Sans Mono", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.5;
  padding: 22px 26px;
  white-space: pre-wrap;
  overflow: hidden;
}

.post-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: #d8d8d8;
  vertical-align: text-bottom;
  animation: post-blink 1s step-end infinite;
}

@keyframes post-blink {
  50% {
    opacity: 0;
  }
}

/* ---------- Login dialog ---------- */
/* Login floats over the desktop wallpaper (not flat teal). The full-bleed
   wallpaper is painted here so it reads as the #screen behind the dialog,
   even while #boot (black, for the POST) is still on top of the desktop. */
.login-layer {
  position: absolute;
  inset: 0;
  background: #0a0a18 url("../assets/wallpaper/vocaloid-lofi-medium.png") center
    center / cover no-repeat;
  image-rendering: pixelated;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-window {
  width: 340px;
}

.login-window .window-body {
  overflow: visible;
}

.login-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.login-head .login-key {
  width: 32px;
  height: 32px;
  font-size: 30px;
  line-height: 1;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.login-head .login-msg {
  font-size: 11px;
}

.login-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-field-row label {
  flex: 0 0 70px;
}

.login-field-row input {
  flex: 1 1 auto;
}

.login-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* ---------- BSOD / shutdown easter-egg ---------- */
#bsod {
  position: absolute;
  inset: 0;
  z-index: 11000;
  background: var(--bsod-blue);
  color: #ffffff;
  font-family: "Spline Sans Mono", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 15px;
  line-height: 1.6;
  padding: 60px 12% 0;
  display: none;
}

#bsod.show {
  display: block;
}

#bsod .bsod-tag {
  background: #aaaaaa;
  color: var(--bsod-blue);
  padding: 0 6px;
}

#bsod .bsod-center {
  text-align: center;
}

.safe-off {
  position: absolute;
  inset: 0;
  z-index: 11000;
  background: #000000;
  color: #e8a000;
  font-family: "Spline Sans Mono", "IBM Plex Mono", ui-monospace, monospace;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 18px;
  line-height: 1.6;
}

.safe-off.show {
  display: flex;
}

/* ---------- Terminal app ---------- */
.terminal {
  background: #000000;
  color: #11dd11;
  font-family: "Spline Sans Mono", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.4;
  height: 100%;
  margin: 0;
  padding: 6px 8px;
  overflow: auto;
  cursor: text;
}

.terminal .term-out {
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal .term-input-row {
  display: flex;
  align-items: baseline;
}

.terminal .term-prompt {
  flex: 0 0 auto;
  margin-right: 6px;
  color: #11dd11;
}

.terminal input.term-input {
  flex: 1 1 auto;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  color: #11dd11;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  height: auto;
  line-height: inherit;
}

/* ---------- generic app body ---------- */
.app-body-text {
  margin: 10px;
  font-size: 11px;
  line-height: 1.5;
}

.app-body-text h2 {
  font-size: 14px;
  margin: 0 0 6px;
}

.app-body-text p {
  margin: 0 0 8px;
}

.link-list {
  list-style: none;
  margin: 6px 0;
  padding: 0;
}

.link-list li {
  margin: 3px 0;
}

/* ---------- Airdrops.exe venue directory ---------- */
.venue-list {
  list-style: none;
  margin: 6px 0;
  padding: 0;
}

.venue-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0;
  padding: 6px 8px;
  background: var(--surface, #c0c0c0);
}

.venue-favicon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  font-size: 13px;
}

.venue-favicon-img {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
}

.venue-text {
  flex: 1 1 auto;
  min-width: 0;
}

.venue-name {
  font-weight: bold;
}

.venue-blurb {
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.4;
}

.notepad {
  background: #ffffff;
  color: #000000;
  height: 100%;
  margin: 0;
  padding: 8px 10px;
  overflow: auto;
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  box-shadow:
    inset -1px -1px var(--button-highlight),
    inset 1px 1px var(--button-shadow);
}

/* ============================================================
   STUDY WITH MIKU radio — docked CD-player widget (player.js).
   Bottom-left INSIDE #screen: above the taskbar (z 9000), below
   the Start menu (9500) and CRT overlay (9999). Raised bevel,
   hard 1px edges — matches the Win98 chrome.
   ============================================================ */
.radio-widget {
  position: absolute;
  left: 6px;
  bottom: 34px; /* clear the 28px taskbar + a 6px gap */
  width: 196px;
  background: var(--surface);
  color: var(--text-color);
  z-index: 9100;
  padding: 2px;
  image-rendering: pixelated;
}

.radio-widget.radio-hidden {
  display: none;
}

.radio-head {
  display: flex;
  align-items: center;
  height: 18px;
  padding: 0 2px 0 4px;
  font-weight: bold;
  color: #ffffff;
  cursor: move; /* draggable dock — header grabs the widget */
  background: linear-gradient(
    90deg,
    var(--dialog-blue),
    var(--dialog-blue-light)
  );
}

/* the control buttons keep the default arrow (not the move cursor) */
.radio-head-ctrls,
.radio-head-ctrls button {
  cursor: default;
}

.radio-title {
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
}

.radio-head-ctrls {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
}

.radio-head-ctrls button {
  min-width: 16px;
  width: 16px;
  height: 14px;
  min-height: 14px;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio-body {
  padding: 5px 5px 4px;
}

/* ---------- EQ bars ---------- */
.radio-eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  padding: 2px 3px;
  background: #000000;
  box-shadow:
    inset -1px -1px var(--button-highlight),
    inset 1px 1px var(--window-frame);
}

.radio-eq .eq-bar {
  flex: 1 1 auto;
  height: 12%; /* idle = low, flat */
  background: #11dd11;
  image-rendering: pixelated;
}

/* animate only while playing; idle bars sit flat */
.radio-widget.playing .eq-bar {
  animation: eq-bounce 0.9s steps(4, end) infinite;
  /* staggered per-bar phase via --i set inline (0..6) */
  animation-delay: calc(var(--i) * -0.13s);
}

@keyframes eq-bounce {
  0% {
    height: 18%;
  }
  25% {
    height: 70%;
  }
  50% {
    height: 38%;
  }
  75% {
    height: 95%;
  }
  100% {
    height: 28%;
  }
}

.radio-now {
  margin: 4px 0 5px;
  overflow: hidden;
}

.radio-now-label {
  display: inline-block;
  font-size: 11px;
  white-space: nowrap;
  color: var(--text-color);
}

.radio-widget.playing .radio-now-label {
  color: #008000;
}

.radio-controls {
  display: flex;
  gap: 3px;
}

.radio-controls button {
  flex: 1 1 auto;
  height: 20px;
  min-height: 20px;
  min-width: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* volume row: mute toggle + slider */
.radio-vol-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.radio-mute {
  flex: 0 0 auto;
  width: 22px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  font-size: 11px;
  line-height: 1;
}

.radio-vol {
  flex: 1 1 auto;
  min-width: 0;
  height: 16px;
  margin: 0;
}

/* minimized → collapse to just the header strip */
.radio-widget.collapsed .radio-body {
  display: none;
}

/* ============================================================
   Responsive guard — "best viewed on desktop" card for < 700px.
   Lives outside #screen (no scale) and covers everything.
   ============================================================ */
#mobile-gate {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--desktop-teal);
  padding: 20px;
}

#mobile-gate.show {
  display: flex;
}

#mobile-gate .window {
  width: 300px;
  max-width: 92vw;
}

#mobile-gate .window-body {
  margin: 12px;
}

#mobile-gate .mg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

#mobile-gate .mg-icon {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}

#mobile-gate h2 {
  font-size: 13px;
  margin: 0 0 6px;
}

#mobile-gate p {
  font-size: 11px;
  line-height: 1.5;
  margin: 0 0 6px;
}

/* ---------- Market.exe ---------- */
.market {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  margin: 6px;
}

.market-watch {
  flex: 0 0 auto;
  max-height: 132px;
  overflow-y: auto;
  background: #ffffff;
}

.market-watch-table {
  width: 100%;
}

.market-watch-table td,
.market-watch-table th {
  white-space: nowrap;
}

.market-watch-table tbody tr {
  cursor: default;
}

.market-sym {
  font-weight: bold;
}

.market-venue {
  color: var(--button-shadow);
}

.market-last {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.market-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.market-up {
  color: #008000;
}

.market-down {
  color: #c00000;
}

.market-flat {
  color: var(--button-shadow);
}

.market-chart-pane {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.market-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.market-chart-title {
  font-weight: bold;
}

.market-tabs {
  display: flex;
  gap: 2px;
}

.market-tab {
  min-width: 30px;
  padding: 2px 6px;
}

.market-tab.active {
  box-shadow:
    inset -1px -1px var(--button-highlight),
    inset 1px 1px var(--window-frame),
    inset -2px -2px var(--button-face),
    inset 2px 2px var(--button-shadow);
}

.market-chart-well {
  flex: 1 1 auto;
  min-height: 120px;
  padding: 2px;
  background: #000000;
  display: flex;
}

.market-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.market-footer {
  flex: 0 0 auto;
}

/* ---------- PerpStats.exe ---------- */
.perpstats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  margin: 6px;
}

.perpstats-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.perpstats-tabs > li[role="tab"] {
  cursor: default;
  padding: 3px 12px;
  user-select: none;
  box-shadow:
    inset -1px -1px var(--window-frame),
    inset 1px 1px var(--button-highlight),
    inset -2px -2px var(--button-shadow),
    inset 2px 2px var(--button-face);
}

.perpstats-tabs > li[role="tab"][aria-selected="true"] {
  font-weight: bold;
  box-shadow:
    inset -1px -1px var(--button-highlight),
    inset 1px 1px var(--window-frame),
    inset -2px -2px var(--button-face),
    inset 2px 2px var(--button-shadow);
}

.perpstats-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px;
  background: #ffffff;
}

.perpstats-note {
  padding: 8px;
}

.perpstats-table {
  width: 100%;
}

.perpstats-table td,
.perpstats-table th {
  white-space: nowrap;
}

.perpstats-table > thead > tr > th.sortable {
  cursor: pointer;
  user-select: none;
}

.ps-coin,
.ps-venue {
  font-weight: bold;
}

.ps-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ps-up {
  color: #008000;
}

.ps-down {
  color: #c00000;
}

.ps-flat {
  color: var(--button-shadow);
}

.perpstats-table tbody tr.ps-starred .ps-venue {
  color: #000080;
}

.perpstats-footer {
  flex: 0 0 auto;
}
