/* ── Reset & base ── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; overflow: hidden; }

body {
  position: relative;
  background: #1d2638;
  color: #fff;
  user-select: none;
}

/* ── Wallpaper ── */
.wallpaper {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 0.3s, background 0.3s;
}

/* macOS Sequoia-style: layered abstract waves over a dusk gradient */
body.platform-mac .wallpaper {
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, #f7a98f 0%, #b67aa8 35%, transparent 70%),
    radial-gradient(ellipse 100% 80% at 30% 20%, #1f2848 0%, transparent 50%),
    linear-gradient(180deg, #0c1430 0%, #1a2454 35%, #4d3a6f 65%, #7d5d8a 100%);
}
body.platform-mac .wallpaper::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 40% at 60% 70%, rgba(255, 180, 140, 0.35) 0%, transparent 60%),
    radial-gradient(ellipse 60% 30% at 20% 60%, rgba(180, 140, 220, 0.3) 0%, transparent 65%);
  mix-blend-mode: screen;
}
body.platform-mac .wallpaper::after {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' x2='0' y1='0' y2='1'%3E%3Cstop offset='0' stop-color='%23ffffff' stop-opacity='0.06'/%3E%3Cstop offset='1' stop-color='%23ffffff' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 720 C 320 620, 720 800, 1080 700 S 1500 580, 1600 640 L 1600 1000 L 0 1000 Z' fill='%23ffffff' fill-opacity='0.05'/%3E%3Cpath d='M0 800 C 360 700, 760 880, 1180 780 S 1540 700, 1600 740 L 1600 1000 L 0 1000 Z' fill='%23ffffff' fill-opacity='0.04'/%3E%3Cpath d='M0 880 C 400 800, 800 920, 1240 860 S 1580 820, 1600 840 L 1600 1000 L 0 1000 Z' fill='%23ffffff' fill-opacity='0.03'/%3E%3C/svg%3E");
  background-size: cover;
}

