/* ============================================================
   BTC Calendar — Windows 95 theme
   Teal desktop, gray beveled windows, navy title bars,
   Win95 buttons / menus / dialogs / status bars.
   ============================================================ */
:root {
  /* desktop + face colors */
  --bg: #008080;        /* classic teal desktop */
  --face: #c0c0c0;      /* window gray */
  --face-2: #dfdfdf;
  --hl: #ffffff;
  --shadow: #808080;
  --dark: #404040;
  --black: #000000;

  /* legacy variable names (kept for chart canvas code) */
  --panel: var(--face);
  --panel-2: var(--face-2);
  --border: #808080;
  --text: #000000;
  --muted: #404040;

  /* title bar + selection */
  --title: #000080;
  --title-grad: #1084d0;
  --title-inactive: #808080;

  /* data colors */
  --accent: #000080;
  --up: #008000;
  --down: #ff0000;
  --today-ring: #000080;
}

/* "light" theme = black desktop (old PC with no wallpaper).
   The windows stay classic gray. */
:root[data-theme="light"] {
  --bg: #000000;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Tahoma, "MS Sans Serif", "Segoe UI", Verdana, sans-serif;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  padding: 8px;
  gap: 8px;
}

/* subtle CRT scanlines over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.05) 0px,
    rgba(0, 0, 0, 0.05) 1px,
    transparent 1px,
    transparent 3px
  );
}

::selection { background: var(--title); color: #fff; }

a { color: inherit; text-decoration: none; }

/* ---------- Win95 primitives ---------- */

/* raised window frame */
.win {
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2),
              inset -1px -1px 0 var(--shadow),
              3px 3px 0 rgba(0, 0, 0, 0.3);
  padding: 3px;
}
.win-content { background: var(--face); padding: 10px; }

/* title bar */
.win-titlebar {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(90deg, var(--title), var(--title-grad));
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  padding: 3px 3px 3px 5px;
  user-select: none;
}
.win-titlebar .tb-icon { font-size: 12px; line-height: 1; }
.win-titlebar .tb-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.win-btns { display: flex; gap: 2px; }
.tbtn {
  width: 16px;
  height: 14px;
  padding: 0;
  flex: none;
  background: var(--face);
  color: #000;
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
  font-size: 9px;
  line-height: 1;
  font-family: Tahoma, "MS Sans Serif", sans-serif;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tbtn:active {
  border-color: var(--black) var(--hl) var(--hl) var(--black);
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--face-2);
  padding-top: 1px;
}

/* menu bar + dropdowns */
.menubar {
  display: flex;
  gap: 0;
  padding: 1px 1px 2px;
  border-bottom: 1px solid var(--face-2);
  font-size: 11px;
}
.menubar .menu {
  padding: 2px 9px;
  cursor: default;
  user-select: none;
}
.menubar .menu:hover,
.menubar .menu.open {
  background: var(--title);
  color: #fff;
}
.dropdown {
  position: fixed;
  z-index: 150;
  min-width: 160px;
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2),
              inset -1px -1px 0 var(--shadow),
              3px 3px 0 rgba(0, 0, 0, 0.3);
  padding: 3px;
}
.dropdown[hidden] { display: none; }
.dropdown .mi {
  display: block;
  padding: 4px 24px 4px 22px;
  font-size: 11px;
  color: #000;
  white-space: nowrap;
  cursor: default;
}
.dropdown .mi:hover { background: var(--title); color: #fff; }
.dropdown .mi-sep {
  border: none;
  margin: 4px 1px;
  border-top: 1px solid var(--shadow);
  border-bottom: 1px solid var(--hl);
  height: 0;
}

/* buttons */
.ctrl {
  background: var(--face);
  color: var(--text);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
  padding: 4px 10px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ctrl:active {
  border-color: var(--black) var(--hl) var(--hl) var(--black);
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--face-2);
}
.ctrl:disabled,
.ctrl.disabled {
  color: var(--shadow);
  text-shadow: 1px 1px 0 var(--hl);
  pointer-events: none;
  opacity: 1;
}
.ctrl.today { font-weight: bold; color: var(--title); }
.ctrl.accent {
  box-shadow: 0 0 0 1px var(--black),
              inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
}
.ctrl.accent:active {
  box-shadow: 0 0 0 1px var(--black),
              inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--face-2);
}
.ctrl.mini { padding: 4px 12px; font-size: 12px; }

