@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=SF+Mono:wght@500&family=JetBrains+Mono:wght@500&display=swap");

:root {
  --menu-h: 28px;
  --glass: rgba(40, 40, 45, 0.72);
  --glass-border: rgba(255,255,255,0.12);
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --blue: #0a84ff;
  --win-bar: #3a3a3c;
  --dock-ico: 48px;
  --desk-ico: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #000;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* Boot */
#boot {
  position: fixed; inset: 0; z-index: 100;
  background: #000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 36px;
}
#boot.fade { opacity: 0; transition: opacity 0.5s; pointer-events: none; }
.boot-bar {
  width: 160px; height: 4px; background: #333; border-radius: 99px; overflow: hidden;
}
#boot-fill {
  height: 100%; width: 0%; background: #fff; border-radius: 99px;
  transition: width 0.15s linear;
}

/* Desktop */
#desktop {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 30% 20%, #4a7ab8 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 80% 80%, #2a4a70 0%, transparent 45%),
    linear-gradient(165deg, #1a3a5c 0%, #0d2840 40%, #1a2a40 70%, #0a1828 100%);
}
#desktop.hidden { display: none; }

/* Menu bar */
#menubar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--menu-h);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 12px 0 8px;
  background: rgba(30, 30, 32, 0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
  z-index: 50;
}
#menubar .left, #menubar .right { display: flex; align-items: center; gap: 2px; }
#menubar .apple {
  border: none; background: transparent; color: #fff;
  font-size: 16px; padding: 0 10px; height: 28px; cursor: default;
  line-height: 28px;
}
#menubar .apple:hover, #menubar .m:hover { background: rgba(255,255,255,0.12); }
#menubar .app-name { font-weight: 700; padding: 0 10px; }
#menubar .m {
  border: none; background: transparent; color: #fff;
  font: inherit; font-size: 13px; padding: 0 10px; height: 28px; cursor: default;
}
#menubar .m.active-toggle {
  background: rgba(10, 132, 255, 0.45);
  border-radius: 4px;
}
#clock { font-variant-numeric: tabular-nums; padding: 0 8px; font-size: 13px; }

.menu-pop {
  position: absolute; top: var(--menu-h); left: 4px; z-index: 60;
  min-width: 220px;
  background: rgba(40,40,44,0.92);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 12px 40px #0008;
}
.menu-pop.hidden { display: none; }
.menu-pop button {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; color: #fff;
  font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 5px; cursor: default;
}
.menu-pop button:hover { background: var(--blue); }
.menu-pop hr { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 4px 8px; }

/* Desktop icons */
#desk-icons {
  position: absolute; top: calc(var(--menu-h) + 16px); right: 16px;
  display: flex; flex-direction: column; gap: 16px; z-index: 5;
}
.desk-icon {
  width: 80px; border: none; background: transparent; color: #fff;
  cursor: default; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font: inherit; font-size: 11px; text-shadow: 0 1px 3px #000a;
  padding: 6px; border-radius: 8px;
}
.desk-icon:hover { background: rgba(255,255,255,0.08); }
.desk-icon:focus { outline: 2px solid rgba(10,132,255,0.6); }
.desk-icon .ico { width: var(--desk-ico); height: var(--desk-ico); border-radius: 10px; }

/* Dock */
#dock-wrap {
  position: absolute; left: 0; right: 0; bottom: 8px;
  display: flex; justify-content: center; z-index: 40;
  pointer-events: none;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