/* Windows 11-style: deep blue base + soft photographic bloom */
body.platform-win .wallpaper {
  background:
    radial-gradient(ellipse 60% 55% at 50% 50%, rgba(95, 165, 255, 0.32) 0%, transparent 65%),
    radial-gradient(ellipse 90% 80% at 50% 50%, #2a64d6 0%, #163e9a 35%, #0a2160 70%, #050f3a 100%);
}
body.platform-win .wallpaper::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000' preserveAspectRatio='xMidYMid slice'%3E%3Cdefs%3E%3CradialGradient id='core' cx='0.5' cy='0.5' r='0.5'%3E%3Cstop offset='0' stop-color='%23ffffff' stop-opacity='0.85'/%3E%3Cstop offset='0.25' stop-color='%23a8d4ff' stop-opacity='0.6'/%3E%3Cstop offset='0.6' stop-color='%234e9aff' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%231a4fb8' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='petalA' cx='0.5' cy='0.5' r='0.5'%3E%3Cstop offset='0' stop-color='%23d4ebff' stop-opacity='0.55'/%3E%3Cstop offset='0.5' stop-color='%2386b9ff' stop-opacity='0.25'/%3E%3Cstop offset='1' stop-color='%23355fbf' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='petalB' cx='0.5' cy='0.5' r='0.5'%3E%3Cstop offset='0' stop-color='%23ffffff' stop-opacity='0.5'/%3E%3Cstop offset='0.6' stop-color='%2371a8ee' stop-opacity='0.18'/%3E%3Cstop offset='1' stop-color='%231a3a8f' stop-opacity='0'/%3E%3C/radialGradient%3E%3Cfilter id='soft' x='-25%25' y='-25%25' width='150%25' height='150%25'%3E%3CfeGaussianBlur stdDeviation='28'/%3E%3C/filter%3E%3Cfilter id='gentle' x='-25%25' y='-25%25' width='150%25' height='150%25'%3E%3CfeGaussianBlur stdDeviation='12'/%3E%3C/filter%3E%3C/defs%3E%3Cg transform='translate(800 500)' filter='url(%23soft)'%3E%3Cg transform='rotate(15)'%3E%3Cellipse rx='340' ry='130' fill='url(%23petalA)'/%3E%3C/g%3E%3Cg transform='rotate(60)'%3E%3Cellipse rx='320' ry='110' fill='url(%23petalA)'/%3E%3C/g%3E%3Cg transform='rotate(105)'%3E%3Cellipse rx='340' ry='130' fill='url(%23petalA)'/%3E%3C/g%3E%3Cg transform='rotate(150)'%3E%3Cellipse rx='320' ry='110' fill='url(%23petalA)'/%3E%3C/g%3E%3Cg transform='rotate(-30)'%3E%3Cellipse rx='340' ry='130' fill='url(%23petalA)'/%3E%3C/g%3E%3Cg transform='rotate(-75)'%3E%3Cellipse rx='320' ry='110' fill='url(%23petalA)'/%3E%3C/g%3E%3C/g%3E%3Cg transform='translate(800 500)' filter='url(%23gentle)'%3E%3Cg transform='rotate(40)'%3E%3Cellipse rx='240' ry='80' fill='url(%23petalB)'/%3E%3C/g%3E%3Cg transform='rotate(85)'%3E%3Cellipse rx='240' ry='80' fill='url(%23petalB)'/%3E%3C/g%3E%3Cg transform='rotate(130)'%3E%3Cellipse rx='240' ry='80' fill='url(%23petalB)'/%3E%3C/g%3E%3Cg transform='rotate(-5)'%3E%3Cellipse rx='240' ry='80' fill='url(%23petalB)'/%3E%3C/g%3E%3Cg transform='rotate(-50)'%3E%3Cellipse rx='240' ry='80' fill='url(%23petalB)'/%3E%3C/g%3E%3Cg transform='rotate(-95)'%3E%3Cellipse rx='240' ry='80' fill='url(%23petalB)'/%3E%3C/g%3E%3C/g%3E%3Cellipse cx='800' cy='500' rx='320' ry='320' fill='url(%23core)'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
body.platform-win .wallpaper::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 40% 35% at 50% 50%, rgba(255, 255, 255, 0.18) 0%, transparent 60%);
}

/* ── macOS menu bar ── */
.menu-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 26px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 13px;
  color: #fff;
  z-index: 50;
  display: none; /* hidden until platform-mac applied */
}
body.platform-mac .menu-bar { display: flex; }

.menu-left { display: flex; gap: 18px; align-items: center; flex: 1; }
.menu-right { display: flex; gap: 14px; align-items: center; }
.menu-apple { font-weight: 600; font-size: 14px; }
.menu-app { font-weight: 600; }
.menu-item { font-weight: 400; opacity: 0.95; cursor: default; }

.menu-right .tray-icon {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  height: 22px;
  transition: background 0.12s;
}
.menu-right .tray-icon:hover { background: rgba(255,255,255,0.18); }
.menu-right .tray-icon img { width: 18px; height: 18px; display: block; border-radius: 4px; }

.menu-clock { font-variant-numeric: tabular-nums; opacity: 0.95; }

/* ── Windows taskbar ── */
.taskbar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 48px;
  background: rgba(20, 25, 35, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
body.platform-win .taskbar { display: flex; }
.taskbar-start {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  cursor: default;
  margin: 0 4px;
}
.taskbar-start:hover { background: rgba(255,255,255,0.08); }
.taskbar-start svg { width: 20px; height: 20px; }
.taskbar-tray {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
}
.taskbar-tray-icon {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  cursor: pointer;
}
.taskbar-tray-icon:hover { background: rgba(255,255,255,0.08); }
.taskbar-tray-icon img { width: 18px; height: 18px; border-radius: 4px; }

/* Show only the platform-appropriate tray icon */
body.platform-win [data-tray="mac"] { display: none; }
body.platform-mac [data-tray="win"] { display: none; }

/* ── Platform toggle ── */
.platform-toggle {
  position: absolute;
  bottom: 12px; left: 12px;
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  border-radius: 6px;
  padding: 2px;
  z-index: 100;
  font-size: 11px;
  font-weight: 500;
}
body.platform-win .platform-toggle { bottom: 60px; } /* clear taskbar */
.platform-toggle button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
}
.platform-toggle button.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