/* form fields */
select {
  background: #fff;
  color: #000;
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark);
  border-radius: 0;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
}

/* ---------- Top bar (main window) ---------- */
.topbar {
  display: flex;
  flex-direction: column;
}
.topbar.collapsed .topbar-row,
.topbar.collapsed .menubar { display: none; }
body.maximized { padding: 0; gap: 0; }

.topbar-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 8px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
}
.brand:hover .brand-text { color: var(--title); }
.brand-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--title);
  font-weight: bold;
  border: 1px solid var(--black);
  font-size: 12px;
  line-height: 1;
}

.nav-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.range-label {
  display: inline-block;
  font-size: 13px;
  font-weight: bold;
  min-width: 220px;
  text-align: center;
  color: #000;
  cursor: pointer;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark);
  border-radius: 0;
}
.range-label:hover { background: var(--title); color: #fff; }

.views {
  display: flex;
  justify-self: end;
  background: var(--face);
  border: none;
  border-radius: 0;
  overflow: visible;
}
.view-link {
  color: var(--text);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: bold;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
}
.view-link + .view-link { border-left: 1px solid var(--shadow); }
.view-link:hover { background: var(--face-2); }
.view-link.active {
  border-color: var(--black) var(--hl) var(--hl) var(--black);
  box-shadow: inset 1px 1px 0 var(--shadow);
  background: var(--face-2);
}

/* ---------- Calendar area ---------- */
.calendar {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
#calendar { flex: 1; display: flex; flex-direction: column; }
#calendar > .win { flex: 1; display: flex; flex-direction: column; }
#calendar .win-content { flex: 1; }

/* --- Day view --- */
.day-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.day-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.day-weekday { font-size: 24px; font-weight: bold; }
.day-date { font-size: 14px; color: var(--muted); }
.day-price-card { width: 360px; max-width: 100%; }
.day-price-card .win-content { padding: 12px; }
.p-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.day-fields {
  background: #fff;
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark);
  padding: 2px 10px;
}
.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #d0d0d0;
  font-size: 12px;
  background: transparent;
}
.price-row:last-child { border-bottom: none; }
.price-row .k { color: var(--muted); font-weight: bold; }
.price-row .v { font-weight: bold; font-variant-numeric: tabular-nums; }
.price-row .v.up { color: var(--up); }
.price-row .v.down { color: var(--down); }
.no-data { color: var(--muted); font-style: italic; padding: 8px 0; }
.fng-sep {
  height: 0;
  border-top: 1px solid var(--shadow);
  border-bottom: 1px solid var(--hl);
  margin: 8px 0;
}
.day-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.day-link { font-weight: bold; }

/* ---------- Moon icons ---------- */
.moon-icon { font-size: 12px; line-height: 1; margin-left: 2px; }
.moon-icon.big { font-size: 16px; }
.w-badges, .m-badges {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

/* ---------- Halving icon ---------- */
.halving-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b35900;
  font-weight: bold;
  font-size: 11px;
  line-height: 1;
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
  width: 15px;
  height: 14px;
}
.halving-icon.big {
  width: auto;
  height: auto;
  background: #fff;
  border: 1px solid var(--black);
  box-shadow: none;
  color: #b35900;
  font-size: 14px;
  padding: 1px 5px;
}

