@font-face { font-family: "Press Start 2P"; src: url("../assets/fonts/press-start-2p-latin.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "VT323"; src: url("../assets/fonts/vt323-latin.woff2") format("woff2"); font-display: swap; }
/* ~*~ The Sound Cloud Machine ~*~  2000s 8-bit x cottagecore x mystic */
:root {
  --cream: #fbf3e0;
  --parchment: #f2e2c0;
  --moss: #6f8f5b;
  --sage: #a9c29a;
  --fern: #3f5e3a;
  --rose: #e6a3a8;
  --blush: #f6d3cf;
  --lavender: #b9a6d9;
  --dusk: #4a3f6b;
  --night: #241d3b;
  --gold: #f2c65c;
  --ink: #3a2c2a;
  --px: 4px;
  --font-px: "Press Start 2P", "Courier New", monospace;
  --font-body: "VT323", "Courier New", monospace;
}

* { box-sizing: border-box; }
html { image-rendering: pixelated; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 22px;
  color: var(--ink);
  background: var(--night);
  min-height: 100vh;
  overflow-x: hidden;
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' shape-rendering='crispEdges'><rect x='7' y='0' width='2' height='16' fill='%23f2c65c'/><rect x='0' y='7' width='16' height='2' fill='%23f2c65c'/><rect x='6' y='6' width='4' height='4' fill='%23fff'/></svg>") 8 8, auto;
}

/* pixel star sky behind everything */
#sky {
  position: fixed; inset: 0; z-index: -2;
  width: 100vw; height: 100vh; object-fit: cover;
  image-rendering: pixelated;
}
#sparkles { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }

/* ---------- header ---------- */
header.title {
  text-align: center; color: var(--cream); padding: 18px 0 6px;
}
header.title h1 {
  font-family: var(--font-px);
  font-size: clamp(18px, 4.2vw, 40px);
  line-height: 1.35; margin: 8px 0;
  color: var(--blush);
  text-shadow: 4px 4px 0 var(--dusk), 8px 8px 0 #000a;
  letter-spacing: 2px;
}
header.title .sub { font-size: 24px; color: var(--sage); }
.marquee {
  overflow: hidden; white-space: nowrap; border-top: 4px dotted var(--gold);
  border-bottom: 4px dotted var(--gold); color: var(--gold); margin: 12px 0 20px;
  font-size: 20px; padding: 4px 0;
}
.marquee span { display: inline-block; padding-left: 100%; animation: marq 28s linear infinite; }
@keyframes marq { to { transform: translateX(-100%); } }

/* ---------- pixel windows ---------- */
.window {
  background: var(--cream);
  border: var(--px) solid var(--ink);
  box-shadow:
    inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--parchment),
    inset var(--px) var(--px) 0 #fff,
    8px 8px 0 #0008;
  margin-bottom: 24px;
  position: relative;
}
.window .bar {
  display: flex; align-items: center; justify-content: space-between;
  background: repeating-linear-gradient(90deg, var(--moss) 0 8px, var(--fern) 8px 16px);
  color: var(--cream); font-family: var(--font-px); font-size: 11px;
  padding: 8px 10px; border-bottom: var(--px) solid var(--ink);
}
.window .bar .dots span {
  display: inline-block; width: 12px; height: 12px; margin-left: 6px;
  background: var(--rose); border: 2px solid var(--ink);
}
.window .bar .dots span:nth-child(2) { background: var(--gold); }
.window .bar .dots span:nth-child(3) { background: var(--sage); }
.window .body { padding: 18px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; justify-content: center; }
/* each tab is a pixel cloud (SVG silhouette, crisp edges) */
.tab {
  font-family: var(--font-px); font-size: 10px; color: var(--ink);
  width: 190px; height: 76px; padding: 24px 10px 0; border: 0; cursor: pointer;
  background: no-repeat center / 100% 100% url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 38 16' preserveAspectRatio='none' shape-rendering='crispEdges'><path fill='%233a2c2a' d='M13 1h6v1h2v1h1v1h3V3h4v1h2v2h1v2h2v1h1v5h-1v1h-2v1H5v-1H3v-1H2v-2H1V9h1V8h2V7h3V5h2V3h2V2h2z'/><path fill='%23f2e2c0' d='M13 2h6v1h2v1h1v1h3V4h4v1h1v2h1v2h2v1h1v3h-1v1h-2v1H5v-1H4v-1H3v-2H2v-1h1V9h2V8h3V6h2V4h2V3h1z'/><path fill='%23ffffff' d='M13 3h4v1h-3v1h-2v1h-1V5h1V4h1z'/></svg>");
  filter: drop-shadow(4px 4px 0 #0008);
  transition: transform .15s steps(3);
}
.tab:nth-child(2) { animation-delay: -1s; } .tab:nth-child(3) { animation-delay: -2s; } .tab:nth-child(4) { animation-delay: -3s; }
.tab { animation: bob 4s steps(4) infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.tab:hover { transform: translateY(-6px) scale(1.04); filter: drop-shadow(4px 8px 0 #0008) hue-rotate(-20deg) saturate(2); }
.tab.active {
  color: var(--dusk);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 38 16' preserveAspectRatio='none' shape-rendering='crispEdges'><path fill='%233a2c2a' d='M13 1h6v1h2v1h1v1h3V3h4v1h2v2h1v2h2v1h1v5h-1v1h-2v1H5v-1H3v-1H2v-2H1V9h1V8h2V7h3V5h2V3h2V2h2z'/><path fill='%23b9a6d9' d='M13 2h6v1h2v1h1v1h3V4h4v1h1v2h1v2h2v1h1v3h-1v1h-2v1H5v-1H4v-1H3v-2H2v-1h1V9h2V8h3V6h2V4h2V3h1z'/><path fill='%23fbf3e0' d='M13 3h4v1h-3v1h-2v1h-1V5h1V4h1z'/><path fill='%23f2c65c' d='M33 2h1v1h1v1h-1v1h-1V4h-1V3h1z'/></svg>");
}

/* ---------- controls ---------- */
.drop {
  display: block;
  border: var(--px) dashed var(--moss); background:
    repeating-linear-gradient(45deg, #fff6 0 6px, transparent 6px 12px), var(--blush);
  padding: 26px; text-align: center; cursor: pointer; transition: transform .1s steps(2);
}
.drop:hover, .drop.over { transform: translate(-2px, -2px); background-color: var(--sage); }
.drop .big { font-family: var(--font-px); font-size: 13px; color: var(--dusk); line-height: 1.8; }
.drop input { display: none; }

.row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.col { flex: 1 1 300px; min-width: 0; }

label.lbl { font-family: var(--font-px); font-size: 10px; color: var(--fern); display: block; margin: 14px 0 6px; }

.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mode {
  border: 3px solid var(--ink); background: var(--parchment); padding: 8px; cursor: pointer;
  font-size: 19px; line-height: 1.05;
}
.mode b { font-family: var(--font-px); font-size: 9px; line-height: 1.5; display: block; margin-bottom: 6px; color: var(--dusk); }
.mode.sel { background: var(--lavender); box-shadow: inset 0 0 0 3px var(--cream); }
.mode:hover { background: var(--blush); }

select, input[type=range] { width: 100%; font-family: var(--font-body); font-size: 20px; }
select { border: 3px solid var(--ink); background: var(--cream); padding: 4px; }
input[type=range] { accent-color: var(--moss); }

.btn {
  font-family: var(--font-px); font-size: 12px; padding: 14px 18px; margin: 14px 8px 0 0;
  background: var(--gold); color: var(--ink); border: var(--px) solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink); cursor: pointer;
}
.btn:hover { background: var(--rose); }
.btn:active { transform: translate(4px, 4px); box-shadow: none; }
.btn[disabled] { opacity: .45; cursor: wait; }
.btn.alt { background: var(--sage); }

/* ---------- results ---------- */
canvas.pix { width: 100%; image-rendering: pixelated; border: var(--px) solid var(--ink); background: #9fc3e6; display: block; }
.card {
  background: var(--parchment); border: 3px solid var(--ink); padding: 14px; margin-top: 12px;
}
.card h3 { font-family: var(--font-px); font-size: 14px; margin: 0 0 10px; color: var(--dusk); line-height: 1.5; }
.card .latin { font-style: italic; color: var(--moss); }
.card p { margin: 6px 0; line-height: 1.05; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; font-size: 18px; margin-top: 8px; }
.meter { display: flex; align-items: center; gap: 6px; }
.meter i { flex: 1; height: 10px; background: #fff; border: 2px solid var(--ink); position: relative; }
.meter i::after { content: ""; position: absolute; inset: 0; width: var(--v); background: repeating-linear-gradient(90deg, var(--moss) 0 4px, var(--sage) 4px 8px); }
.chips span { display: inline-block; border: 2px solid var(--ink); padding: 0 6px; margin: 2px; background: var(--cream); font-size: 18px; }
.chips span.top { background: var(--gold); }

.status { font-size: 20px; color: var(--dusk); min-height: 26px; margin-top: 10px; }
.status .blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

audio { width: 100%; margin-top: 12px; }
.scope { width: 100%; height: 90px; image-rendering: pixelated; border: 3px solid var(--ink); background: var(--night); display: block; margin-top: 10px; }

.hidden { display: none !important; }

footer { text-align: center; color: var(--sage); font-size: 18px; margin-top: 30px; }
footer .counter { font-family: var(--font-px); font-size: 10px; background: #000; color: #7CFC00; padding: 4px 8px; border: 2px inset #888; display: inline-block; margin: 8px; letter-spacing: 3px; }
.deco { font-size: 26px; letter-spacing: 6px; color: var(--rose); }

@media (max-width: 600px) {
  body { font-size: 20px; }
  .meters { grid-template-columns: 1fr; }
}

/* live sky widget */
.skynow { position: fixed; top: 14px; right: 14px; width: 250px; z-index: 20; margin: 0; }
.skynow .body { padding: 10px 12px; font-size: 19px; line-height: 1.1; }
.skynow .clock { font-family: var(--font-px); font-size: 18px; color: var(--dusk); letter-spacing: 1px; }
.skynow .tz { color: var(--moss); font-size: 17px; margin: 2px 0 6px; }
.skynow .fc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 8px 0 2px; text-align: center; font-size: 16px; }
.skynow .fc div { background: var(--parchment); border: 2px solid var(--ink); padding: 2px 0; }
.skynow .fc b { display: block; font-size: 20px; color: var(--dusk); }
.btn.mini { font-size: 8px; padding: 8px 8px; margin: 8px 6px 0 0; box-shadow: 3px 3px 0 var(--ink); }
.skynow audio { margin-top: 8px; height: 32px; }
.skynow.collapsed .body { display: none; }
.skynow .bar { cursor: pointer; }
#atlasGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
#atlasGrid .col { min-width: 0; }
@media (max-width: 1500px) { .skynow { position: relative; top: auto; right: auto; width: auto; max-width: 520px; margin: 0 auto 18px; } }