/* ── Demo controls panel ── */
.demo-panel {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(calc(-100% + 32px), -50%);
  width: 280px;
  background: rgba(20, 25, 35, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-left: none;
  border-radius: 0 10px 10px 0;
  padding: 16px;
  color: #fff;
  font-size: 13px;
  z-index: 200;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 8px 0 32px rgba(0,0,0,0.4);
}
.demo-panel.open { transform: translate(0, -50%); }
.demo-panel-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 80px;
  background: rgba(255,255,255,0.06);
  border: none;
  border-left: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  border-radius: 0 8px 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.04em;
  writing-mode: vertical-lr;
  transform-origin: center;
}
.demo-panel-toggle:hover { background: rgba(255,255,255,0.12); color: #fff; }
.demo-panel-content { margin-right: 32px; }
.demo-panel h2 {
  font-size: 14px; margin: 0 0 4px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.demo-panel .subtitle {
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  margin-bottom: 16px;
}
.demo-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.demo-section:last-child { border-bottom: none; }
.demo-section h3 {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  margin: 0 0 8px;
}
.demo-btn {
  display: block;
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.06);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 6px;
  text-align: left;
  transition: background 0.12s;
}
.demo-btn:hover { background: rgba(255,255,255,0.14); }
.demo-btn.primary { background: #4a8fff; border-color: #4a8fff; }
.demo-btn.primary:hover { background: #5a9fff; }
.demo-btn.danger { background: rgba(255, 80, 80, 0.18); border-color: rgba(255,80,80,0.3); }
.demo-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12px;
}
.demo-toggle .switch {
  width: 32px; height: 18px;
  background: rgba(255,255,255,0.18);
  border-radius: 9px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.demo-toggle .switch::after {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.15s;
}
.demo-toggle.on .switch { background: #4a8fff; }
.demo-toggle.on .switch::after { left: 16px; }
.demo-clock {
  background: rgba(255,255,255,0.05);
  padding: 8px;
  border-radius: 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.demo-clock-label { color: rgba(255,255,255,0.55); }
.demo-clock-value { color: #fff; }

/* ── App windows (iframes) ── */
#desktop-windows {
  position: absolute; inset: 0;
  pointer-events: none;
}
.app-window {
  position: absolute;
  pointer-events: auto;
  background: transparent;
  overflow: hidden;
  border-radius: 12px;
}
.app-window.frameless { border-radius: 12px; }
.app-window.has-shadow { box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05); }
.app-window iframe {
  width: 100%; height: 100%;
  border: none;
  background: transparent;
  display: block;
  border-radius: inherit;
}
body.platform-win .app-window { border-radius: 4px; }
body.platform-win .app-window.frameless { border-radius: 4px; }

.app-window.fullscreen {
  left: 0 !important; top: 0 !important; right: 0 !important; bottom: 0 !important;
  width: 100% !important; height: 100% !important;
  border-radius: 0 !important;
}

/* ── Demo toast ── */
.demo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 16px);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9999;
  pointer-events: none;
}
body.platform-win .demo-toast { bottom: 64px; } /* clear taskbar */
.demo-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Banner / hint ── */
.demo-hint {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  pointer-events: none;
  max-width: 360px;
  line-height: 1.5;
}
body.platform-mac .demo-hint { top: 38%; }
.demo-hint .arrow {
  position: absolute;
  font-size: 22px;
  color: rgba(255,255,255,0.5);
}
