/* RWA FLYWHEEL BABIES - a Windows 95 desktop. The chrome is silver, the
   desktop is teal, and every program on it is one piece of the machine. */
:root {
  --teal: #008080;
  --face: #c0c0c0;
  --face-hi: #ffffff;
  --face-lo: #808080;
  --face-dk: #404040;
  --title: #000080;
  --title2: #1084d0;
  --title-off: #808080;
  --ink: #16161d;
  --paper: #ffffff;
  --green: #2f9e6a;
  --red: #c53f3f;
  --gold: #b8912c;
  --ghost: #5c5c66;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--teal);
  color: var(--ink);
  font: 13px/1.55 Tahoma, "MS Sans Serif", Geneva, sans-serif;
  overflow: hidden;
}
.mono, .num, code { font-family: "Courier New", ui-monospace, monospace; }
a { color: #0000c0; }

/* ---- the two bevels everything is made of ---- */
.raised, .window, .tbtn, button, #taskbar, #startMenu, .dico, .taskitem, dialog {
  background: var(--face);
  border: none;
  box-shadow:
    inset -1px -1px 0 var(--face-dk),
    inset 1px 1px 0 var(--face-hi),
    inset -2px -2px 0 var(--face-lo);
}
.sunken, input[type=number], .winbody .grid, .status, #clock, .chartwrap {
  box-shadow:
    inset 1px 1px 0 var(--face-lo),
    inset -1px -1px 0 var(--face-hi),
    inset 2px 2px 0 var(--face-dk);
}

/* ================= desktop ================= */
#desktop {
  position: fixed; inset: 0 0 34px 0; overflow: hidden;
  background: url("./social/bliss.png") center / cover no-repeat var(--teal);
  image-rendering: pixelated;
}