#dock {
  pointer-events: auto;
  display: flex; align-items: flex-end; gap: 4px;
  padding: 6px 10px 8px;
  background: rgba(40, 40, 45, 0.45);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  box-shadow: 0 12px 40px #0006;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.dock-item {
  border: none; background: transparent; padding: 2px; cursor: default;
  transition: transform 0.12s ease;
  flex-shrink: 0;
}
.dock-item:hover { transform: scale(1.28) translateY(-8px); }
.dock-item .ico {
  width: var(--dock-ico); height: var(--dock-ico); border-radius: 11px;
  box-shadow: 0 2px 8px #0005;
}
.dock-item.open::after {
  content: ""; display: block; width: 4px; height: 4px;
  background: #ccc; border-radius: 50%; margin: 3px auto 0;
}
.dock-sep {
  width: 1px; height: 40px; background: rgba(255,255,255,0.2);
  margin: 0 4px 8px;
  flex-shrink: 0;
}

/* ——— Mac-like icons (squircle + inner glyph) ——— */
.ico {
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    0 2px 8px rgba(0,0,0,0.35);
}
.ico::before,
.ico::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.ico.finder {
  background: linear-gradient(160deg, #6ec8ff 0%, #1a8cff 45%, #0060d6 100%);
}
.ico.finder::before {
  left: 10px; top: 12px; width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 14px 0 0 #fff;
  opacity: 0.95;
}
.ico.finder::after {
  left: 14px; top: 22px; width: 8px; height: 8px;
  border-radius: 50%;
  background: #1a3a60;
  box-shadow: 14px 0 0 #1a3a60;
}

.ico.safari {
  background: radial-gradient(circle at 40% 35%, #9ae0ff, #0a84ff 55%, #0050c0);
  border-radius: 50% !important;
}
.ico.safari::before {
  left: 50%; top: 50%;
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 18px solid #ff3b30;
  transform: translate(-50%, -70%) rotate(25deg);
  transform-origin: 50% 100%;
}
.ico.safari::after {
  left: 50%; top: 50%;
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 14px solid #fff;
  transform: translate(-50%, 10%) rotate(25deg);
}

.ico.messages {
  background: linear-gradient(160deg, #64e07a, #34c759 50%, #1a9a3a);
}
.ico.messages::before {
  left: 10px; top: 12px; width: 28px; height: 20px;
  background: #fff;
  border-radius: 12px;
}
.ico.messages::after {
  left: 14px; top: 28px;
  border: 6px solid transparent;
  border-top-color: #fff;
  border-right-color: #fff;
  transform: rotate(20deg);
}

.ico.mail {
  background: linear-gradient(160deg, #7ec8ff, #0a84ff 60%, #0066d6);
}
.ico.mail::before {
  left: 8px; top: 14px; width: 32px; height: 22px;
  background: #fff;
  border-radius: 3px;
}
.ico.mail::after {
  left: 8px; top: 14px; width: 32px; height: 12px;
  background: linear-gradient(135deg, transparent 48%, #0a84ff 49%, #0a84ff 51%, transparent 52%),
    linear-gradient(225deg, transparent 48%, #0a84ff 49%, #0a84ff 51%, transparent 52%);
  background-size: 50% 100%, 50% 100%;
  background-position: left, right;
  background-repeat: no-repeat;
  opacity: 0.35;
}

.ico.maps {
  background:
    linear-gradient(135deg, transparent 40%, #ff9f0a 40%, #ff9f0a 48%, transparent 48%),
    linear-gradient(160deg, #64d2ff 0%, #30d158 45%, #ffd60a 100%);
}
.ico.maps::before {
  left: 18px; top: 10px;
  width: 12px; height: 12px;
  background: #ff3b30;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 0 0 2px #fff;
}

.ico.photos {
  background: #1c1c1e;
}
.ico.photos::before {
  inset: 8px;
  border-radius: 50%;
  background: conic-gradient(
    #ff375f, #ff9f0a, #ffd60a, #30d158, #64d2ff, #bf5af2, #ff375f
  );
}

.ico.notes {
  background: linear-gradient(180deg, #fff 0 28%, #ffd60a 28% 100%);
}
.ico.notes::before {
  left: 12px; top: 20px; right: 12px; height: 2px;
  background: #c9a000;
  box-shadow: 0 6px 0 #e8c200, 0 12px 0 #e8c200, 0 18px 0 #e8c200;
  width: auto;
}

.ico.calc {
  background: linear-gradient(160deg, #4a4a4e, #1c1c1e);
}
.ico.calc::before {
  left: 8px; top: 8px; width: 32px; height: 10px;
  background: #111;
  border-radius: 2px;
}
.ico.calc::after {
  left: 8px; top: 22px;
  width: 6px; height: 6px;
  background: #ff9f0a;
  border-radius: 50%;
  box-shadow:
    9px 0 #555, 18px 0 #555, 27px 0 #555,
    0 9px #555, 9px 9px #555, 18px 9px #555, 27px 9px #ff9f0a,
    0 18px #555, 9px 18px #555, 18px 18px #555, 27px 18px #ff9f0a;
}

.ico.terminal {
  background: linear-gradient(160deg, #3a3a3c, #000);
}
.ico.terminal::before {
  left: 12px; top: 16px;
  color: #30d158;
  content: ">_";
  font: 700 14px/1 ui-monospace, monospace;
  width: auto; height: auto;
  background: none;
}

.ico.settings {
  background: linear-gradient(160deg, #b0b0b5, #636366 50%, #3a3a3c);
}
.ico.settings::before {
  left: 50%; top: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border: 4px solid #e8e8ed;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #e8e8ed;
  background: #636366;
  background-clip: padding-box;
}

.ico.trash {
  background: linear-gradient(180deg, #d0d0d4, #8e8e93);
}
.ico.trash::before {
  left: 14px; top: 10px; width: 20px; height: 4px;
  background: #5a5a5e;
  border-radius: 2px;
  box-shadow: 0 4px 0 0 #6a6a70, 2px 8px 0 6px #7a7a80;
}
.ico.trash::after {
  left: 16px; top: 22px; width: 16px; height: 18px;
  background: #9a9aa0;
  border-radius: 0 0 3px 3px;
  box-shadow: inset 4px 0 0 #888, inset -4px 0 0 #888;
}

.ico.about {
  background: linear-gradient(160deg, #6ec8ff, #007aff);
}

.ico.games {
  background: linear-gradient(145deg, #bf5af2, #5e5ce6 50%, #0a84ff);
}
.ico.games::before {
  left: 12px; top: 14px; width: 24px; height: 16px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}
.ico.games::after {
  left: 16px; top: 18px;
  width: 5px; height: 5px;
  background: #5e5ce6;
  border-radius: 50%;
  box-shadow: 10px 0 #ff375f, 5px 6px #30d158;
}

.ico.roblox {
  background: linear-gradient(145deg, #e2231a, #a01010);
}
.ico.roblox::before {
  left: 50%; top: 50%;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  background: #fff;
  transform: rotate(25deg);
  border-radius: 3px;
  box-shadow: inset 0 0 0 3px #e2231a;
}

/* Game tiles */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  padding: 4px;
}
.game-card {
  border: none;
  background: #2c2c2e;
  border-radius: 12px;
  padding: 12px;
  text-align: left;
  color: #fff;
  cursor: default;
  font: inherit;
  transition: transform 0.12s, background 0.12s;
}
.game-card:hover {
  background: #3a3a3c;
  transform: translateY(-2px);
}
.game-card.soon { opacity: 0.85; }
.game-card .thumb {
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: 8px;
  margin-bottom: 8px;
  display: grid;
  place-items: center;
  font-size: 28px;
}
.game-card h4 { font-size: 13px; margin-bottom: 2px; }
.game-card p { font-size: 11px; color: #999; line-height: 1.3; }
.soon-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #ffd60a;
  background: rgba(255, 214, 10, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
}

.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 32px 24px;
  text-align: center;
  background: linear-gradient(180deg, #1c1c1e, #121214);
}
.coming-soon .soon-emoji { font-size: 48px; margin-bottom: 12px; }
.coming-soon h3 { font-size: 20px; margin-bottom: 8px; }
.coming-soon p { color: #aaa; font-size: 13px; line-height: 1.45; max-width: 32ch; }
.coming-soon .dim { color: #666; font-size: 12px; margin-top: 10px; }

.roblox-body {
  min-height: 360px;
  background: linear-gradient(180deg, #1a1a1e 0%, #121214 100%);
  padding: 0;
  display: flex;
  flex-direction: column;
}
.roblox-top {
  background: #232527;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #333;
}
.roblox-top .logo {
  width: 32px; height: 32px;
  background: #e2231a;
  border-radius: 6px;
  display: grid; place-items: center;
  font-weight: 900; font-size: 14px;
  transform: rotate(15deg);
  color: #fff;
}
.roblox-top input {
  flex: 1;
  border: none;
  background: #1a1a1c;
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
}
.roblox-hero {
  padding: 20px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}
.roblox-hero .banner {
  border-radius: 12px;
  min-height: 160px;
  background:
    radial-gradient(circle at 30% 40%, #e2231a88, transparent 50%),
    linear-gradient(135deg, #2a2a30, #1a1a20);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
}
.roblox-hero .banner h3 { font-size: 20px; margin-bottom: 4px; }
.roblox-hero .banner p { color: #aaa; font-size: 12px; margin-bottom: 10px; }
.roblox-hero .banner button,
.play-btn {
  border: none;
  background: #00b06f;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: default;
  font-family: inherit;
}
.roblox-hero .banner button:hover,
.play-btn:hover { filter: brightness(1.08); }
.roblox-list h4 {
  padding: 0 20px 8px;
  font-size: 14px;
  color: #ccc;
}
.roblox-row {
  display: flex;
  gap: 10px;
  padding: 0 16px 16px;
  overflow-x: auto;
}
.roblox-row .game-card {
  min-width: 130px;
  flex-shrink: 0;
}

.game-frame-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  background: #000;
}
.game-frame-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #1c1c1e;
  border-bottom: 1px solid #333;
  font-size: 12px;
  color: #aaa;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.game-frame-bar .frame-hint { color: #666; font-size: 11px; }
.game-frame-bar .frame-pop {
  color: #0a84ff;
  margin-left: auto;
  text-decoration: none;
}
.game-frame-bar .frame-reload {
  border: none;
  background: #333;
  color: #ddd;
  border-radius: 6px;
  width: 28px;
  height: 24px;
  cursor: pointer;
  font-size: 14px;
}
.game-frame-bar .frame-reload:hover { background: #444; }
.game-frame-wrap iframe,
.game-frame-wrap iframe.game-frame {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 280px;
  border: none;
  background: #111;
  display: block;
}
.games-library {
  padding: 16px;
  background: #1c1c1e;
  min-height: 100%;
}
.games-library h3 { margin-bottom: 4px; }
.games-library-lead {
  color: #888;
  font-size: 12px;
  margin-bottom: 14px;
  line-height: 1.4;
}
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.finder-hint {
  color: #888;
  font-size: 11px;
  margin: 0 0 10px;
}
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.file-item {
  border: none;
  background: transparent;
  color: #eee;
  cursor: default;
  text-align: center;
  padding: 8px 4px;
  border-radius: 10px;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.file-item.openable {
  cursor: pointer;
}
.file-item.openable:hover {
  background: rgba(10, 132, 255, 0.22);
}
.file-item .fi {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  box-shadow: 0 4px 12px #0006;
}
.file-item .file-name {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  max-width: 90px;
  word-break: break-word;
}
.file-item .file-sub {
  font-size: 9px;
  color: #888;
  max-width: 90px;
  line-height: 1.2;
}
.finder-side button.active {
  background: rgba(10, 132, 255, 0.35);
}

/* Resize handles */
.resize-handle {
  position: absolute;
  z-index: 5;
}
.resize-handle.n { top: 0; left: 12px; right: 12px; height: 5px; cursor: ns-resize; }
.resize-handle.s { bottom: 0; left: 12px; right: 12px; height: 6px; cursor: ns-resize; }
.resize-handle.e { top: 12px; right: 0; bottom: 12px; width: 6px; cursor: ew-resize; }
.resize-handle.w { top: 12px; left: 0; bottom: 12px; width: 5px; cursor: ew-resize; }
.resize-handle.se {
  right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize;
}
.resize-handle.sw {
  left: 0; bottom: 0; width: 12px; height: 12px; cursor: nesw-resize;
}
.resize-handle.ne {
  right: 0; top: 0; width: 12px; height: 12px; cursor: nesw-resize;
}
.resize-handle.nw {
  left: 0; top: 0; width: 12px; height: 12px; cursor: nwse-resize;
}
.window.resizing { user-select: none; }

/* Windows */
#windows { position: absolute; inset: 0; top: var(--menu-h); z-index: 10; pointer-events: none; }
.window {
  position: absolute;
  min-width: 320px; min-height: 200px;
  background: #2c2c2e;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 60px #0009, 0 0 0 0.5px #0004;
  display: flex; flex-direction: column;
  pointer-events: auto;
  overflow: hidden;
}
.window.focused { box-shadow: 0 24px 70px #000a, 0 0 0 0.5px rgba(255,255,255,0.15); }
.window.minimized { display: none; }
.win-titlebar {
  height: 40px; flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  background: linear-gradient(180deg, #3a3a3c, #2c2c2e);
  cursor: default;
  touch-action: none;
}
.traffic {
  display: flex; gap: 7px; width: 60px;
}
.traffic button {
  width: 12px; height: 12px; border-radius: 50%; border: none;
  cursor: default; padding: 0;
}
.traffic .close { background: #ff5f57; }
.traffic .min { background: #febc2e; }
.traffic .max { background: #28c840; }
.traffic button:hover { filter: brightness(1.08); }
.win-title {
  flex: 1; text-align: center; font-size: 13px; font-weight: 600;
  color: #ddd; margin-right: 60px;
}
.win-body {
  flex: 1; overflow: auto;
  background: #1c1c1e;
  font-size: 13px;
  user-select: text;
  -webkit-user-select: text;
  min-height: 0; /* flex child can shrink for iframe fill */
}
/* Game windows: body is a full-height frame, no scroll chrome */
.win-body:has(.game-frame-wrap) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: #000;
}

/* App contents */
.finder-body { display: grid; grid-template-columns: 160px 1fr; height: 100%; min-height: 280px; }
.finder-side {
  background: #2c2c2e; border-right: 1px solid #3a3a3c; padding: 12px 8px;
}
.finder-side button {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; color: #ddd;
  font: inherit; font-size: 12px; padding: 6px 10px; border-radius: 6px; cursor: default;
}
.finder-side button:hover, .finder-side button.active { background: rgba(10,132,255,0.35); color: #fff; }
.finder-main { padding: 16px; }
.finder-main h3 { font-size: 18px; margin-bottom: 12px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 12px; }
.file-item {
  text-align: center; padding: 8px; border-radius: 8px; cursor: default;
}
.file-item:hover { background: rgba(255,255,255,0.06); }
.file-item .fi {
  width: 48px; height: 48px; margin: 0 auto 6px; border-radius: 8px;
  background: linear-gradient(145deg, #5ac8fa, #007aff);
}
.file-item span { font-size: 11px; color: #ccc; word-break: break-word; }

.safari-bar {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 12px; background: #2c2c2e; border-bottom: 1px solid #3a3a3c;
}
.safari-bar input {
  flex: 1; border: none; border-radius: 8px; padding: 7px 12px;
  background: #1c1c1e; color: #fff; font: inherit; font-size: 13px; outline: none;
}
.safari-page {
  padding: 24px; min-height: 260px;
  background: linear-gradient(180deg, #0a1628, #122440);
}
.safari-page h2 { font-size: 22px; margin-bottom: 8px; }
.safari-page p { color: var(--muted); line-height: 1.5; margin-bottom: 12px; }

.notes-body { display: grid; grid-template-columns: 180px 1fr; height: 100%; min-height: 260px; }
.notes-list { background: #2c2c2e; border-right: 1px solid #3a3a3c; padding: 8px; }
.notes-list button {
  display: block; width: 100%; text-align: left; border: none;
  background: transparent; color: #ddd; font: inherit; padding: 10px; border-radius: 8px;
  cursor: default; margin-bottom: 4px;
}
.notes-list button.active { background: #3a3a3c; }
.notes-list .meta { display: block; font-size: 11px; color: #888; margin-top: 2px; }
.notes-edit {
  padding: 16px; background: #1c1c1e;
}
.notes-edit textarea {
  width: 100%; height: 100%; min-height: 220px; border: none; resize: none;
  background: transparent; color: #f0f0f0; font: inherit; font-size: 14px; line-height: 1.5;
  outline: none;
}

.calc-body {
  padding: 12px; background: #1c1c1e;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  max-width: 280px; margin: 0 auto;
}
.calc-display {
  grid-column: 1 / -1;
  background: #000; border-radius: 8px; padding: 16px;
  text-align: right; font-size: 28px; font-weight: 300;
  font-variant-numeric: tabular-nums; min-height: 56px;
}
.calc-body button {
  border: none; border-radius: 50%; aspect-ratio: 1;
  font-size: 18px; font-weight: 500; cursor: default;
  background: #333; color: #fff;
}
.calc-body button.op { background: #ff9f0a; color: #fff; }
.calc-body button.fn { background: #a5a5a5; color: #000; }
.calc-body button.zero { grid-column: span 2; border-radius: 28px; aspect-ratio: auto; height: 56px; }

.term-body {
  background: #0c0c0c; color: #33ff66;
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  font-size: 12px; padding: 12px; min-height: 240px; line-height: 1.45;
}
.term-body .line { white-space: pre-wrap; }
.term-body .dim { color: #666; }
.term-input-row { display: flex; gap: 6px; margin-top: 4px; }
.term-input-row span { color: #33ff66; }
.term-input-row input {
  flex: 1; border: none; background: transparent; color: #33ff66;
  font: inherit; outline: none;
}

.settings-body { display: grid; grid-template-columns: 180px 1fr; min-height: 300px; }
.settings-nav { background: #2c2c2e; padding: 12px 8px; border-right: 1px solid #3a3a3c; }
.settings-nav button {
  display: block; width: 100%; text-align: left; border: none;
  background: transparent; color: #ddd; font: inherit; padding: 8px 10px;
  border-radius: 6px; margin-bottom: 2px; cursor: default;
}
.settings-nav button.active { background: rgba(10,132,255,0.35); }
.settings-main { padding: 20px; }
.settings-main h3 { margin-bottom: 12px; }
.settings-main label {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #333; font-size: 13px;
}
.settings-main input[type="range"] { width: 120px; accent-color: var(--blue); }

.about-body {
  text-align: center; padding: 32px 24px;
  background: linear-gradient(180deg, #2c2c2e, #1c1c1e);
}
.about-body .apple-big { font-size: 48px; margin-bottom: 8px; }
.about-body h2 { font-size: 20px; margin-bottom: 4px; }
.about-body p { color: #999; font-size: 12px; margin: 4px 0; line-height: 1.4; }

.messages-body, .mail-body, .maps-body, .photos-body {
  padding: 16px; min-height: 240px;
}
.msg-row {
  display: flex; gap: 10px; padding: 10px; border-radius: 10px;
  margin-bottom: 8px; background: #2c2c2e;
}
.msg-row .av {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(145deg, #5ac8fa, #007aff); flex-shrink: 0;
}

/* iMessage-style chat */
.win-body:has(.imessage) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.imessage {
  display: grid;
  grid-template-columns: 200px 1fr;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: #1c1c1e;
}
.im-sidebar {
  background: #2c2c2e;
  border-right: 1px solid #3a3a3c;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.im-side-head {
  font-weight: 700;
  font-size: 14px;
  padding: 12px 12px 8px;
  flex-shrink: 0;
}
.im-contact {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: none;
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  flex-shrink: 0;
}
.im-contact:hover { background: rgba(255,255,255,0.06); }
.im-contact.active { background: rgba(10, 132, 255, 0.35); }
.im-contact .av {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
}
.im-contact .av.kinito { background: linear-gradient(145deg, #5b8cff, #3a60c0); }
.im-contact .av.chonks { background: linear-gradient(145deg, #ffb0d0, #ff6bcb); }
.im-contact .av.boss { background: linear-gradient(145deg, #ffd60a, #ff9f0a); }
.im-contact .av.siri { background: linear-gradient(145deg, #bf5af2, #5e5ce6); }
.im-contact .meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.im-contact .meta b { font-size: 13px; font-weight: 600; }
.im-contact .meta i {
  font-style: normal;
  font-size: 11px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.im-status {
  margin-top: auto;
  padding: 8px 12px;
  font-size: 10px;
  color: #777;
  border-top: 1px solid #3a3a3c;
  flex-shrink: 0;
}
.im-thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
}
.im-thread-head {
  padding: 10px 14px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid #222;
  background: #1c1c1e;
  flex-shrink: 0;
}
.im-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.bubble-row { display: flex; }
.bubble-row.me { justify-content: flex-end; }
.bubble-row.them { justify-content: flex-start; }
.bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.35;
  user-select: text;
  -webkit-user-select: text;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.bubble-row.me .bubble {
  background: #0a84ff;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble-row.them .bubble {
  background: #2c2c2e;
  color: #f0f0f0;
  border-bottom-left-radius: 4px;
}
.bubble.typing { color: #888; letter-spacing: 0.15em; }
.im-compose {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #222;
  background: #1c1c1e;
  align-items: center;
  flex-shrink: 0;
}
.im-compose input {
  flex: 1;
  border: 1px solid #3a3a3c;
  border-radius: 18px;
  background: #2c2c2e;
  color: #fff;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.im-compose input:focus { border-color: #0a84ff; }
.im-compose input:disabled {
  opacity: 0.65;
}
.im-compose button {
  width: 32px; height: 32px;
  border: none; border-radius: 50%;
  background: #0a84ff;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}
.im-compose button:hover:not(:disabled) { filter: brightness(1.08); }
.im-compose button:disabled {
  opacity: 0.45;
  cursor: default;
}
.photos-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.photos-grid div {
  aspect-ratio: 1; border-radius: 6px;
}

/* Spotlight */
#spotlight {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,0.35);
  display: flex; justify-content: center; padding-top: 18vh;
}
#spotlight.hidden { display: none; }
.spot-box {
  width: min(560px, 90vw);
  background: rgba(40,40,44,0.94);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  box-shadow: 0 24px 80px #000a;
  overflow: hidden;
}
#spot-input {
  width: 100%; border: none; background: transparent;
  color: #fff; font: inherit; font-size: 20px; font-weight: 500;
  padding: 16px 18px; outline: none;
}
#spot-results { max-height: 280px; overflow-y: auto; border-top: 1px solid #333; }
#spot-results button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: none; background: transparent; color: #fff;
  font: inherit; font-size: 14px; padding: 10px 16px; cursor: default; text-align: left;
}
#spot-results button:hover, #spot-results button.active { background: var(--blue); }
#spot-results .si {
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
}

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(40,40,44,0.92); color: #fff; padding: 10px 18px;
  border-radius: 10px; font-size: 13px; font-weight: 600;
  opacity: 0; transition: opacity 0.2s; z-index: 80; pointer-events: none;
  border: 1px solid rgba(255,255,255,0.1);
}
#toast.show { opacity: 1; }

/* ——— Touch / coarse pointer ——— */
@media (pointer: coarse) {
  :root {
    --dock-ico: 56px;
    --desk-ico: 56px;
    --menu-h: 36px;
  }
  #menubar .m, #menubar .apple {
    height: 36px;
    padding: 0 12px;
    min-height: 44px;
    line-height: 36px;
  }
  #menubar .app-name { line-height: 36px; }
  .dock-item { padding: 4px; }
  .dock-item:hover { transform: none; }
  .dock-item:active { transform: scale(1.08) translateY(-4px); }
  .desk-icon {
    width: 88px;
    min-height: 72px;
    padding: 8px;
  }
  .traffic button {
    width: 16px;
    height: 16px;
  }
  .traffic { width: 72px; gap: 8px; }
  .im-contact { padding: 12px 14px; min-height: 52px; }
  .im-compose button { width: 40px; height: 40px; }
  .im-compose input { padding: 10px 14px; font-size: 16px; }
  .game-card { min-height: 44px; }
  .play-btn { min-height: 44px; padding: 10px 18px; }
  .resize-handle.se, .resize-handle.sw, .resize-handle.ne, .resize-handle.nw {
    width: 22px; height: 22px;
  }
}

/* ——— Compact / narrow screens ——— */
body.compact {
  --menu-h: 32px;
  --dock-ico: 40px;
  --desk-ico: 40px;
}
body.compact .hide-narrow { display: none !important; }
body.compact #desk-icons {
  right: 6px;
  top: calc(var(--menu-h) + 8px);
  gap: 8px;
}
body.compact .desk-icon {
  width: 64px;
  font-size: 10px;
  padding: 4px;
}
body.compact #dock {
  gap: 2px;
  padding: 4px 6px 6px;
  border-radius: 14px;
}
body.compact .dock-item:hover { transform: none; }
body.compact .window {
  min-width: 200px;
  border-radius: 8px;
}
body.compact .win-titlebar { height: 36px; }
body.compact .imessage {
  grid-template-columns: 120px 1fr;
}
body.compact .im-contact .meta i { display: none; }
body.compact .im-contact .meta b { font-size: 12px; }
body.compact .finder-body {
  grid-template-columns: 110px 1fr;
}
body.compact .notes-body {
  grid-template-columns: 120px 1fr;
}
body.compact .settings-body {
  grid-template-columns: 100px 1fr;
}
body.compact .roblox-hero {
  grid-template-columns: 1fr;
}
body.compact .game-frame-wrap iframe {
  min-height: 240px;
}
body.compact #toast {
  bottom: 72px;
  font-size: 12px;
}

@media (max-width: 520px) {
  body.compact .imessage {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  body.compact .im-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid #3a3a3c;
    max-height: 120px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  body.compact .im-side-head { display: none; }
  body.compact .im-contact {
    flex: 0 0 auto;
    width: auto;
    padding: 8px 10px;
  }
  body.compact .im-contact .meta { display: none; }
  body.compact .im-status {
    width: 100%;
    margin-top: 0;
    border-top: none;
    padding: 4px 10px;
    font-size: 9px;
  }
  body.compact #desk-icons { display: none; }
  body.compact .finder-body,
  body.compact .notes-body,
  body.compact .settings-body {
    grid-template-columns: 1fr;
  }
  body.compact .finder-side,
  body.compact .notes-list,
  body.compact .settings-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid #3a3a3c;
    max-height: none;
  }
  body.compact .finder-side button,
  body.compact .notes-list button,
  body.compact .settings-nav button {
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dock-item { transition: none; }
  #boot.fade { transition: none; }
  #toast { transition: none; }
}
