/* Changelog page component — /updates */
function CrtChangelogPage() {
  const t = window.TWEAKS;
  const bp = window.useBreakpoint();

  const versions = [
    {
      v: 'v1.0',
      date: '2026-07-01',
      label: 'OUT OF EARLY ACCESS',
      tagline: 'Out of EA. Builds that matter.',
      color: t.amber,
      status: 'SHIPPED',
      features: [
        { tag: 'NEW', c: t.amber, body: '3 new playable baristas unlocked — The Replacement (BPM 98), The Roasted (BPM 171). Fourth barista BEAN-7 classified pending clearance.' },
        { tag: 'NEW', c: t.amber, body: 'Full localization: Deutsch, Português (Brasil), 한국어, 日本語. 167 strings covering all v0.4–v0.9 content.' },
        { tag: 'NEW', c: t.amber, body: '15 achievements — 10 rebalanced existing + 5 new milestone achievements tied to Endless Mode and faction builds.' },
        { tag: 'BAL', c: t.accentMagenta, body: 'Full balance pass on v0.2–v0.9 player data: affixes, faction bonuses, Endless floor scaling retuned.' },
        { tag: 'SYS', c: t.accentCyan, body: 'Out of Early Access. Price updated per launch decision.' },
      ],
    },
    {
      v: 'v0.9',
      date: '2026-06-22',
      label: 'PLATFORM PASS',
      tagline: 'Linux. Rumble. Mods.',
      color: '#c9b896',
      status: 'SHIPPED',
      features: [
        { tag: 'NEW', c: '#c9b896', body: 'Linux native export — full platform support. Play on Windows, macOS, or Linux.' },
        { tag: 'NEW', c: '#c9b896', body: 'Steam Workshop mod support — custom enemy configs, balance tweaks, cosmetic swaps.' },
        { tag: 'NEW', c: '#c9b896', body: 'Controller rumble — haptic feedback on overdose, crash, and Director hits.' },
        { tag: 'SYS', c: t.amber, body: 'Feature flags: linux_export=true, workshop_mods=false (platform launch), controller_rumble=true.' },
      ],
    },
    {
      v: 'v0.8',
      date: '2026-05-28',
      label: 'THE PROPAGATION VAULTS',
      tagline: 'The Cultivator has been tending something here for sixty years.',
      color: '#7dc985',
      status: 'SHIPPED',
      features: [
        { tag: 'NEW', c: '#7dc985', body: 'Floor 7 — The Propagation Vaults: new biome with The Tendril and The Misting enemy types.' },
        { tag: 'NEW', c: '#7dc985', body: 'The Cultivator — third major boss. Chief Cultivation Engineer, in continuous session since Year Zero.' },
        { tag: 'BAL', c: t.accentMagenta, body: 'Floor 7 enemy density and caffeine drain tuned — longer runs require sustained Zone management.' },
      ],
    },
    {
      v: 'v0.7',
      date: '2026-05-28',
      label: 'THE BLOOM WORKS',
      tagline: 'Pre-Guild fermentation chambers. Sixty years of continuous bloom.',
      color: '#a88250',
      status: 'SHIPPED',
      features: [
        { tag: 'NEW', c: '#a88250', body: 'Floor 5 — The Bloom Works: pre-Guild fermentation chambers, sixty years unattended. The Dregs, The Assessor.' },
        { tag: 'NEW', c: '#a88250', body: 'The Sommelier boss — Senior Sensory Director, in continuous session since Year 3. The evaluation is ongoing.' },
        { tag: 'LORE', c: '#c9b896', body: 'The Bloom Works lore string batch: 18 biome + boss + environment strings integrated.' },
      ],
    },
    {
      v: 'v0.6',
      date: '2026-05-28',
      label: 'COLD STORAGE',
      tagline: 'The building goes deeper. Temperature enforced by policy.',
      color: '#6fa8cc',
      status: 'SHIPPED',
      features: [
        { tag: 'NEW', c: '#6fa8cc', body: 'Floor 4 — Cold Storage: 1.2× caffeine drain, new enemies The Auditor (citation FSM + zone suppression aura), The Concentrate (homing glob → forced Jitter), The Shelfwalker (ceiling patrol → slam).' },
        { tag: 'NEW', c: '#6fa8cc', body: '7 Cold Storage affixes added to loot pool — 4 common, 3 rare. All themed around temperature and compliance.' },
        { tag: 'SYS', c: t.amber, body: 'The Director fight delayed from 16:00 to 21:00 now that Floor 4 exists between you and him.' },
      ],
    },
    {
      v: 'v0.5',
      date: '2026-05-19',
      label: 'THE GRIND',
      tagline: 'Endless floors. Seeded days. No excuses.',
      color: t.accentCyan,
      status: 'SHIPPED',
      features: [
        { tag: 'NEW', c: t.accentCyan, body: "Endless Mode — The Grind: infinite floor escalation with modifier stacking. Floors don't stop. Neither do you." },
        { tag: 'NEW', c: t.accentCyan, body: 'Daily Challenge: seeded run, same for every player each day. Leaderboard-eligible. Resets at 00:00 UTC.' },
        { tag: 'SYS', c: t.amber, body: 'Endless scoring: GP multiplier scales per floor cleared, capped at ×10 on floor 30+.' },
        { tag: 'BAL', c: t.accentMagenta, body: 'Enemy density tuned for Endless — Floor 6+ spawns Elite variants of all faction types.' },
      ],
    },
    {
      v: 'v0.4',
      date: '2026-05-12',
      label: 'GEAR',
      tagline: 'Equip the build. Live the faction.',
      color: '#c9b896',
      status: 'SHIPPED',
      features: [
        { tag: 'NEW', c: '#c9b896', body: 'Gear system live — Apron + Portafilter slots added. 5-slot loadout total.' },
        { tag: 'NEW', c: '#c9b896', body: 'Faction 3-piece set bonuses: Espresso Syndicate, Oat Collective, Cold Brew Cartel. Mix to lose. Match to win.' },
        { tag: 'NEW', c: '#c9b896', body: '30-affix gear pool + Legendary unique modifiers — builds that rewrite the rules of the run.' },
        { tag: 'SYS', c: t.amber, body: 'Break Room Stash updated: compare, equip, and swap gear between runs.' },
        { tag: 'BAL', c: t.accentMagenta, body: 'Caffeine cost tuning pass for all Legendary uniques — high-power items cost more to activate.' },
      ],
    },
    {
      v: 'v0.3',
      date: '2026-05-05',
      label: 'TREE',
      tagline: 'Pick your path. Respec is free.',
      color: t.accentMagenta,
      status: 'SHIPPED',
      features: [
        { tag: 'NEW', c: t.accentMagenta, body: 'Skill Tree — ~30 nodes across 3 branches. Unlock by ring as you level: Metabolism, Reflex, Tolerance.' },
        { tag: 'NEW', c: t.accentMagenta, body: 'Epic Affixes — weapons can now roll Epic-tier affixes from a pool of 24 modifiers.' },
        { tag: 'NEW', c: t.accentMagenta, body: 'Rings 3 + 4 of the Skill Tree now accessible — Tier 3 nodes gate behind Floor 2 completion.' },
        { tag: 'SYS', c: t.amber, body: '237 new localization strings added — EN / DE / PT-BR / KO / JP all updated.' },
        { tag: 'SYS', c: t.amber, body: 'XP/Level loop: GP now converts to XP, fills Level bar, grants Skill Points each level-up.' },
        { tag: 'FIX', c: t.accentCyan, body: 'Free instant respec in Break Room — no cost, no cooldown. Try everything.' },
      ],
    },
    {
      v: 'v0.2',
      date: '2026-04-29',
      label: 'FIRST DROP',
      tagline: 'Your first Legendary changes everything.',
      color: t.accentCyan,
      status: 'SHIPPED',
      features: [
        { tag: 'NEW', c: t.accentCyan, body: 'Weapons now drop as loot — Common, Rare, Epic, Legendary tiers with procedural affixes.' },
        { tag: 'NEW', c: t.accentCyan, body: 'Stash UI in Break Room — compare and equip between runs, persist between sessions.' },
        { tag: 'NEW', c: t.accentCyan, body: 'Loadout cap: choose 3 weapon slots before each run. Decision has weight now.' },
        { tag: 'BAL', c: t.accentMagenta, body: 'First full balance pass based on EA telemetry — jitter zone, crash timing, overdose window all retuned.' },
      ],
    },
    {
      v: 'v0.1.x',
      date: '2026-04-21',
      label: 'HOTFIX WAVE',
      tagline: 'Stability first.',
      color: t.amber,
      status: 'SHIPPED',
      features: [
        { tag: 'FIX', c: t.accentCyan, body: 'Crash clusters and progression blockers from first-wave reviews patched.' },
        { tag: 'FIX', c: t.accentCyan, body: 'Data-loss bug: run progress now saves correctly on Alt+F4 and OS-level kills.' },
        { tag: 'BAL', c: t.accentMagenta, body: 'Conservative balance tuning based on early telemetry — jitter damage bonus reduced from +40% to +32%.' },
        { tag: 'ART', c: '#c9b896', body: 'v0.1.1 visual update: top-down sprite pivot for all enemies. All four factions redrawn.' },
      ],
    },
  ];

  const tagColor = { NEW: t.accentCyan, SYS: t.amber, BAL: t.accentMagenta, FIX: t.accentCyan, ART: '#c9b896', LORE: '#c9b896' };

  return (
    <>
      <window.CrtGlobalStyles />
      <div className="crt-root" style={{ minHeight: '100vh' }}>
        <window.CrtTopBar />
        <section style={{ padding: `72px ${bp.isMobile ? 20 : 56}px`, borderBottom: `1px solid rgba(255,179,71,0.18)` }}>
          <div style={{ display: 'flex', alignItems: 'baseline', gap: 16, marginBottom: 28 }}>
            <span style={{ fontSize: 12, letterSpacing: '0.2em', color: '#6e5a44' }}>&gt; S00 :: PATCH_LOG</span>
            <div style={{ flex: 1, height: 1, background: 'rgba(255,179,71,0.2)' }} />
            <span style={{ fontSize: 12, letterSpacing: '0.2em', color: '#6e5a44' }}>2026</span>
          </div>
          <h1 style={{
            fontFamily: '"Oswald","Impact",sans-serif', fontWeight: 700,
            fontSize: (bp.isMobile ? 36 : 48) * t.fontScale,
            letterSpacing: '0.02em', textTransform: 'uppercase',
            color: t.amber, margin: '0 0 12px', lineHeight: 1,
            textShadow: '0 0 20px rgba(255,179,71,0.3)',
          }}>PATCH NOTES · v0.1.x → v1.0</h1>
          <div style={{ fontSize: 14, color: '#a88250', marginBottom: 8, fontFamily: '"JetBrains Mono",monospace' }}>
            &gt; v0.1.x → v1.0 · complete Early Access history_
          </div>
          <div style={{ marginBottom: 40, display: 'flex', gap: 16, flexWrap: 'wrap' }}>
            <a href="/" style={{ textDecoration: 'none' }}>
              <span style={{ fontSize: 12, color: t.accentCyan, letterSpacing: '0.12em', border: `1px solid ${t.accentCyan}33`, padding: '4px 10px' }}>← BACK TO MAIN</span>
            </a>
            <a href="https://store.steampowered.com/app/4673590/Death_Before_Decaf/" target="_blank" rel="noopener" style={{ textDecoration: 'none' }}>
              <span style={{ fontSize: 12, color: t.amber, letterSpacing: '0.12em', border: `1px solid ${t.amber}33`, padding: '4px 10px' }}>▸ STEAM PAGE</span>
            </a>
          </div>

          <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
            {versions.map((ver) => (
              <div key={ver.v} style={{
                border: `1px solid rgba(255,179,71,${ver.status === 'SHIPPING' ? 0.5 : 0.22})`,
                background: '#050302',
                overflow: 'hidden',
              }}>
                {/* Header bar */}
                <div style={{
                  display: 'grid',
                  gridTemplateColumns: bp.isMobile ? '1fr auto' : '180px 1fr auto',
                  gap: 0,
                  borderBottom: `1px solid rgba(255,179,71,0.18)`,
                  background: `rgba(255,179,71,0.03)`,
                }}>
                  <div style={{ padding: bp.isMobile ? '14px 16px' : '16px 24px', borderRight: bp.isMobile ? 'none' : `1px solid rgba(255,179,71,0.15)` }}>
                    <div style={{ fontFamily: '"Oswald",sans-serif', fontSize: 22, color: ver.color, letterSpacing: '0.04em', lineHeight: 1 }}>{ver.v}</div>
                    <div style={{ fontSize: 10, color: '#6e5a44', letterSpacing: '0.18em', marginTop: 3, textTransform: 'uppercase' }}>{ver.label}</div>
                  </div>
                  {!bp.isMobile && (
                    <div style={{ padding: '16px 24px', display: 'flex', alignItems: 'center' }}>
                      <div style={{ fontFamily: '"JetBrains Mono",monospace', fontSize: 13, color: '#c9b896' }}>
                        &gt; {ver.tagline}
                      </div>
                    </div>
                  )}
                  <div style={{ padding: '16px 20px', display: 'flex', alignItems: 'center', justifyContent: 'flex-end', gap: 12 }}>
                    <span style={{ fontSize: 10, color: '#6e5a44', letterSpacing: '0.12em' }}>{ver.date}</span>
                    <span style={{ fontSize: 10, color: t.accentCyan, letterSpacing: '0.18em', padding: '2px 7px', border: `1px solid ${t.accentCyan}44` }}>
                      {ver.status}
                    </span>
                  </div>
                </div>
                {/* Feature list */}
                <div style={{ padding: bp.isMobile ? '16px' : '20px 28px', display: 'flex', flexDirection: 'column', gap: 8 }}>
                  {ver.features.map((f, i) => (
                    <div key={i} style={{ display: 'grid', gridTemplateColumns: '48px 1fr', gap: 12, fontSize: 12, color: '#c9b896', lineHeight: 1.6 }}>
                      <span style={{ color: tagColor[f.tag] || t.amber, letterSpacing: '0.12em', fontSize: 10, marginTop: 2, fontFamily: '"JetBrains Mono",monospace' }}>[{f.tag}]</span>
                      <span>{f.body}</span>
                    </div>
                  ))}
                </div>
              </div>
            ))}
          </div>

          <div style={{ marginTop: 40, padding: '20px 24px', border: `1px solid rgba(255,179,71,0.4)`, background: 'rgba(255,179,71,0.05)', fontSize: 13, color: t.amber }}>
            <div style={{ fontFamily: '"JetBrains Mono",monospace', marginBottom: 8 }}>&gt; v1.0 shipped — Out of Early Access ✓</div>
            <div style={{ fontSize: 12, color: '#c9b896' }}>7 floors · 4 baristas · Skill tree + faction gear · Endless mode · Daily Challenges · EN/DE/PT-BR/KO/JP · Win/Mac/Linux</div>
          </div>
        </section>
        <window.CrtCta />
        <window.CrtFooter />
      </div>
      <window.CrtOverlays />
    </>
  );
}

Object.assign(window, { CrtChangelogPage });
