#014 style light mobile: high Zine & Retro-Brutalist

Poolsuite Retro OS Zine

Sun-drenched peach-cream retro desktop windows, halftone textures, and an interactive poolside FM zine player.

Inspired by Poolsuite ↗

Download .html
Fullscreen ↗

WHY THIS AESTHETIC IS UNIQUE

Blends 1980s Macintosh window chrome with sun-bleached summer print zines: beveled 2px window titlebars, subtle halftone dither patterns, coral accents, and a playable interactive FM radio widget.

BEST FOR

Music labels & internet radioLifestyle & summer beverage brandsInteractive creative portfoliosIndie digital zines

TAGS

COLOR PALETTE (CLICK TO COPY HEX)

TYPOGRAPHY

Display
Playfair Display, Georgia, serif
Body
Space Mono, Courier New, monospace
Mono
Space Mono, ui-monospace, monospace
Scale
Retro editorial serif titles paired with crisp pixel-adjacent monospace window chrome and track readouts.

Google Fonts Stylesheet ↗

ARCHITECTURE & MOBILE NOTES

LAYOUT

Top OS-style menu bar, sunlit halftone desktop canvas hosting beveled 2px-bordered floating windows (FM Player, Summer Zine Reader, Mixtape Log) that can be focused or switched.

INTERACTION

Working channel switcher (Official Poolsuite, Indie Summer, Tokyo Disco, Hangover Club), play/pause button driving an animated Canvas equalizer, track progress scrubber, and window-tab focus switcher.

MOBILE

Desktop windows cleanly un-float into a tidy stacked deck with top tab pills on 390px screens, preserving retro window chrome without awkward dragging or overflow.

AI AGENT GUARDRAILS

DO

  • Style panels as beveled 2px-bordered retro OS windows with striped or solid titlebars
  • Use warm sun-washed peach/cream tones rather than cold gray Windows 95 defaults
  • Include tactile mechanical buttons with crisp 1-2px inset/outset borders

DON'T

  • Do not force freeform drag-only windows on small mobile viewports
  • Do not mix sleek modern iOS blur panels into the retro chrome