/* Fork icons: soft = upgrade (blue), hard = fork (magenta) */
.fork-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 10px;
  line-height: 1;
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
  width: 15px;
  height: 14px;
}
.fork-icon.soft { color: #0000c0; }
.fork-icon.hard { color: #c00050; }
.fork-icon.big {
  width: auto;
  height: auto;
  background: #fff;
  border: 1px solid var(--black);
  box-shadow: none;
  font-size: 13px;
  padding: 1px 5px;
}

/* ---------- Fear & Greed badges ---------- */
.fng-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 1px 4px;
  border: 1px solid #000;
  border-radius: 0;
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  text-align: center;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}
.fng-badge.big { min-width: 26px; padding: 2px 6px; font-size: 12px; }

/* --- Year view --- */
.year-view { display: block; max-width: 760px; margin: 0 auto; }
.year-head,
.year-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 0.7fr 0.7fr;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
}
.year-head {
  color: var(--text);
  font-size: 11px;
  font-weight: bold;
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--shadow) var(--shadow) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
}
.year-row {
  background: #fff;
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark);
  margin-top: 2px;
  color: #000;
}
.year-row:hover { background: var(--title); color: #fff; }
.year-row.empty { opacity: 0.55; }
.y-month { font-weight: bold; }
.y-open, .y-close { font-variant-numeric: tabular-nums; }
.y-change { font-variant-numeric: tabular-nums; font-weight: bold; }
.y-change.up { color: var(--up); }
.y-change.down { color: var(--down); }
.y-change.na { color: var(--muted); }
.year-row:hover .y-change.up { color: #66ff66; }
.year-row:hover .y-change.down { color: #ff9999; }
.y-halving { text-align: center; }
.y-fork { text-align: center; }

/* --- Tiny arrows below the month/week grid --- */
.grid-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding: 0 24%;
}
.mini-arrow,
.mini-search {
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
  color: #000;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 0;
}
.mini-search { font-size: 11px; }
.mini-arrow:active,
.mini-search:active {
  border-color: var(--black) var(--hl) var(--hl) var(--black);
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--face-2);
}
.ctrl.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Week view --- */
.week-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.week-month-label { font-size: 16px; font-weight: bold; }
.week-month-link {
  color: #000;
  font-weight: bold;
  font-size: 11px;
  padding: 4px 12px;
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
  border-radius: 0;
}
.week-month-link:active {
  border-color: var(--black) var(--hl) var(--hl) var(--black);
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--face-2);
}
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.week-cell {
  background: #fff;
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark);
  border-radius: 0;
  padding: 10px 6px;
  text-align: center;
  color: #000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
