/* Zephydian web demo: the fake desktop, the panel and its games. */

/* ---------- Tokens ---------- */
:root {
  --menubar-h: 28px;
  --accent: #1EA1F2;            /* set from JS per theme + mode */
  --dwell: 150ms;               /* set from JS */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-panel: 16px;
  --r-card: 12px;
  --r-btn: 8px;
  --r-chip: 6px;
}

:root[data-mode="light"] {
  --wallpaper:
    radial-gradient(1100px 800px at 12% 18%, #8fcbff 0%, transparent 60%),
    radial-gradient(700px 600px at 92% 12%, #ffb8dc 0%, transparent 60%),
    radial-gradient(600px 500px at 80% 70%, #ffe1a8 0%, transparent 60%),
    radial-gradient(1000px 900px at 45% 105%, #c2b0ff 0%, transparent 62%),
    #eaf2ff;
  --wall-mini: linear-gradient(135deg, #a9d8ff, #e9d6ff 60%, #ffd6ea);
  --menubar-bg: rgba(255, 255, 255, 0.45);
  --menubar-text: rgba(0, 0, 0, 0.85);
  --menubar-hover: rgba(0, 0, 0, 0.1);
  --hint-bg: rgba(255, 255, 255, 0.55);
  --page-bg: #f5f5f7;

  --panel-bg: rgba(246, 246, 246, 0.72);
  --panel-solid: #f3f3f4;
  --panel-border: rgba(0, 0, 0, 0.08);
  --menu-bg: rgba(250, 250, 250, 0.88);
  --overlay: rgba(246, 246, 246, 0.84);
  --toast-bg: rgba(0, 0, 0, 0.8);
  --toast-text: #fff;

  --text: rgba(0, 0, 0, 0.85);
  --text-2: rgba(0, 0, 0, 0.5);
  --text-3: rgba(0, 0, 0, 0.26);
  --separator: rgba(0, 0, 0, 0.1);
  --fill: rgba(0, 0, 0, 0.04);
  --fill-hover: rgba(0, 0, 0, 0.07);
  --fill-strong: rgba(0, 0, 0, 0.12);
  --seg-on: #fff;
  --cp-bg: rgba(255, 255, 255, 0.6);
  --danger: #FF3B30;
  --warning: #FF9500;

  --five-correct: #30A14E;
  --five-present: #C28F00;
  --five-absent: #8E8E93;
}

:root[data-mode="dark"] {
  --wallpaper:
    radial-gradient(1100px 800px at 12% 18%, #143a72 0%, transparent 60%),
    radial-gradient(700px 600px at 92% 12%, #5e2366 0%, transparent 60%),
    radial-gradient(600px 500px at 80% 70%, #5a3a12 0%, transparent 60%),
    radial-gradient(1000px 900px at 45% 105%, #2c1b6e 0%, transparent 62%),
    #0a0d1a;
  --wall-mini: linear-gradient(135deg, #12305e, #26185e 60%, #4a1f52);
  --menubar-bg: rgba(0, 0, 0, 0.35);
  --menubar-text: rgba(255, 255, 255, 0.9);
  --menubar-hover: rgba(255, 255, 255, 0.15);
  --hint-bg: rgba(30, 30, 30, 0.55);
  --page-bg: #0b0c12;

  --panel-bg: rgba(32, 32, 32, 0.7);
  --panel-solid: #2a2a2a;
  --panel-border: rgba(255, 255, 255, 0.12);
  --menu-bg: rgba(44, 44, 44, 0.88);
  --overlay: rgba(30, 30, 30, 0.82);
  --toast-bg: rgba(255, 255, 255, 0.9);
  --toast-text: #000;

  --text: rgba(255, 255, 255, 0.88);
  --text-2: rgba(255, 255, 255, 0.55);
  --text-3: rgba(255, 255, 255, 0.28);
  --separator: rgba(255, 255, 255, 0.1);
  --fill: rgba(255, 255, 255, 0.06);
  --fill-hover: rgba(255, 255, 255, 0.1);
  --fill-strong: rgba(255, 255, 255, 0.16);
  --seg-on: rgba(255, 255, 255, 0.2);
  --cp-bg: rgba(0, 0, 0, 0.35);
  --danger: #FF453A;
  --warning: #FF9F0A;

  --five-correct: #2EA043;
  --five-present: #B8900A;
  --five-absent: #48484A;
}

:root.five-hc {
  --five-correct: #E07700;
  --five-present: #1673D9;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 13px/1.4 var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background: var(--page-bg);
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
textarea, input { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 1em; height: 1em; display: block; }
.muted { color: var(--text-2); }

/* ---------- Fake desktop ---------- */
.desktop {
  position: relative; overflow: hidden;
  height: 100vh; height: 100svh; min-height: 640px;
  background: var(--wallpaper);
  user-select: none; -webkit-user-select: none;
}

.menubar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  height: var(--menubar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: var(--menubar-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: var(--menubar-text);
  font-size: 13px;
}
.mb-left { display: flex; align-items: center; gap: 18px; white-space: nowrap; overflow: hidden; }
.mb-brand { display: flex; align-items: center; gap: 7px; font-weight: 700; text-decoration: none; }
.mb-logo { width: 15px; height: 15px; font-size: 15px; }
.mb-right { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.mb-icon { width: 28px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-size: 16px; }
#themeToggle { font-size: 15px; }
.mb-icon:hover, .mb-icon.active { background: var(--menubar-hover); }

/* ---------- Hero (the page's headline, sitting on the desktop) ---------- */
.hero {
  position: absolute; inset: var(--menubar-h) 0 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px 150px; text-align: center;
}
.hero-logo { width: 64px; height: 64px; color: var(--accent); filter: drop-shadow(0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent)); }
.hero-logo .ic { width: 100%; height: 100%; }
.hero h1 { margin: 14px 0 0; font-size: clamp(40px, 7vw, 64px); line-height: 1.05; letter-spacing: -0.02em; font-weight: 700; }
.hero-tag { margin: 12px 0 0; font-size: clamp(18px, 2.6vw, 24px); font-weight: 500; line-height: 1.3; }
.hero-sub { margin: 6px 0 0; font-size: 15px; color: var(--text-2); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; user-select: text; -webkit-user-select: text; }
.cmd {
  display: inline-flex; align-items: center; gap: 12px; max-width: 100%;
  height: 42px; padding: 0 6px 0 16px; border-radius: 12px;
  background: var(--hint-bg);
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 0 0 0.5px var(--panel-border), 0 4px 16px rgba(0, 0, 0, 0.08);
}
.cmd code { font: 500 13px var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd code::before { content: "$ "; color: var(--text-3); }
.cmd-copy {
  flex: none; height: 30px; padding: 0 12px; border-radius: 8px;
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 600;
  background: var(--fill-hover);
}
.cmd:hover .cmd-copy { background: var(--fill-strong); }
.cmd.copied .cmd-copy { background: var(--accent); color: #fff; }
.hero-btn {
  display: inline-flex; align-items: center; height: 42px; padding: 0 20px; border-radius: 12px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; text-decoration: none;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.hero-btn:hover { filter: brightness(1.08); }
.desktop-hint {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 28px 0 0; padding: 9px 16px; border-radius: 999px;
  background: var(--hint-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  font-size: 13px; line-height: 1.4;
  transition: opacity 0.2s;
}
.desktop-hint.dim { opacity: 0.35; }
.hint-arrow { flex: none; width: 16px; height: 16px; color: var(--accent); transition: transform 0.2s; }
.hint-arrow .ic { width: 100%; height: 100%; stroke-width: 2.4; }
.desktop-hint[data-corner="tl"] .hint-arrow { transform: rotate(-90deg); }
.desktop-hint[data-corner="br"] .hint-arrow { transform: rotate(90deg); }
.desktop-hint[data-corner="bl"] .hint-arrow { transform: rotate(180deg); }

/* ---------- Dock ---------- */
.dock {
  --icon: 56px;
  position: absolute; left: 50%; bottom: 10px; z-index: 10; transform: translateX(-50%);
  height: calc(var(--icon) + 16px);
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px; border-radius: 24px;
  background: var(--dock-bg);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 0 0 0.5px var(--dock-edge), inset 0 1px 0 var(--dock-rim), 0 10px 30px rgba(0, 0, 0, 0.18);
}
:root[data-mode="light"] { --dock-bg: rgba(255, 255, 255, 0.38); --dock-edge: rgba(0, 0, 0, 0.1); --dock-rim: rgba(255, 255, 255, 0.7); }
:root[data-mode="dark"] { --dock-bg: rgba(40, 40, 52, 0.45); --dock-edge: rgba(255, 255, 255, 0.14); --dock-rim: rgba(255, 255, 255, 0.12); }
.dock-sep { align-self: stretch; width: 1px; margin: 4px 3px; background: var(--separator); }
/* Each icon's size follows --s, set by demo.js from the pointer's distance (macOS-style magnification).
   Icons grow upward out of the Dock, and the Dock widens to fit them. */
.dock-item {
  --s: 1;
  position: relative; flex: none;
  width: calc(var(--icon) * var(--s)); height: calc(var(--icon) * var(--s));
  display: block; text-decoration: none; border-radius: 22.5%;
}
.dock-item:active .dock-img, .dock-item:active .dock-tile { filter: brightness(0.8); }
.dock-item:focus-visible { outline: none; }
.dock-item:focus-visible .dock-img, .dock-item:focus-visible .dock-tile { box-shadow: 0 0 0 3px var(--accent); border-radius: 22.5%; }
/* The name floats above the icon on hover, like the real Dock. */
.dock-item::before {
  content: attr(data-label);
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  padding: 3px 10px; border-radius: 7px; white-space: nowrap;
  background: var(--menu-bg); color: var(--text); font-size: 12px; font-weight: 500;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 0 0 0.5px var(--panel-border), 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0; pointer-events: none; transition: opacity 120ms;
}
.dock-item:hover::before, .dock-item:focus-visible::before { opacity: 1; }
.dock-img { width: 100%; height: 100%; display: block; }
/* The app icon follows the page's light/dark mode, like the real Liquid Glass icon. */
:root[data-mode="light"] .dock-img-dark, :root[data-mode="dark"] .dock-img-light { display: none; }
.dock-tile {
  width: 100%; height: 100%; border-radius: 22.5%;
  display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 0 0 0.5px rgba(255, 255, 255, 0.12);
}
.dock-tile .ic { width: 46%; height: 46%; }
.dock-download { background: linear-gradient(180deg, #3aa0ff, #0a6cf0); }
.dock-download .ic { stroke-width: 2.2; }
.dock-github { background: linear-gradient(180deg, #33363d, #16181c); }
.dock-features { background: linear-gradient(180deg, #8b7bff, #5b3fe0); }
.dock-features .ic { stroke-width: 2; }
.dock-github .ic { width: 52%; height: 52%; }
/* Link icons get a small chevron badge, which grows with its icon. */
.dock-badge {
  position: absolute; top: -3px; right: -5px;
  width: calc(18px * var(--s)); height: calc(18px * var(--s)); border-radius: 50%;
  display: grid; place-items: center;
  background: #1c1c1e; color: #fff; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.5);
}
.dock-badge .ic { width: 55%; height: 55%; stroke-width: 3; }
/* The "running" dot under Zephydian while its panel is open. */
.dock-dot { position: absolute; bottom: -6px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--text-2); opacity: 0; transition: opacity 0.2s; }
.dock-item.running .dock-dot { opacity: 1; }

/* ---------- Hot corners ---------- */
.hot { position: absolute; z-index: 50; width: 16px; height: 16px; }
.hot[data-corner="tl"] { top: 0; left: 0; }
.hot[data-corner="tr"] { top: 0; right: 0; }
.hot[data-corner="bl"] { bottom: 0; left: 0; }
.hot[data-corner="br"] { bottom: 0; right: 0; }
.hot::after {
  content: ""; position: absolute; width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); opacity: 0; transform: scale(0.4); pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.hot[data-corner="tl"]::after { top: -20px; left: -20px; }
.hot[data-corner="tr"]::after { top: -20px; right: -20px; }
.hot[data-corner="bl"]::after { bottom: -20px; left: -20px; }
.hot[data-corner="br"]::after { bottom: -20px; right: -20px; }
.hot.active::after { opacity: 0.35; transform: scale(0.6); }
.hot.active.charging::after {
  opacity: 0.9; transform: scale(1.1);
  transition: opacity var(--dwell) linear, transform var(--dwell) linear;
}
/* Until the first open, the active corner glows so visitors know where to go. */
.hot.beacon::after { animation: beacon 1.6s ease-in-out infinite; }
.hot.beacon.charging::after { animation: none; }
@keyframes beacon {
  0%, 100% { opacity: 0.45; transform: scale(0.7); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  60% { opacity: 0.9; transform: scale(1.8); box-shadow: 0 0 0 14px transparent; }
}

/* ---------- Panel ---------- */
.panel {
  --radius: 16px;
  position: absolute; z-index: 20;
  width: 380px;
  height: min(540px, calc(100% - var(--menubar-h) - 16px));
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  /* Closed: shrunk into its corner, like the Mac app (0.24 s, speeding into the corner). */
  opacity: 0; visibility: hidden; transform: scale(0.06);
  transition:
    transform 240ms cubic-bezier(0.45, 0, 0.9, 0.55),
    opacity 240ms cubic-bezier(0.8, 0, 1, 0.6),
    visibility 0s linear 240ms;
}
/* Open: grows out of the corner (0.34 s, quick start, soft landing). */
.panel.open {
  opacity: 1; visibility: visible; transform: none;
  transition: transform 340ms cubic-bezier(0.2, 0.9, 0.25, 1), opacity 200ms ease-out, visibility 0s;
}
.panel[data-corner="tr"] { top: calc(var(--menubar-h) + 8px); right: 8px; transform-origin: top right; }
.panel[data-corner="tl"] { top: calc(var(--menubar-h) + 8px); left: 8px; transform-origin: top left; }
.panel[data-corner="br"] { bottom: 8px; right: 8px; transform-origin: bottom right; }
.panel[data-corner="bl"] { bottom: 8px; left: 8px; transform-origin: bottom left; }

/* Frosted (macOS 14–15, and an option on 26): a blurred, tinted sheet with a hairline edge. */
.panel[data-style="frosted"] {
  background: var(--panel-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 0 0 0.5px var(--panel-border), 0 12px 40px rgba(0, 0, 0, 0.25);
}

/* Liquid Glass (macOS 26): clearer, rounder, with a bright specular rim. A web imitation of Apple's material. */
.panel[data-style="glass"] {
  --radius: 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(200%) brightness(var(--glass-bright));
  -webkit-backdrop-filter: blur(16px) saturate(200%) brightness(var(--glass-bright));
  box-shadow:
    inset 0 1px 1px var(--glass-rim-top),
    inset 0 -1px 1px var(--glass-rim-bottom),
    0 20px 50px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.08);
}
.panel[data-style="glass"]::before {
  content: ""; position: absolute; inset: 0; z-index: 30; pointer-events: none;
  border-radius: inherit; padding: 1px;
  background: linear-gradient(140deg, var(--glass-edge) 0%, transparent 30%, transparent 65%, var(--glass-edge-2) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
:root[data-mode="light"] {
  --glass-bg: linear-gradient(170deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.3));
  --glass-bright: 1.06;
  --glass-rim-top: rgba(255, 255, 255, 0.9);
  --glass-rim-bottom: rgba(255, 255, 255, 0.35);
  --glass-edge: rgba(255, 255, 255, 1);
  --glass-edge-2: rgba(255, 255, 255, 0.7);
  --glass-control: rgba(255, 255, 255, 0.4);
  --glass-control-on: rgba(255, 255, 255, 0.85);
}
:root[data-mode="dark"] {
  --glass-bg: linear-gradient(170deg, rgba(58, 58, 64, 0.5), rgba(24, 24, 28, 0.42));
  --glass-bright: 0.9;
  --glass-rim-top: rgba(255, 255, 255, 0.28);
  --glass-rim-bottom: rgba(255, 255, 255, 0.08);
  --glass-edge: rgba(255, 255, 255, 0.45);
  --glass-edge-2: rgba(255, 255, 255, 0.2);
  --glass-control: rgba(255, 255, 255, 0.08);
  --glass-control-on: rgba(255, 255, 255, 0.24);
}
/* Glass controls: capsules with a light bubble for the selection, like the app's glass segmented control. */
.panel[data-style="glass"] .seg { border-radius: 999px; background: var(--glass-control); box-shadow: inset 0 0 0 0.5px var(--panel-border); }
.panel[data-style="glass"] .seg button { border-radius: 999px; }
.panel[data-style="glass"] .seg button.on {
  background: var(--glass-control-on);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 4px rgba(0, 0, 0, 0.12);
}
.panel[data-style="glass"] .btn { border-radius: 999px; background: var(--glass-control); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 0 0 0.5px var(--panel-border); }
.panel[data-style="glass"] .btn:hover { background: var(--glass-control-on); }
.panel[data-style="glass"] .btn-primary { background: var(--accent); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.panel[data-style="glass"] .tile { border-radius: 16px; }
.panel[data-style="glass"] .group { border-radius: 16px; }

.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view.enter { animation: slideIn 200ms ease-out; }
.view.enter-back { animation: slideBack 200ms ease-out; }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } }
@keyframes slideBack { from { transform: translateX(-24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.p-header { height: 44px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; }
.brand { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.brand-logo { color: var(--accent); width: 20px; height: 20px; font-size: 20px; }
/* Segmented control */
.seg { display: flex; gap: 2px; padding: 2px; border-radius: var(--r-btn); background: var(--fill-hover); }
.seg button { flex: 1; height: 24px; border-radius: 6px; font-size: 12px; font-weight: 500; transition: background 0.15s; }
.seg button:hover:not(.on) { background: var(--fill); }
.seg button.on { background: var(--seg-on); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.seg-main { margin: 0 16px 12px; flex: none; }
.seg-main button { height: 30px; font-size: 13px; }
.seg-sm button { height: 22px; padding: 0 10px; font-size: 11.5px; white-space: nowrap; }

.tab-body { flex: 1; min-height: 0; position: relative; }
.tab { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 16px; }
.tab.fade-in { animation: fade 150ms ease; }

/* Buttons */
.icon-btn {
  width: 26px; height: 26px; flex: none; border-radius: 6px;
  display: grid; place-items: center; font-size: 15px; color: var(--text-2);
}
.icon-btn:hover:not(:disabled) { background: var(--fill-hover); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; }
.btn { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: var(--r-btn); background: var(--fill-hover); font-size: 12px; font-weight: 500; text-decoration: none; }
.btn:hover { background: var(--fill-strong); }
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }

/* ---------- Games grid ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile {
  position: relative; aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 8px; border-radius: var(--r-card); background: var(--fill);
  transition: background 0.15s, transform 0.1s;
}
.tile:hover { background: var(--fill-hover); }
.tile:active { transform: scale(0.97); }
.tile-ic { width: 30px; height: 30px; font-size: 30px; color: var(--accent); margin-bottom: 6px; }
.tile-ic .ic { width: 100%; height: 100%; }
.tile-name { font-size: 12px; font-weight: 500; }
.tile-stat { font-size: 11px; color: var(--text-2); }
.tile-stat { display: inline-flex; align-items: center; gap: 4px; }
.tile-mac { width: 12px; height: 12px; }
.tile-mac .ic { width: 100%; height: 100%; }
.tile.mac-only .tile-ic { opacity: 0.75; }

/* Card for games that only run in the Mac app */
.mac-card { max-width: 290px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; animation: fade 0.15s; }
.mac-card-ic { width: 52px; height: 52px; color: var(--accent); margin-bottom: 6px; }
.mac-card-ic .ic { width: 100%; height: 100%; }
.mac-card .ov-sub { margin: 0; line-height: 1.45; }
.mac-card-note { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--fill); font-size: 12px; color: var(--text-2); text-align: left; }
.mac-card-note .ic { flex: none; width: 16px; height: 16px; }

/* ---------- Notes ---------- */
#tab-notes { display: flex; flex-direction: column; padding-bottom: 10px; }
.notes-bar { position: relative; display: flex; align-items: center; gap: 4px; margin-bottom: 8px; flex: none; }
.pills { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex: none; height: 24px; padding: 0 10px;
  display: flex; align-items: center; gap: 4px;
  border-radius: 999px; background: var(--fill);
  font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.pill:hover { background: var(--fill-hover); }
.pill.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text); }
.pill-x { width: 14px; height: 14px; margin-right: -4px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; opacity: 0; }
.pill:hover .pill-x, .pill.on .pill-x { opacity: 0.55; }
.pill-x:hover { opacity: 1 !important; background: var(--fill-strong); }
.pill-input { width: 90px; border: 0; outline: none; background: transparent; font-size: 12px; font-weight: 500; padding: 0; }
#editor {
  flex: 1; min-height: 0; resize: none; outline: none; overscroll-behavior: contain;
  border: 0; border-top: 0.5px solid var(--separator); border-bottom: 0.5px solid var(--separator);
  background: transparent; padding: 10px 2px;
  font-size: 13px; line-height: 1.55; caret-color: var(--accent);
}
#editor::placeholder { color: var(--text-3); }
.notes-mono #editor { font-family: var(--font-mono); font-size: 12.5px; }
.notes-foot { flex: none; display: flex; justify-content: space-between; padding-top: 8px; font-size: 11px; color: var(--text-3); }
.menu {
  position: absolute; top: 30px; right: 0; z-index: 5;
  min-width: 200px; padding: 5px; border-radius: 10px;
  background: var(--menu-bg);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 0 0 0.5px var(--panel-border), 0 8px 24px rgba(0, 0, 0, 0.2);
}
.menu button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 8px; border-radius: 5px; text-align: left; }
.menu button:hover:not(:disabled) { background: var(--accent); color: #fff; }
.menu button:disabled { color: var(--text-3); }
.menu button span { font-size: 11px; }
.menu button .check { width: 14px; font-size: 13px; flex: none; }
.menu #monoToggle { justify-content: flex-start; gap: 6px; }

/* ---------- Settings ---------- */
.sec { margin: 16px 4px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.sec:first-child { margin-top: 2px; }
.group { padding: 0 12px; border-radius: var(--r-card); background: var(--fill); }
.row {
  min-height: 38px; padding: 6px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 0.5px solid var(--separator);
}
.group > :last-child { border-bottom: 0; }
.row-tall { padding: 10px 0; }
.row-wrap { flex-wrap: wrap; }
.row-ctl { display: flex; align-items: center; gap: 8px; }
.row-actions { justify-content: flex-start; gap: 8px; }
.row-actions .spacer { flex: 1; }
.row-mac .row-label { color: var(--text-3); }
.row-mac .muted { color: var(--text-3); }
.mac-tag { font-size: 9.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-2); background: var(--fill-hover); padding: 2px 6px; border-radius: 999px; }
.group-note { margin: 0; padding: 0 0 10px; font-size: 11px; color: var(--text-2); }
input[type="range"] { width: 120px; accent-color: var(--accent); }
input[type="range"]:disabled { opacity: 0.4; }
output { width: 52px; text-align: right; font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.switch { position: relative; width: 32px; height: 18px; border-radius: 999px; background: var(--fill-strong); transition: background 0.15s; }
.switch span { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(14px); }

.swatches { display: flex; gap: 8px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.15); }
.swatch.on { box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 4px var(--sw); }

.icon-choices { display: flex; flex-wrap: wrap; gap: 4px; }
.icon-choice { width: 28px; height: 26px; border-radius: 6px; display: grid; place-items: center; font-size: 15px; color: var(--text-2); }
.icon-choice:hover { background: var(--fill-hover); }
.icon-choice.on { background: var(--accent); color: #fff; }

.mini-screen { position: relative; width: 132px; height: 84px; border-radius: 8px; overflow: hidden; background: var(--wall-mini); box-shadow: inset 0 0 0 0.5px var(--panel-border); flex: none; }
.mini-bar { position: absolute; top: 0; left: 0; right: 0; height: 8px; background: var(--menubar-bg); }
.cp { position: absolute; width: 20px; height: 20px; border-radius: 50%; background: var(--cp-bg); box-shadow: inset 0 0 0 1.5px var(--separator); transition: background 0.15s; }
.cp:hover:not(.on) { background: var(--fill-strong); }
.cp.on { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.cp-tl { top: 13px; left: 6px; }
.cp-tr { top: 13px; right: 6px; }
.cp-bl { bottom: 6px; left: 6px; }
.cp-br { bottom: 6px; right: 6px; }

/* ---------- Game screen ---------- */
.g-header { gap: 6px; padding: 0 10px; }
.g-title { flex: 1; font-size: 15px; font-weight: 600; }
.g-score { font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.g-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 0 16px; }
.g-hint { flex: none; height: 30px; display: flex; align-items: center; justify-content: center; padding: 0 12px; font-size: 11px; color: var(--text-3); text-align: center; }

.g-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 16px; border-radius: 10px; text-align: center;
  background: var(--overlay);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade 0.15s;
}
.ov-title { font-size: 20px; font-weight: 700; }
.ov-sub { font-size: 13px; color: var(--text-2); }
.ov-sub b { color: var(--text); letter-spacing: 0.08em; }
.ov-actions { display: flex; gap: 8px; margin-top: 8px; }
.ov-x { position: absolute; top: 8px; right: 8px; }
.stats { display: flex; gap: 18px; margin: 6px 0 2px; }
.stats div { display: flex; flex-direction: column; align-items: center; }
.stats b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 10px; color: var(--text-2); }

/* Snake */
.snake { position: relative; border-radius: 10px; overflow: hidden; }
.snake canvas { display: block; }

/* Five */
.five { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.fv-board { display: grid; gap: 5px; }
.fv-row { display: grid; grid-template-columns: repeat(5, 44px); gap: 5px; }
.fv-row.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.fv-tile {
  width: 44px; height: 44px; border-radius: 8px;
  display: grid; place-items: center;
  font: 700 22px var(--font-rounded); text-transform: uppercase;
  box-shadow: inset 0 0 0 1.5px var(--separator);
}
.fv-tile[data-state="filled"] { box-shadow: inset 0 0 0 1.5px var(--text-3); animation: pop 0.1s; }
.fv-tile[data-state="correct"] { background: var(--five-correct); color: #fff; box-shadow: none; }
.fv-tile[data-state="present"] { background: var(--five-present); color: #fff; box-shadow: none; }
.fv-tile[data-state="absent"] { background: var(--five-absent); color: #fff; box-shadow: none; }
.fv-tile.flip { animation: flip 250ms ease-in-out; }
@keyframes pop { 50% { transform: scale(1.08); } }
@keyframes flip { 50% { transform: rotateX(90deg); } }
.fv-kb { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.kb-row { display: flex; gap: 4px; }
.key { width: 29px; height: 38px; border-radius: 6px; display: grid; place-items: center; background: var(--fill-hover); font-size: 13px; font-weight: 600; }
.key:hover { background: var(--fill-strong); }
.key.wide { width: 47px; font-size: 11px; }
.key[data-state="correct"] { background: var(--five-correct); color: #fff; }
.key[data-state="present"] { background: var(--five-present); color: #fff; }
.key[data-state="absent"] { background: var(--five-absent); color: #fff; opacity: 0.55; }

/* 2048 */
.g2048 { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.g2-board { position: relative; border-radius: 12px; background: var(--fill); touch-action: none; }
.g2-cell, .g2-tile { position: absolute; top: 0; left: 0; width: 70px; height: 70px; border-radius: 8px; }
.g2-cell { background: var(--fill-hover); }
.g2-tiles { position: absolute; inset: 0; }
.g2-tile {
  display: grid; place-items: center;
  font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text);
  transition: transform 110ms ease-out;
}
.g2-tile.light-text { color: #fff; }
.g2-tile.huge { background: var(--text); color: var(--panel-solid); }
/* New tiles appear once the slide finishes; merged tiles pop. These animate `scale`,
   a separate property from the slide's `transform`, so the two don't fight. */
.g2-tile.spawn { animation: g2-spawn 120ms ease-out 90ms both; }
.g2-tile.pop { animation: g2-pop 160ms ease-out 100ms; }
@keyframes g2-spawn { from { scale: 0.2; opacity: 0; } }
@keyframes g2-pop { 45% { scale: 1.12; } }
.g2048 .g-overlay { border-radius: 12px; }
.g2-new { height: 24px; font-size: 11.5px; }

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: 40px; z-index: 10;
  transform: translate(-50%, 8px);
  padding: 7px 14px; border-radius: 999px;
  background: var(--toast-bg); color: var(--toast-text);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .panel, .panel.open { transform: none !important; }
  .view.enter, .view.enter-back, .fv-tile, .fv-row.shake, .hot.beacon::after, .mac-card, .g2-tile { animation: none !important; }
  .g2-tile { transition: none; }
  .hot.beacon::after { opacity: 0.8; transform: scale(1.1); }
}
@media (prefers-reduced-transparency: reduce) {
  .panel[data-style] { background: var(--panel-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .panel[data-style="glass"]::before { display: none; }
  .cmd, .desktop-hint, .menubar, .dock, .dock-item::before { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .dock { background: var(--panel-solid); }
}

/* ---------- Phones and tablets ---------- */
.touch-close { display: none; }
.touch .touch-close { display: grid; }
.touch .hot, .touch .desktop-hint { display: none; }
/* Touch screens have no hover: no stuck Dock labels. */
.touch .dock-item::before { display: none; }
/* The glass is see-through: hide the headline behind an open panel so text doesn't show through. */
.touch .hero { transition: opacity 0.2s; }
.touch .desktop:has(.panel.open) .hero { opacity: 0; }
.snake canvas { max-width: 100%; height: auto !important; }
@media (max-width: 600px) {
  /* On phones the open panel takes the whole screen, so the Dock steps aside (close with × or the menu bar icon). */
  .touch .dock { transition: opacity 0.2s; }
  .touch .desktop:has(.panel.open) .dock { opacity: 0; pointer-events: none; }
}
.snake { touch-action: none; }

@media (max-width: 600px) {
  /* The panel spans the screen, above the Dock. */
  .panel[data-corner] {
    left: 8px; right: 8px; width: auto;
    top: calc(var(--menubar-h) + 8px); bottom: auto;
    height: min(560px, calc(100% - var(--menubar-h) - 16px));
    transform-origin: top center;
  }
  .panel[data-corner="bl"], .panel[data-corner="br"] { top: auto; bottom: 8px; transform-origin: bottom center; }
  .g-stage { padding: 0 10px; }
}

/* ---------- Narrow windows ---------- */
@media (max-width: 720px) {
  #clock { display: none; }
}