STANDALONE SOURCE · demos/poolsuite-retro-zine.html (26.5 KB)
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>SUNDECK FM — Retro Poolside Zine &amp; Radio OS</title>
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,500;0,6..72,700;1,6..72,500&family=VT323&family=IBM+Plex+Mono:wght@400;600&display=swap" rel="stylesheet">
  <style>
    :root {
      --canvas: #F6E4D2;
      --surface: #EFE0CE;
      --paper: #FBF3EA;
      --ink: #1F181B;
      --accent: #E85D3F;
      --muted: #7A6860;
      --bevel-light: #FFF8F0;
      --bevel-dark: #9B8577;
      --font-serif: 'Newsreader', Georgia, serif;
      --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
      --font-pixel: 'VT323', ui-monospace, monospace;
    }

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

    html, body {
      margin: 0;
      padding: 0;
      min-height: 100%;
      background-color: var(--canvas);
      /* Subtle retro halftone/dither desktop texture */
      background-image:
        radial-gradient(rgba(31, 24, 27, 0.14) 1px, transparent 1px),
        radial-gradient(rgba(232, 93, 63, 0.09) 1px, transparent 1px);
      background-size: 8px 8px;
      background-position: 0 0, 4px 4px;
      color: var(--ink);
      font-family: var(--font-mono);
      font-size: 13px;
      line-height: 1.45;
      overflow-x: hidden;
    }

    /* Classic Mac OS Top Menu Bar */
    .os-menubar {
      position: sticky;
      top: 0;
      z-index: 50;
      background: var(--paper);
      border-bottom: 2px solid var(--ink);
      padding: 0.35rem 0.9rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      box-shadow: 0 2px 0 rgba(31, 24, 27, 0.12);
    }

    .os-brand {
      display: flex;
      align-items: center;
      gap: 0.65rem;
      font-weight: 600;
      font-size: 0.85rem;
    }

    .palm-badge {
      display: inline-grid;
      place-items: center;
      width: 24px;
      height: 24px;
      background: var(--accent);
      color: var(--paper);
      border: 1.5px solid var(--ink);
      font-size: 0.8rem;
      font-weight: 700;
    }

    .os-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
    }

    .os-tab-btn {
      min-height: 36px;
      padding: 0.25rem 0.7rem;
      background: var(--surface);
      border: 2px solid var(--ink);
      box-shadow: inset 1px 1px 0 var(--bevel-light), inset -1px -1px 0 var(--bevel-dark);
      font-family: var(--font-mono);
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--ink);
      cursor: pointer;
    }

    .os-tab-btn.active {
      background: var(--ink);
      color: var(--paper);
      box-shadow: none;
    }

    .os-clock {
      font-size: 0.8rem;
      color: var(--muted);
      white-space: nowrap;
    }

    /* Desktop Workspace Grid */
    .desktop-stage {
      max-width: 1180px;
      margin: 0 auto;
      padding: 1.5rem 1.15rem 3rem;
      display: grid;
      grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
      gap: 1.5rem;
      align-items: start;
    }

    .right-stack {
      display: flex;
      flex-direction: column;
      gap: 1.5rem;
    }

    /* Beveled Retro Window Chrome */
    .retro-window {
      background: var(--surface);
      border: 2px solid var(--ink);
      box-shadow:
        4px 4px 0 rgba(31, 24, 27, 0.28),
        inset 2px 2px 0 var(--bevel-light),
        inset -2px -2px 0 var(--bevel-dark);
      transition: box-shadow 0.12s ease;
    }

    .retro-window.focused {
      box-shadow:
        6px 6px 0 var(--ink),
        inset 2px 2px 0 var(--bevel-light),
        inset -2px -2px 0 var(--bevel-dark);
    }

    .win-titlebar {
      display: flex;
      align-items: center;
      gap: 0.55rem;
      padding: 0.45rem 0.65rem;
      border-bottom: 2px solid var(--ink);
      background: repeating-linear-gradient(
        to bottom,
        var(--paper) 0px,
        var(--paper) 2px,
        #DECBB7 2px,
        #DECBB7 4px
      );
      cursor: pointer;
    }

    .retro-window.focused .win-titlebar {
      background: repeating-linear-gradient(
        to bottom,
        #F7D5C4 0px,
        #F7D5C4 2px,
        var(--paper) 2px,
        var(--paper) 4px
      );
    }

    .win-box {
      width: 14px;
      height: 14px;
      border: 1.5px solid var(--ink);
      background: var(--paper);
      flex-shrink: 0;
    }

    .win-title {
      background: var(--surface);
      padding: 0 0.5rem;
      font-size: 0.8rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      border: 1px solid transparent;
    }

    .win-status {
      margin-left: auto;
      background: var(--surface);
      padding: 0 0.4rem;
      font-size: 0.72rem;
      color: var(--muted);
    }

    .win-body {
      padding: 1rem;
    }

    /* FM Radio Player Window */
    .lcd-screen {
      background: #231D20;
      color: #F6E4D2;
      border: 2px solid var(--ink);
      box-shadow: inset 2px 2px 0 #000;
      padding: 0.85rem;
      margin-bottom: 0.9rem;
    }

    .lcd-top {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 0.5rem;
      margin-bottom: 0.5rem;
    }

    .lcd-freq {
      font-family: var(--font-pixel);
      font-size: 1.85rem;
      color: var(--accent);
      line-height: 1;
    }

    .lcd-badge {
      font-size: 0.72rem;
      padding: 0.15rem 0.45rem;
      border: 1px solid #F6E4D2;
      text-transform: uppercase;
    }

    .lcd-track {
      font-family: var(--font-serif);
      font-size: 1.15rem;
      margin: 0 0 0.15rem;
      color: #FFF8F0;
    }

    .lcd-artist {
      font-size: 0.78rem;
      color: #C7B2A3;
      margin: 0 0 0.75rem;
    }

    canvas#visualizer {
      width: 100%;
      height: 76px;
      display: block;
      background: #171214;
      border: 1px solid #4A3D42;
    }

    /* Scrubber */
    .scrubber-row {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      margin: 0.85rem 0;
      font-size: 0.76rem;
      color: var(--muted);
    }

    .scrubber-row input[type="range"] {
      flex: 1;
      accent-color: var(--accent);
      min-height: 32px;
      cursor: pointer;
    }

    /* Transport Controls */
    .transport-row {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 1rem;
    }

    .retro-btn {
      min-height: 44px;
      padding: 0.45rem 0.95rem;
      background: var(--paper);
      border: 2px solid var(--ink);
      box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark), 2px 2px 0 var(--ink);
      font-family: var(--font-mono);
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--ink);
      cursor: pointer;
    }

    .retro-btn:active {
      box-shadow: inset 2px 2px 0 var(--bevel-dark);
      transform: translate(1px, 1px);
    }

    .retro-btn.primary {
      background: var(--accent);
      color: var(--paper);
      box-shadow: inset 2px 2px 0 #FF8D73, inset -2px -2px 0 #A33720, 2px 2px 0 var(--ink);
    }

    /* Channel Switcher */
    .channel-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0.5rem;
    }

    .channel-btn {
      min-height: 44px;
      padding: 0.45rem 0.65rem;
      text-align: left;
      background: var(--paper);
      border: 2px solid var(--ink);
      font-family: var(--font-mono);
      font-size: 0.78rem;
      color: var(--ink);
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .channel-btn.active {
      background: var(--ink);
      color: var(--paper);
    }

    /* Zine Window */
    .zine-postcard {
      border: 2px solid var(--ink);
      background: var(--paper);
      margin-bottom: 0.9rem;
    }

    .zine-postcard svg {
      width: 100%;
      height: auto;
      display: block;
    }

    .zine-issue-list {
      display: flex;
      flex-direction: column;
      gap: 0.65rem;
    }

    .zine-item {
      padding: 0.75rem;
      background: var(--paper);
      border: 1.5px solid var(--ink);
    }

    .zine-item h3 {
      margin: 0 0 0.25rem;
      font-family: var(--font-serif);
      font-size: 1.08rem;
      font-weight: 700;
    }

    .zine-item p {
      margin: 0;
      font-size: 0.8rem;
      color: var(--muted);
    }

    .zine-kicker {
      font-size: 0.7rem;
      text-transform: uppercase;
      color: var(--accent);
      font-weight: 600;
      margin-bottom: 0.2rem;
    }

    /* Mixtape Notes Window */
    .note-form {
      display: flex;
      gap: 0.45rem;
      margin-bottom: 0.85rem;
    }

    .note-input {
      flex: 1;
      min-width: 0;
      min-height: 44px;
      padding: 0.45rem 0.65rem;
      background: var(--paper);
      border: 2px solid var(--ink);
      font-family: var(--font-mono);
      font-size: 0.82rem;
      color: var(--ink);
    }

    .notes-list {
      list-style: none;
      margin: 0;
      padding: 0;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .notes-list li {
      padding: 0.55rem 0.7rem;
      background: var(--paper);
      border: 1.5px dashed var(--bevel-dark);
      font-size: 0.8rem;
      display: flex;
      justify-content: space-between;
      gap: 0.5rem;
    }

    .note-stamp {
      color: var(--muted);
      font-size: 0.72rem;
      white-space: nowrap;
    }

    /* Responsive Mobile Layout */
    @media (max-width: 820px) {
      .desktop-stage {
        grid-template-columns: 1fr;
        padding: 1rem 0.85rem 2.5rem;
        gap: 1.15rem;
      }
      .os-menubar {
        flex-wrap: wrap;
        padding: 0.5rem 0.75rem;
      }
      .os-tab-btn {
        min-height: 44px;
      }
      .os-clock {
        display: none;
      }
    }

    @media (max-width: 480px) {
      .channel-grid {
        grid-template-columns: 1fr;
      }
      .note-form {
        flex-direction: column;
      }
    }
  </style>
</head>
<body>
  <header class="os-menubar">
    <div class="os-brand">
      <span class="palm-badge">SF</span>
      <span>SUNDECK OS 8.4</span>
    </div>
    <nav class="os-tabs" aria-label="Window switcher">
      <button type="button" class="os-tab-btn active" data-focus-win="winPlayer">Player</button>
      <button type="button" class="os-tab-btn" data-focus-win="winZine">Zine Issues</button>
      <button type="button" class="os-tab-btn" data-focus-win="winNotes">Mixtape Notes</button>
    </nav>
    <div class="os-clock" id="osClock">SUN 04:20 PM</div>
  </header>

  <main class="desktop-stage">
    <!-- Window 1: FM Radio Player -->
    <section class="retro-window focused" id="winPlayer" aria-label="Sundeck FM Radio Player">
      <div class="win-titlebar" data-focus-win="winPlayer">
        <span class="win-box" aria-hidden="true"></span>
        <span class="win-title">Sundeck FM Player</span>
        <span class="win-status" id="playerStatus">STANDBY</span>
      </div>
      <div class="win-body">
        <div class="lcd-screen">
          <div class="lcd-top">
            <span class="lcd-freq" id="stationFreq">98.4 FM</span>
            <span class="lcd-badge" id="stationMood">STEREO // WARM</span>
          </div>
          <p class="lcd-track" id="trackTitle">Solstice Terrace (1984 Tape Dub)</p>
          <p class="lcd-artist" id="trackArtist">Pacific Cabana Club &mdash; Side A</p>
          <canvas id="visualizer" width="480" height="76" aria-label="Audio spectrum visualizer"></canvas>
        </div>

        <div class="scrubber-row">
          <span id="timeElapsed">01:12</span>
          <input type="range" id="trackScrubber" min="0" max="240" value="72" aria-label="Track playback position">
          <span id="timeDuration">04:00</span>
        </div>

        <div class="transport-row">
          <button type="button" class="retro-btn" id="prevTrackBtn" aria-label="Previous track">&laquo; PREV</button>
          <button type="button" class="retro-btn primary" id="playPauseBtn">&#9654; PLAY FM</button>
          <button type="button" class="retro-btn" id="nextTrackBtn" aria-label="Next track">NEXT &raquo;</button>
          <button type="button" class="retro-btn" id="muteSynthBtn" aria-pressed="false">AUDIO: ON</button>
        </div>

        <div class="channel-grid" role="radiogroup" aria-label="Radio channels">
          <button type="button" class="channel-btn active" data-channel="0">
            <span>Poolside FM</span><span>98.4</span>
          </button>
          <button type="button" class="channel-btn" data-channel="1">
            <span>Indie Summer</span><span>101.2</span>
          </button>
          <button type="button" class="channel-btn" data-channel="2">
            <span>Tokyo Disco</span><span>88.9</span>
          </button>
          <button type="button" class="channel-btn" data-channel="3">
            <span>Hangover Club</span><span>93.7</span>
          </button>
        </div>
      </div>
    </section>

    <div class="right-stack">
      <!-- Window 2: Zine Issues -->
      <section class="retro-window" id="winZine" aria-label="Poolside Zine Issues">
        <div class="win-titlebar" data-focus-win="winZine">
          <span class="win-box" aria-hidden="true"></span>
          <span class="win-title">Zine Issues // Vol. 14</span>
          <span class="win-status">3 DISPATCHES</span>
        </div>
        <div class="win-body">
          <div class="zine-postcard">
            <svg viewBox="0 0 460 150" role="img" aria-label="Retro poolside postcard illustration">
              <rect width="460" height="150" fill="#F6E4D2"/>
              <circle cx="368" cy="54" r="30" fill="#E85D3F"/>
              <rect x="0" y="96" width="460" height="54" fill="#2B7A78"/>
              <line x1="0" y1="96" x2="460" y2="96" stroke="#1F181B" stroke-width="2"/>
              <line x1="24" y1="114" x2="140" y2="114" stroke="#F6E4D2" stroke-width="2" stroke-dasharray="10 8"/>
              <line x1="220" y1="128" x2="390" y2="128" stroke="#F6E4D2" stroke-width="2" stroke-dasharray="14 10"/>
              <rect x="24" y="24" width="188" height="52" fill="#FBF3EA" stroke="#1F181B" stroke-width="2"/>
              <text x="36" y="47" font-family="Newsreader, Georgia, serif" font-size="18" font-weight="700" fill="#1F181B">LEISURE DISPATCH</text>
              <text x="36" y="65" font-family="IBM Plex Mono, monospace" font-size="10" fill="#7A6860">PALM SPRINGS &bull; ISSUE 14</text>
            </svg>
          </div>

          <div class="zine-issue-list">
            <article class="zine-item">
              <div class="zine-kicker">Essay &bull; 4 min read</div>
              <h3>Why 1986 Hotel Keycards Had Better Typography</h3>
              <p>A pocket tour of serif hospitality stamps, thermal receipts, and sun-faded pool rules along Highway 111.</p>
            </article>
            <article class="zine-item">
              <div class="zine-kicker">Gear Note &bull; Cassette</div>
              <h3>Packing a Waterproof Walkman for Mediterranean Ferries</h3>
              <p>Type II chrome tapes, spare AA cells, and why 45 minutes per side is the exact length of a good afternoon swim.</p>
            </article>
            <article class="zine-item">
              <div class="zine-kicker">Recipe &bull; Terrace</div>
              <h3>Bitter Orange Spritz Without the Pretension</h3>
              <p>Crushed ice, blood orange soda, a twist of grapefruit peel, and an oversized ceramic tumbler.</p>
            </article>
          </div>
        </div>
      </section>

      <!-- Window 3: Mixtape Notes -->
      <section class="retro-window" id="winNotes" aria-label="Mixtape Liner Notes">
        <div class="win-titlebar" data-focus-win="winNotes">
          <span class="win-box" aria-hidden="true"></span>
          <span class="win-title">Mixtape Notes.txt</span>
          <span class="win-status" id="notesCount">3 NOTES</span>
        </div>
        <div class="win-body">
          <form class="note-form" id="noteForm">
            <input type="text" id="noteInput" class="note-input" placeholder="Drop a track request or poolside note..." maxlength="90" aria-label="Add a mixtape note">
            <button type="submit" class="retro-btn primary">PIN NOTE</button>
          </form>
          <ul class="notes-list" id="notesList">
            <li><span>Play more 1982 Japanese city-pop boogie on 88.9 FM</span><span class="note-stamp">03:45 PM</span></li>
            <li><span>Breeze off the roof deck feels like July already</span><span class="note-stamp">04:02 PM</span></li>
            <li><span>Cassette dub on Track 2 has the warmest snare</span><span class="note-stamp">04:15 PM</span></li>
          </ul>
        </div>
      </section>
    </div>
  </main>

  <script>
    (function () {
      const CHANNELS = [
        {
          name: 'Poolside FM',
          freq: '98.4 FM',
          mood: 'STEREO // WARM',
          freqs: [220, 277.18, 329.63, 415.30],
          tracks: [
            { title: 'Solstice Terrace (1984 Tape Dub)', artist: 'Pacific Cabana Club — Side A', dur: 240 },
            { title: 'Apricot Shade & Ice', artist: 'Marseille Yacht Club', dur: 218 },
            { title: 'VHS Horizon (Balearic Mix)', artist: 'Studio Veranda', dur: 264 }
          ]
        },
        {
          name: 'Indie Summer',
          freq: '101.2 FM',
          mood: 'LO-FI // SUNNY',
          freqs: [246.94, 293.66, 369.99, 440],
          tracks: [
            { title: 'Bicycle Bells on Chestnut St', artist: 'The Linen Shirts', dur: 205 },
            { title: 'Polaroid in the Glovebox', artist: 'Clementine Arcade', dur: 232 }
          ]
        },
        {
          name: 'Tokyo Disco',
          freq: '88.9 FM',
          mood: 'HI-FI // BOOGIE',
          freqs: [261.63, 329.63, 392.00, 493.88],
          tracks: [
            { title: 'Shibuya Midnight Express', artist: 'K. Takahashi & Brass', dur: 256 },
            { title: 'Neon Bayfront Cruiser', artist: 'Harbor City 1983', dur: 224 }
          ]
        },
        {
          name: 'Hangover Club',
          freq: '93.7 FM',
          mood: 'SLOW // VELVET',
          freqs: [196.00, 246.94, 293.66, 369.99],
          tracks: [
            { title: 'Sunday Linen & Espresso', artist: 'Hotel Miramar Trio', dur: 275 },
            { title: 'Pool Tile Echoes', artist: 'Lento Waves', dur: 248 }
          ]
        }
      ];

      let chIdx = 0;
      let trIdx = 0;
      let isPlaying = false;
      let audioMuted = false;
      let elapsed = 72;
      let audioCtx = null;
      let gainNode = null;
      let oscNodes = [];
      let chordStep = 0;
      let tickTimer = null;

      const stationFreq = document.getElementById('stationFreq');
      const stationMood = document.getElementById('stationMood');
      const trackTitle = document.getElementById('trackTitle');
      const trackArtist = document.getElementById('trackArtist');
      const playerStatus = document.getElementById('playerStatus');
      const playPauseBtn = document.getElementById('playPauseBtn');
      const muteSynthBtn = document.getElementById('muteSynthBtn');
      const scrubber = document.getElementById('trackScrubber');
      const timeElapsed = document.getElementById('timeElapsed');
      const timeDuration = document.getElementById('timeDuration');
      const canvas = document.getElementById('visualizer');
      const ctx = canvas.getContext('2d');

      function fmtTime(sec) {
        const m = Math.floor(sec / 60);
        const s = Math.floor(sec % 60);
        return `${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}`;
      }

      function updateTrackUI() {
        const ch = CHANNELS[chIdx];
        const tr = ch.tracks[trIdx % ch.tracks.length];
        stationFreq.textContent = ch.freq;
        stationMood.textContent = ch.mood;
        trackTitle.textContent = tr.title;
        trackArtist.textContent = tr.artist;
        scrubber.max = tr.dur;
        if (elapsed > tr.dur) elapsed = 0;
        scrubber.value = elapsed;
        timeElapsed.textContent = fmtTime(elapsed);
        timeDuration.textContent = fmtTime(tr.dur);
      }

      function stopSynth() {
        oscNodes.forEach(o => { try { o.stop(); } catch (e) {} });
        oscNodes = [];
      }

      function startSynth() {
        if (audioMuted) return;
        try {
          if (!audioCtx) {
            const AC = window.AudioContext || window.webkitAudioContext;
            if (!AC) return;
            audioCtx = new AC();
            gainNode = audioCtx.createGain();
            gainNode.gain.value = 0.04;
            gainNode.connect(audioCtx.destination);
          }
          if (audioCtx.state === 'suspended') audioCtx.resume();
          stopSynth();
          const ch = CHANNELS[chIdx];
          const rootMult = chordStep % 2 === 0 ? 1 : 0.89;
          ch.freqs.forEach((f, i) => {
            const osc = audioCtx.createOscillator();
            osc.type = i % 2 === 0 ? 'triangle' : 'sine';
            osc.frequency.value = f * rootMult;
            osc.connect(gainNode);
            osc.start();
            oscNodes.push(osc);
          });
        } catch (err) {
          // AudioContext blocked or unsupported; visualizer continues cleanly
        }
      }

      function togglePlay() {
        isPlaying = !isPlaying;
        playPauseBtn.innerHTML = isPlaying ? '&#10074;&#10074; PAUSE' : '&#9654; PLAY FM';
        playerStatus.textContent = isPlaying ? 'ON AIR' : 'PAUSED';
        if (isPlaying) {
          startSynth();
          if (!tickTimer) {
            tickTimer = setInterval(() => {
              if (!isPlaying) return;
              elapsed += 1;
              const tr = CHANNELS[chIdx].tracks[trIdx % CHANNELS[chIdx].tracks.length];
              if (elapsed >= tr.dur) {
                elapsed = 0;
                trIdx = (trIdx + 1) % CHANNELS[chIdx].tracks.length;
              }
              if (elapsed % 4 === 0 && !audioMuted) {
                chordStep += 1;
                startSynth();
              }
              updateTrackUI();
            }, 1000);
          }
        } else {
          stopSynth();
        }
      }

      // Canvas 2D Retro Bar Visualizer
      let phase = 0;
      function drawVisualizer() {
        const w = canvas.width;
        const h = canvas.height;
        ctx.fillStyle = '#171214';
        ctx.fillRect(0, 0, w, h);

        const bars = 28;
        const gap = 4;
        const bw = (w - gap * (bars + 1)) / bars;
        for (let i = 0; i < bars; i++) {
          const wave = isPlaying
            ? (Math.sin(phase * 0.08 + i * 0.55) * 0.5 + 0.5) * (Math.cos(phase * 0.04 + i * 0.25) * 0.4 + 0.6)
            : 0.08 + (Math.sin(i * 0.7) * 0.04 + 0.04);
          const bh = Math.max(4, Math.floor(wave * (h - 14)));
          const x = gap + i * (bw + gap);
          const y = h - bh - 4;
          ctx.fillStyle = i % 4 === 0 ? '#E85D3F' : '#F6E4D2';
          ctx.fillRect(x, y, bw, bh);
        }
        if (isPlaying) phase += 1;
        requestAnimationFrame(drawVisualizer);
      }

      playPauseBtn.addEventListener('click', togglePlay);

      document.getElementById('prevTrackBtn').addEventListener('click', () => {
        const len = CHANNELS[chIdx].tracks.length;
        trIdx = (trIdx - 1 + len) % len;
        elapsed = 0;
        updateTrackUI();
      });

      document.getElementById('nextTrackBtn').addEventListener('click', () => {
        const len = CHANNELS[chIdx].tracks.length;
        trIdx = (trIdx + 1) % len;
        elapsed = 0;
        updateTrackUI();
      });

      muteSynthBtn.addEventListener('click', () => {
        audioMuted = !audioMuted;
        muteSynthBtn.textContent = audioMuted ? 'AUDIO: OFF' : 'AUDIO: ON';
        muteSynthBtn.setAttribute('aria-pressed', String(audioMuted));
        if (audioMuted) stopSynth();
        else if (isPlaying) startSynth();
      });

      scrubber.addEventListener('input', e => {
        elapsed = Number(e.target.value);
        timeElapsed.textContent = fmtTime(elapsed);
      });

      document.querySelectorAll('.channel-btn').forEach(btn => {
        btn.addEventListener('click', () => {
          chIdx = Number(btn.dataset.channel);
          trIdx = 0;
          elapsed = 0;
          document.querySelectorAll('.channel-btn').forEach(b => b.classList.toggle('active', b === btn));
          updateTrackUI();
          if (isPlaying) startSynth();
        });
      });

      // Window Focus & Tab Switching
      function focusWindow(winId, shouldScroll) {
        document.querySelectorAll('.retro-window').forEach(w => {
          w.classList.toggle('focused', w.id === winId);
        });
        document.querySelectorAll('.os-tab-btn').forEach(b => {
          b.classList.toggle('active', b.dataset.focusWin === winId);
        });
        if (shouldScroll) {
          const target = document.getElementById(winId);
          if (target) target.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
        }
      }

      document.querySelectorAll('[data-focus-win]').forEach(el => {
        el.addEventListener('click', () => {
          focusWindow(el.dataset.focusWin, el.classList.contains('os-tab-btn'));
        });
      });

      // Mixtape Notes Composer
      const noteForm = document.getElementById('noteForm');
      const noteInput = document.getElementById('noteInput');
      const notesList = document.getElementById('notesList');
      const notesCount = document.getElementById('notesCount');

      noteForm.addEventListener('submit', e => {
        e.preventDefault();
        const text = noteInput.value.trim();
        if (!text) return;
        const now = new Date();
        const stamp = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
        const li = document.createElement('li');
        const spanText = document.createElement('span');
        spanText.textContent = text;
        const spanTime = document.createElement('span');
        spanTime.className = 'note-stamp';
        spanTime.textContent = stamp;
        li.append(spanText, spanTime);
        notesList.prepend(li);
        noteInput.value = '';
        notesCount.textContent = `${notesList.children.length} NOTES`;
      });

      // Live OS Clock
      const clockEl = document.getElementById('osClock');
      function updateClock() {
        const d = new Date();
        const days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];
        clockEl.textContent = `${days[d.getDay()]} ${d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`;
      }

      updateClock();
      setInterval(updateClock, 30000);
      updateTrackUI();
      drawVisualizer();
    })();
  </script>
</body>
</html>