.week-cell:hover { background: var(--title); color: #fff; }
.week-cell .w-name {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: bold;
}
.week-cell:hover .w-name { color: #b0b0e0; }
.week-cell .w-num { font-size: 22px; font-weight: bold; line-height: 1; }
.week-cell.today .w-num {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 0;
  background: var(--title);
  color: #fff;
}
.week-cell.today:hover .w-num { background: #fff; color: var(--title); }
.week-cell .w-price { font-size: 12px; font-weight: bold; font-variant-numeric: tabular-nums; }
.w-price.up { color: var(--up); }
.w-price.down { color: var(--down); }
.week-cell:hover .w-price.up { color: #66ff66; }
.week-cell:hover .w-price.down { color: #ff9999; }
.w-price.na { color: var(--muted); font-style: italic; font-weight: 400; }
.week-cell .w-sub { font-size: 10px; color: var(--muted); }
.week-cell:hover .w-sub { color: #b0b0e0; }
.week-cell .w-hl { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.week-cell:hover .w-hl { color: #b0b0e0; }
.week-cell .w-badges { margin-top: auto; justify-content: center; }
.week-cell .fng-badge { align-self: center; }

/* --- Month view --- */
.month-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 4px;
}
.month-head div {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text);
  font-weight: bold;
  padding: 3px 0;
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--shadow) var(--shadow) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.month-cell {
  background: #fff;
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark);
  border-radius: 0;
  min-height: 78px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  text-align: left;
  color: #000;
  cursor: pointer;
}
.month-cell:hover { background: var(--title); color: #fff; }
.month-cell.other-month { opacity: 0.4; }
.month-cell.empty {
  background: var(--face);
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
  box-shadow: none;
  cursor: default;
}
.month-cell.empty:hover { background: var(--face); color: #000; }
.month-cell .m-top { display: flex; justify-content: space-between; align-items: center; gap: 3px; }
.month-cell .m-badges { gap: 3px; }
.month-cell .m-num { font-size: 13px; font-weight: bold; }
.month-cell.today .m-num {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 0;
  background: var(--title);
  color: #fff;
  font-size: 12px;
  line-height: 1.3;
}
.month-cell.today:hover .m-num { background: #fff; color: var(--title); }
.month-cell .m-price {
  margin-top: auto;
  font-size: 11px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}
.m-price.up { color: var(--up); }
.m-price.down { color: var(--down); }
.month-cell:hover .m-price.up { color: #66ff66; }
.month-cell:hover .m-price.down { color: #ff9999; }
.m-price.na { color: var(--muted); font-style: italic; font-weight: 400; }
.month-cell .m-sub { font-size: 10px; color: var(--muted); }
.month-cell:hover .m-sub { color: #b0b0e0; }
.month-cell .m-change { font-size: 10px; font-weight: bold; }
.month-cell .m-hl { font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.month-cell:hover .m-hl { color: #b0b0e0; }

/* H/L coloring: high = green, low = red (brighter on cell hover) */
.hl-high { color: var(--up); }
.hl-low { color: var(--down); }
.week-cell:hover .hl-high, .month-cell:hover .hl-high { color: #66ff66; }
.week-cell:hover .hl-low, .month-cell:hover .hl-low { color: #ff9999; }
.m-change.up { color: var(--up); }
.m-change.down { color: var(--down); }
.month-cell:hover .m-change.up { color: #66ff66; }
.month-cell:hover .m-change.down { color: #ff9999; }
.m-change.na { color: var(--muted); }

/* ---------- Status bar ---------- */
.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
  font-size: 11px;
  color: var(--text);
}
.statusbar > * {
  flex: 1 1 auto;
  min-width: 0;
  padding: 3px 8px;
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark);
}
.statusbar > *:last-child { flex: 0 1 auto; }
.legend { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid #000;
  border-radius: 0;
  margin-right: 3px;
  vertical-align: middle;
}
.sw.up { background: var(--up); }
.sw.down { background: var(--down); }
.sw.none { background: #fff; }

/* --- Ad / link boxes --- */
.links-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 0 8px;
}
.link-box {
  display: flex;
  flex-direction: column;
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2),
              inset -1px -1px 0 var(--shadow),
              2px 2px 0 rgba(0, 0, 0, 0.3);
  border-radius: 0;
  overflow: hidden;
  color: #000;
  padding: 2px;
}
.link-box:active {
  border-color: var(--black) var(--hl) var(--hl) var(--black);
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--face-2);
}
.link-box .lb-title {
  background: linear-gradient(90deg, var(--title), var(--title-grad));
  color: #fff;
  font-weight: bold;
  font-size: 11px;
  padding: 2px 6px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-box .lb-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #fff;
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark);
}
.link-box .lb-thumb-empty {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark);
  color: var(--title);
  font-size: 30px;
  font-weight: bold;
}
.link-box .lb-text {
  padding: 6px 6px 4px;
  font-size: 11px;
  line-height: 1.4;
  color: #000;
}

/* ---------- Search pop-up (Win95 dialog) ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.search-overlay[hidden] { display: none; }
.search-pop {
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2),
              inset -1px -1px 0 var(--shadow),
              3px 3px 0 rgba(0, 0, 0, 0.35);
  border-radius: 0;
  padding: 3px;
  width: 320px;
  max-width: 100%;
}
.search-pop .win-content { padding: 12px; }
.search-title {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: left;
}
.search-fields {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.search-fields select { flex: 1; min-width: 0; }
.search-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Generic Win95 dialog (About / error) ---------- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.dialog-overlay[hidden] { display: none; }
.dialog { width: 360px; max-width: 100%; }
.dlg-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 12px 8px;
}
.dlg-icon { font-size: 26px; line-height: 1; }
.dlg-text { font-size: 12px; line-height: 1.5; white-space: pre-line; }
.dlg-actions {
  padding: 4px 12px 12px;
  display: flex;
  justify-content: center;
}
.dlg-actions .ctrl { min-width: 84px; justify-content: center; }

/* ---------- Theme toggle (desktop color) ---------- */
.theme-toggle {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 100;
  width: 30px;
  height: 28px;
  border-radius: 0;
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
  background: var(--face);
  color: #000;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:active {
  border-color: var(--black) var(--hl) var(--hl) var(--black);
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--face-2);
}

/* Popup-blocker button (sits directly above the theme toggle) */
.malware-toggle { bottom: 44px; }
.malware-toggle.blocked {
  border-color: var(--black) var(--hl) var(--hl) var(--black);
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--face-2);
}

/* ---------- Win95 scrollbars ---------- */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track {
  background: repeating-conic-gradient(#fff 0% 25%, var(--face) 0% 50%) 0 0 / 2px 2px;
  border: 1px solid;
  border-color: var(--shadow) var(--hl) var(--hl) var(--shadow);
}
::-webkit-scrollbar-thumb {
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
}
::-webkit-scrollbar-button {
  display: block;
  width: 16px;
  height: 16px;
  background: var(--face);
  border: 1px solid;
  border-color: var(--hl) var(--black) var(--black) var(--hl);
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .links-row { grid-template-columns: repeat(2, 1fr); }
  .topbar-row { grid-template-columns: 1fr; justify-items: center; gap: 8px; }
  .views { justify-self: center; }
  .nav-controls { justify-self: center; }
}
@media (max-width: 520px) {
  .links-row { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .range-label { min-width: 150px; font-size: 12px; }
  .week-grid { grid-template-columns: repeat(7, minmax(42px, 1fr)); }
  .week-cell { padding: 8px 4px; }
  .week-cell .w-num { font-size: 16px; }
  .month-cell { min-height: 64px; padding: 5px; }
  .month-cell .m-sub { display: none; }
  .grid-nav { padding: 0 8%; }
}

/* ---------- Fake 90s malware popups (decorative) ---------- */
.malware-popup {
  position: fixed;
  z-index: 9999;
  width: 270px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
  animation: mal-pop 0.18s ease-out;
  pointer-events: none; /* only the buttons are interactive */
}
.malware-popup .tbtn,
.malware-popup .ctrl { pointer-events: auto; }
.malware-popup.drifting { transition: left 2.4s ease-in-out, top 2.4s ease-in-out; }
.malware-popup.dying { animation: mal-die 0.3s ease-in forwards; }
@keyframes mal-pop {
  from { transform: scale(0.55); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes mal-die {
  to { transform: scale(0.5) rotate(3deg); opacity: 0; }
}
.mal-danger .win-titlebar { background: linear-gradient(90deg, #7a0000, #ff4b4b); }
.mal-body { display: flex; gap: 10px; align-items: flex-start; padding: 10px; font-size: 11px; line-height: 1.5; }
.mal-icon { font-size: 24px; line-height: 1.1; }
.mal-slogan { font-weight: 700; }
.mal-progress {
  margin-top: 6px;
  height: 14px;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  box-shadow: inset 1px 1px 0 #404040;
  padding: 2px;
}
.mal-bar {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(90deg, #000080 0 7px, transparent 7px 9px);
  transition: width 0.4s steps(4);
}
.mal-pct { margin-top: 3px; font-size: 10px; color: #404040; font-variant-numeric: tabular-nums; }
.mal-actions { padding: 2px 8px 8px; display: flex; gap: 6px; justify-content: flex-end; }