.icons {
  position: absolute; top: 10px; left: 10px;
  display: flex; flex-direction: column; gap: 14px;
}
.dicon {
  background: none; box-shadow: none; border: none;
  width: 92px; padding: 4px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; color: #fff;
}
.dico {
  width: 44px; height: 44px; padding: 4px; background: var(--face);
  display: grid; place-items: center; overflow: hidden;
}
.dico svg { width: 32px; height: 32px; image-rendering: pixelated; display: block; }
/* the baby icon zooms into the face instead of showing the whole canvas */
.dico img { width: 72px; height: 72px; margin-top: -4px; image-rendering: pixelated; display: block; }
.dlabel {
  font-size: 11px; padding: 1px 3px; text-align: center;
  background: var(--teal); color: #fff;
}
.dicon:focus .dlabel, .dicon:active .dlabel { background: var(--title); outline: 1px dotted #fff; }

/* ================= windows ================= */
.window {
  position: absolute;
  min-width: 300px; max-width: min(92vw, 720px);
  padding: 3px;
  display: flex; flex-direction: column;
  max-height: calc(100% - 20px);
}
.window[hidden] { display: none; }
.titlebar {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(90deg, var(--title), var(--title2));
  color: #fff; padding: 3px 4px 3px 8px;
  font-weight: 700; font-size: 12px; letter-spacing: 0.5px;
  cursor: default; user-select: none; touch-action: none;
}
.window:not(.active) .titlebar { background: var(--title-off); }
.tname { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbtns { display: flex; gap: 2px; }
.tbtn {
  width: 18px; height: 16px; padding: 0;
  font: 700 11px Tahoma, sans-serif; line-height: 1;
  color: var(--ink); cursor: pointer;
}
.tbtn:active { box-shadow: inset 1px 1px 0 var(--face-dk), inset -1px -1px 0 var(--face-hi); }

.winbody {
  overflow: auto; background: var(--face);
  padding: 10px 14px 16px;
  scrollbar-width: thin;
}
.winbody > section > h2, .winbody > section#mint > h2 { display: none; }
h3 { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin: 18px 0 8px;
     border-bottom: 1px solid var(--face-lo); padding-bottom: 3px; }
p { margin: 8px 0; max-width: 66ch; }
.cap { color: var(--ghost); font-size: 12px; }
.stampline { border-left: 3px solid var(--title); padding-left: 8px; }

table { border-collapse: collapse; width: 100%; margin: 10px 0; }
th, td { text-align: left; padding: 6px 10px 6px 0; vertical-align: top; border-top: 1px solid var(--face-lo); font-weight: 400; font-size: 12px; }
th { width: 110px; text-transform: uppercase; font-size: 10px; letter-spacing: 1px; color: var(--ghost); white-space: nowrap; }
.addrs { list-style: none; margin: 0; padding: 0; font-size: 11px; }
.addrs li { margin: 2px 0; overflow-wrap: anywhere; }

/* ---- tiles: the babies ---- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px; margin: 10px 0; padding: 8px; background: var(--paper);
}
.tile { background: var(--paper); border: 1px solid var(--face-lo); position: relative; }
.tile .art { position: relative; aspect-ratio: 1; overflow: hidden; }
.tile .art svg, .tile .art img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.tile .id { display: flex; justify-content: space-between; padding: 2px 5px; font-size: 10px; border-top: 1px solid var(--face-lo); background: var(--face); }
.tile input[type=checkbox] { position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; z-index: 2; }

/* a pickable baby is awake: it bobs, and leans in when you hover it */
.tile.pickable { cursor: pointer; }
.tile.pickable .art svg, .tile.pickable .art img {
  animation: bob 1.2s steps(2, end) infinite;
}
.tile.pickable:nth-child(2n) .art svg, .tile.pickable:nth-child(2n) .art img { animation-delay: 0.3s; }
.tile.pickable:nth-child(3n) .art svg, .tile.pickable:nth-child(3n) .art img { animation-delay: 0.6s; }
.tile.pickable:hover .art svg, .tile.pickable:hover .art img {
  animation: lean 0.5s steps(2, end) infinite;
}
@keyframes bob  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3%); } }
@keyframes lean { 0%, 100% { transform: translateY(-3%) rotate(-2deg); } 50% { transform: translateY(-5%) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) {
  .tile .art svg, .tile .art img { animation: none !important; }
}

/* picked: pressed in, marquee border, a small hop to say it heard you */
.tile.on { border: 1px dotted var(--title); outline: 2px solid var(--title); }
.tile.on .art { background: #dfe8ff; }
.tile.on .art svg, .tile.on .art img { animation: hop 0.35s steps(3, end) 1; }
@keyframes hop { 0% { transform: translateY(0); } 40% { transform: translateY(-8%); } 100% { transform: translateY(0); } }
.tile.live { outline: 2px solid var(--gold); }

/* ---- stats ---- */
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 10px 0; }
.stat.wide { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat > div {
  background: var(--paper); padding: 8px 10px;
  box-shadow: inset 1px 1px 0 var(--face-lo), inset -1px -1px 0 var(--face-hi), inset 2px 2px 0 var(--face-dk);
}
.stat b { display: block; font-size: 17px; }
.stat span { font-size: 9px; letter-spacing: 1px; color: var(--ghost); }

/* ---- controls ---- */
button {
  font: 700 12px Tahoma, "MS Sans Serif", sans-serif;
  padding: 6px 14px; color: var(--ink); cursor: pointer;
}
button:active:not(:disabled) {
  box-shadow: inset 1px 1px 0 var(--face-dk), inset -1px -1px 0 var(--face-hi), inset 2px 2px 0 var(--face-lo);
  transform: translate(1px, 1px);
}
button:disabled { color: var(--face-lo); text-shadow: 1px 1px 0 var(--face-hi); cursor: not-allowed; }
button.primary { color: var(--title); }
button.coinb { color: #0a5c34; }
button.wheelb { color: #8f1d1d; }
input[type=number] { width: 64px; padding: 5px; font: inherit; background: var(--paper); border: none; }

.row { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.status { min-height: 22px; font-size: 12px; margin-top: 6px; background: var(--paper); padding: 3px 8px; }
.status:empty { visibility: hidden; }
.status.ok { color: var(--green); }
.status.err, .err { color: var(--red); }

.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
.tier { display: grid; gap: 2px; text-align: center; padding: 10px 4px; }
.tier b { font-size: 16px; }
.tier span { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; }
.tier .tmin { color: var(--ghost); text-transform: none; }
.tier.on { color: var(--title); box-shadow: inset 1px 1px 0 var(--face-dk), inset -1px -1px 0 var(--face-hi), inset 2px 2px 0 var(--face-lo); }
.tier.held { color: var(--face-lo); }

.chartwrap { height: 380px; margin: 10px 0; background: var(--paper); }
.chartwrap iframe { width: 100%; height: 100%; border: 0; }

#mintStatus:not([hidden]) { padding: 6px 8px; color: var(--red); background: #ffffcc; box-shadow: inset 1px 1px 0 var(--face-lo); margin-bottom: 8px; }

/* ================= taskbar ================= */
#taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 34px;
  display: flex; align-items: center; gap: 4px; padding: 3px 4px;
  z-index: 9000;
}
#startBtn { display: flex; align-items: center; gap: 5px; padding: 4px 10px; font-weight: 700; }
#startBtn .flag { display: grid; grid-template-columns: 6px 6px; gap: 1px; }
#startBtn .flag i { width: 6px; height: 6px; }
#startBtn .flag i:nth-child(1) { background: #d94f4f; }
#startBtn .flag i:nth-child(2) { background: #3fbf6f; }
#startBtn .flag i:nth-child(3) { background: #2f6fd9; }
#startBtn .flag i:nth-child(4) { background: #f2c94c; }
#taskItems { flex: 1; display: flex; gap: 4px; overflow: hidden; }
.taskitem { padding: 4px 10px; font-size: 11px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.taskitem.on { box-shadow: inset 1px 1px 0 var(--face-dk), inset -1px -1px 0 var(--face-hi), inset 2px 2px 0 var(--face-lo); background: #dfdfdf; }
#tray { display: flex; align-items: center; gap: 8px; padding: 2px 8px;
  box-shadow: inset 1px 1px 0 var(--face-lo), inset -1px -1px 0 var(--face-hi); }
#tray .cap { font-size: 11px; }
.traybtn { padding: 3px 10px; font-size: 11px; }
#clock { font-size: 11px; padding: 3px 8px; background: var(--face); }

/* ================= start menu ================= */
#startMenu {
  position: fixed; left: 3px; bottom: 36px; z-index: 9500;
  display: flex; width: 220px; padding: 3px;
}
#startMenu[hidden] { display: none; }
.smside {
  width: 26px; background: var(--title); color: #fff;
  display: flex; align-items: flex-end; justify-content: center; padding: 8px 0;
}
.smside span { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 700; letter-spacing: 2px; font-size: 12px; }
.smitems { flex: 1; display: flex; flex-direction: column; padding: 2px; }
.smitem {
  background: none; box-shadow: none; text-align: left; padding: 7px 10px;
  font-weight: 400; font-size: 12px; text-decoration: none; color: var(--ink); cursor: pointer;
}
.smitem:hover { background: var(--title); color: #fff; }
.smitems hr { width: 100%; border: none; border-top: 1px solid var(--face-lo); border-bottom: 1px solid var(--face-hi); margin: 3px 0; }

/* ================= dialog ================= */
dialog { padding: 3px; max-width: 400px; border: none; }
dialog .titlebar { background: linear-gradient(90deg, var(--title), var(--title2)); }
dialog .winbody { padding: 14px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.3); }

/* ================= small screens ================= */
@media (max-width: 760px) {
  .icons { flex-direction: row; flex-wrap: wrap; left: 6px; right: 6px; gap: 6px; }
  .dicon { width: 84px; }
  .window {
    left: 2px !important; top: 2px !important; right: 2px;
    width: auto !important; max-width: none;
    max-height: calc(100% - 8px);
  }
  #tray .cap { display: none; }
  #clock { display: none; }
}

/* ---- the mouse: the old arrow, drawn in pixels ---- */
html, body, #desktop, .window, .winbody {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 12 19" shape-rendering="crispEdges"><polygon points="1,1 1,15 4.5,11.5 6.5,17 9,16 7,10.5 11,10.5" fill="white" stroke="black" stroke-width="1"/></svg>') 1 1, default;
}
button, a, select, label, .dicon, .tbtn, .tile.pickable, .smitem, input[type=checkbox] {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 15 19" shape-rendering="crispEdges"><g fill="white" stroke="black" stroke-width="1"><rect x="5" y="1" width="3" height="10"/><rect x="2" y="8" width="11" height="9"/><rect x="8" y="6" width="3" height="4"/><rect x="11" y="7" width="3" height="4"/></g></svg>') 5 1, pointer;
}
input[type=text], input[type=number], textarea { cursor: text; }

/* ---- windows arrive, they do not fade ---- */
@keyframes winpop {
  0% { transform: scale(0.86); }
  100% { transform: scale(1); }
}
.window:not([hidden]) { animation: winpop 0.1s steps(3); }
@media (prefers-reduced-motion: reduce) {
  .window:not([hidden]) { animation: none; }
}

/* ---- the shelf filter dresses like the rest of the machine ---- */
select {
  font: inherit; font-size: 12px; color: var(--ink);
  background: #fff; border: 0; padding: 2px 4px;
  box-shadow: inset -1px -1px 0 #fff, inset 1px 1px 0 #808080,
    inset -2px -2px 0 #dfdfdf, inset 2px 2px 0 #0a0a0a;
  border-radius: 0; appearance: auto;
}
#shelfFilter { align-items: center; }

/* ---- the logon: one user on a blue field, then the desktop ---- */
#logon {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column;
  background: linear-gradient(160deg, #5a7edc 0%, #3f62c8 40%, #2c4aa8 100%);
  color: #fff; opacity: 1; transition: opacity 0.8s ease;
}
#logon.lg-out { opacity: 0; pointer-events: none; }
.lg-top, .lg-bot {
  flex: 0 0 72px; background: linear-gradient(180deg, #002a88, #01369e 60%, #0242b8);
}
.lg-top { border-bottom: 2px solid #7da4e8; box-shadow: 0 2px 8px rgba(0,0,20,0.4); }
.lg-bot {
  border-top: 2px solid #e39b3c; display: flex; align-items: center; padding: 0 28px;
  font-size: 13px;
}
.lg-off { opacity: 0.85; }
.lg-mid { flex: 1; display: flex; align-items: center; justify-content: center; gap: 48px; padding: 24px; }
.lg-left { text-align: right; max-width: 300px; }
.lg-brand { font-size: 34px; font-weight: 400; letter-spacing: 1px; text-shadow: 2px 2px 3px rgba(0,0,40,0.5); }
.lg-brand b { font-weight: 800; }
.lg-brand s { opacity: 0.75; text-decoration-thickness: 3px; text-decoration-color: #ff5a3c; }
.lg-ver { font-size: 15px; vertical-align: super; margin-left: 4px; color: #ffd28a; }
.lg-hint { margin-top: 14px; font-size: 14px; opacity: 0.9; }
.lg-sep { width: 2px; align-self: stretch; margin: 48px 0;
  background: linear-gradient(180deg, transparent, #b9cdf5 20%, #b9cdf5 80%, transparent); }
.lg-user {
  display: flex; align-items: center; gap: 14px; padding: 10px 18px 10px 10px;
  background: transparent; border: 0; color: #fff; font: inherit; text-align: left;
  border-radius: 6px;
}
.lg-user:hover, .lg-user:focus {
  background: linear-gradient(90deg, rgba(255,255,255,0.22), rgba(255,255,255,0.05));
  outline: 1px solid rgba(255,255,255,0.5);
}
.lg-face {
  width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,40,0.5); background: #dfe7f5;
}
.lg-face img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.lg-name { font-size: 20px; text-shadow: 1px 1px 2px rgba(0,0,40,0.5); }
.lg-name s { opacity: 0.75; text-decoration-thickness: 2px; text-decoration-color: #ff5a3c; }
.lg-name small { display: block; font-size: 12px; opacity: 0.8; margin-top: 2px; }
@media (max-width: 700px) {
  .lg-mid { flex-direction: column; gap: 18px; }
  .lg-left { text-align: center; }
  .lg-sep { display: none; }
}
