:root {
  --ink: #0e1418;
  --ink-soft: #1a242c;
  --mist: #e6ece8;
  --paper: #f3f6f2;
  --accent: #ff6b4a;
  --accent-2: #3ecfb2;
  --accent-dark: #d44a2e;
  --title-text: #f4f7f4;
  --border: #0e1418;
  --dock: rgba(14, 20, 24, 0.82);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  --font: "DM Sans", "Segoe UI", sans-serif;
  --display: "Syne", "DM Sans", sans-serif;
  --mono: "IBM Plex Mono", "Consolas", monospace;
  --dock-h: 58px;
  --radius: 14px;
  --focus: #ff6b4a;
  --scroll-track: #d0d8d0;
  --scroll-thumb: #4a6a5a;
  --scroll-thumb-hover: #ff6b4a;
  --wallpaper:
    radial-gradient(ellipse 90% 60% at 10% 20%, rgba(62, 207, 178, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgba(255, 107, 74, 0.28), transparent 50%),
    linear-gradient(145deg, #122028 0%, #1a3040 40%, #243848 100%);
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--border);
  background: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
}

.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* Boot */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #0a1014;
  transition: opacity 0.45s ease, visibility 0.45s;
}

.boot-screen[hidden] {
  display: none !important;
}

.boot-screen.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Power off */
.power-screen {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: #050808;
}

.power-screen[hidden] {
  display: none !important;
}

.power-on-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.35rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: #121820;
  color: #eef2ee;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1rem;
}

.power-on-btn:hover,
.power-on-btn:focus-visible {
  border-color: var(--accent);
  background: #1a242c;
}

.power-orb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: inset 0 0 0 4px #121820;
  background: radial-gradient(circle at 50% 30%, var(--accent), transparent 55%);
}

.power-caption {
  margin: 0;
  color: #5a6a68;
  font-size: 0.9rem;
}

/* Login */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9997;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(62, 207, 178, 0.2), transparent),
    linear-gradient(160deg, #0e1418, #1a2830 60%, #122028);
}

.login-screen[hidden] {
  display: none !important;
}

.login-card {
  width: min(360px, 100%);
  padding: 1.5rem 1.35rem 1.35rem;
  border-radius: 20px;
  background: rgba(243, 246, 242, 0.96);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.login-avatar {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.35rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff 0 12%, transparent 13%),
    linear-gradient(145deg, var(--accent), #ff8a60);
}

.login-title {
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-size: 1.4rem;
}

.login-hint {
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: #5a6a60;
}

.login-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #3a4a40;
}

.login-card input {
  border: 1px solid #8a9a8a;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  margin-bottom: 0.35rem;
}

.login-card input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.login-error {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #a03030;
}

.login-submit {
  margin-top: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, var(--accent), #ff8a60);
  color: #1a1010;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.95rem;
}

.desktop[hidden] {
  display: none !important;
}

.boot-brand {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #f4f7f4;
}

.boot-sub {
  margin: 0.5rem 0 1.25rem;
  color: #7a9a98;
  font-size: 0.95rem;
}

.boot-bar {
  height: 5px;
  width: min(220px, 70vw);
  background: #243038;
  border-radius: 999px;
  overflow: hidden;
}

.boot-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  animation: bootLoad 1.05s ease forwards;
}

@keyframes bootLoad {
  to { width: 100%; }
}

/* Desktop */
.desktop {
  position: relative;
  height: 100%;
  width: 100%;
  background: var(--wallpaper);
  background-size: cover;
  background-position: center;
  padding-bottom: calc(var(--dock-h) + 1.25rem);
  overflow: hidden;
}

/* Custom cursor themes (set via Preferences) */
.desktop[data-cursor] {
  cursor: var(--os-cursor);
}

.desktop[data-cursor] button,
.desktop[data-cursor] a,
.desktop[data-cursor] .desktop-icon,
.desktop[data-cursor] .dock-btn,
.desktop[data-cursor] .hub-btn,
.desktop[data-cursor] .win-btn,
.desktop[data-cursor] .app-btn,
.desktop[data-cursor] .mine-cell,
.desktop[data-cursor] .wallpaper-opt,
.desktop[data-cursor] .cursor-opt,
.desktop[data-cursor] .hub-action,
.desktop[data-cursor] .files-name,
.desktop[data-cursor] .about-tab,
.desktop[data-cursor] .store-card button {
  cursor: var(--os-cursor-pointer);
}

.desktop[data-cursor] .window-titlebar {
  cursor: var(--os-cursor-grab);
}

.desktop[data-cursor] .window-titlebar:active {
  cursor: var(--os-cursor-grab);
}

.desktop[data-cursor] .paint-canvas-wrap canvas {
  cursor: var(--os-cursor-cross) !important;
}

.desktop.is-editing .desktop-icons {
  outline: 2px dashed rgba(255, 107, 74, 0.55);
  outline-offset: 6px;
  border-radius: 12px;
}

.edit-hint {
  position: relative;
  z-index: 2;
  margin: 0.75rem 1rem 0;
  width: fit-content;
  max-width: calc(100% - 2rem);
  font-size: 0.8rem;
  color: rgba(255, 220, 200, 0.95);
  background: rgba(0, 0, 0, 0.35);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
}

.desktop-icons {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.4rem;
  padding: 0.5rem 1rem 1rem;
  max-height: calc(100% - var(--dock-h) - 4rem);
  width: max-content;
}

.desktop-icon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 88px;
  padding: 0.55rem 0.3rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #f2f6f2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.desktop-icon.is-editable {
  cursor: grab;
}

.desktop-icon.is-editable:active {
  cursor: grabbing;
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.desktop-icon.is-dragging {
  opacity: 0.45;
}

.desktop-icon.is-drop-target {
  border-color: var(--accent);
  background: rgba(255, 107, 74, 0.2);
}

.icon-remove {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #c44;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  text-align: center;
  text-shadow: none;
}

.icon-remove:hover,
.icon-remove:focus-visible {
  background: #a03030;
  filter: brightness(1.08);
}

.waste-info .files-name {
  display: block;
  font-weight: 600;
  color: #1a3a4a;
  padding: 0.4rem 0.5rem;
}

.icon-glyph {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 3px 8px rgba(0, 0, 0, 0.25);
}

.icon-glyph::before {
  content: "";
  display: block;
}

.icon-paint,
.desktop-icon[data-app="paint"] .icon-glyph {
  background: linear-gradient(145deg, #ff8a60, #e04a30);
}
.icon-paint::before,
.desktop-icon[data-app="paint"] .icon-glyph::before {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 3px;
  transform: rotate(-35deg);
}

.icon-notepad,
.desktop-icon[data-app="notepad"] .icon-glyph {
  background: linear-gradient(145deg, #f5f0e0, #d4ceb8);
}
.icon-notepad::before,
.desktop-icon[data-app="notepad"] .icon-glyph::before {
  width: 15px;
  height: 19px;
  background: repeating-linear-gradient(#fff 0 3px, #8ab 3px 4px);
  border: 2px solid #4a5a60;
  border-radius: 2px;
}

.icon-minesweeper,
.desktop-icon[data-app="minesweeper"] .icon-glyph,
.store-icon.icon-minesweeper {
  background: linear-gradient(145deg, #5a7a5a, #2a4a2a);
}
.icon-minesweeper::before,
.desktop-icon[data-app="minesweeper"] .icon-glyph::before {
  width: 12px;
  height: 12px;
  background: #111;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #c44;
}

.icon-terminal,
.desktop-icon[data-app="terminal"] .icon-glyph {
  background: linear-gradient(145deg, #1a2824, #0a1412);
}
.icon-terminal::before,
.desktop-icon[data-app="terminal"] .icon-glyph::before {
  content: ">_";
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--accent-2);
  width: auto;
  height: auto;
}

.icon-settings,
.desktop-icon[data-app="settings"] .icon-glyph {
  background: linear-gradient(145deg, #6a7a8a, #3a4a5a);
}
.icon-settings::before,
.desktop-icon[data-app="settings"] .icon-glyph::before {
  width: 14px;
  height: 14px;
  border: 3px solid #eef;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #6a7a8a;
}

.icon-files,
.desktop-icon[data-app="files"] .icon-glyph {
  background: linear-gradient(145deg, #f0c060, #c89030);
}
.icon-files::before,
.desktop-icon[data-app="files"] .icon-glyph::before {
  width: 20px;
  height: 14px;
  background: #f8e8b0;
  border-radius: 0 2px 3px 3px;
  box-shadow: -4px -4px 0 -1px #e8c070;
}

.icon-calculator,
.desktop-icon[data-app="calculator"] .icon-glyph {
  background: linear-gradient(145deg, #3a4450, #1a2028);
}
.icon-calculator::before,
.desktop-icon[data-app="calculator"] .icon-glyph::before {
  content: "12";
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 700;
  color: #3ecfb2;
  width: auto;
  height: auto;
}

.icon-clock,
.desktop-icon[data-app="clock"] .icon-glyph {
  background: linear-gradient(145deg, #e8ece8, #b8c0b8);
}
.icon-clock::before,
.desktop-icon[data-app="clock"] .icon-glyph::before {
  width: 18px;
  height: 18px;
  border: 2px solid #1a2a30;
  border-radius: 50%;
  box-shadow: inset -4px 0 0 #ff6b4a;
}

.icon-wastebin,
.desktop-icon[data-app="wastebin"] .icon-glyph {
  background: linear-gradient(145deg, #6a7a6a, #3a4a3a);
}
.icon-wastebin::before,
.desktop-icon[data-app="wastebin"] .icon-glyph::before {
  width: 16px;
  height: 14px;
  border: 2px solid #e8ece8;
  border-radius: 0 0 4px 4px;
  border-top: none;
  box-shadow: 0 -3px 0 #e8ece8;
}

.desktop-icon[data-app="wastebin"].is-full .icon-glyph {
  background: linear-gradient(145deg, #8a6a4a, #5a3a2a);
}

.icon-browser,
.desktop-icon[data-app="browser"] .icon-glyph {
  background: linear-gradient(145deg, #4a9ad0, #1a5080);
}
.icon-browser::before,
.desktop-icon[data-app="browser"] .icon-glyph::before {
  width: 18px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 3px;
  box-shadow: inset 0 -3px 0 #ff6b4a;
}

.icon-gallery,
.desktop-icon[data-app="gallery"] .icon-glyph {
  background: linear-gradient(145deg, #8ad0e8, #4a90b0);
}
.icon-gallery::before,
.desktop-icon[data-app="gallery"] .icon-glyph::before {
  width: 16px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 4px 4px 0 #ff6b4a;
}

.icon-music,
.desktop-icon[data-app="music"] .icon-glyph,
.store-icon.icon-music {
  background: linear-gradient(145deg, #c45490, #802050);
}
.icon-music::before,
.desktop-icon[data-app="music"] .icon-glyph::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 6px -6px 0 -2px #fff;
}

.icon-code,
.desktop-icon[data-app="code"] .icon-glyph,
.store-icon.icon-code {
  background: linear-gradient(145deg, #2a3848, #121820);
}
.icon-code::before,
.desktop-icon[data-app="code"] .icon-glyph::before {
  content: "</>";
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 700;
  color: #3ecfb2;
  width: auto;
  height: auto;
}

.icon-playmind,
.desktop-icon[data-app="playmind"] .icon-glyph,
.store-icon.icon-playmind {
  background: linear-gradient(145deg, #6a5ac8, #3a2a88);
}
.icon-playmind::before,
.desktop-icon[data-app="playmind"] .icon-glyph::before {
  content: "AI";
  font-size: 12px;
  font-family: var(--display);
  font-weight: 800;
  color: #fff;
  width: auto;
  height: auto;
}

.icon-flappy,
.desktop-icon[data-app="flappy"] .icon-glyph,
.store-icon.icon-flappy {
  background: linear-gradient(145deg, #7ec8e8, #3a90b0);
}
.icon-flappy::before,
.desktop-icon[data-app="flappy"] .icon-glyph::before {
  width: 14px;
  height: 10px;
  background: #ff6b4a;
  border-radius: 50% 50% 40% 40%;
  box-shadow: 8px 2px 0 #3aaa70;
}

.icon-memory,
.desktop-icon[data-app="memory"] .icon-glyph,
.store-icon.icon-memory {
  background: linear-gradient(145deg, #c878d0, #803898);
}
.icon-memory::before,
.desktop-icon[data-app="memory"] .icon-glyph::before {
  content: "?";
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  width: auto;
  height: auto;
}

.icon-tictactoe,
.desktop-icon[data-app="tictactoe"] .icon-glyph,
.store-icon.icon-tictactoe {
  background: linear-gradient(145deg, #e8ece8, #a8b0a8);
}
.icon-tictactoe::before,
.desktop-icon[data-app="tictactoe"] .icon-glyph::before {
  content: "XO";
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 800;
  color: #1a2a20;
  width: auto;
  height: auto;
}

.icon-reaction,
.desktop-icon[data-app="reaction"] .icon-glyph,
.store-icon.icon-reaction {
  background: linear-gradient(145deg, #50c878, #208040);
}
.icon-reaction::before,
.desktop-icon[data-app="reaction"] .icon-glyph::before {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 3px #50c878;
}

.icon-store,
.desktop-icon[data-app="store"] .icon-glyph {
  background: linear-gradient(145deg, #4a9ad0, #2a6090);
}
.icon-store::before,
.desktop-icon[data-app="store"] .icon-glyph::before {
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 4px;
  background: transparent;
}

.icon-about,
.desktop-icon[data-app="about"] .icon-glyph {
  background: linear-gradient(145deg, #8a90a8, #4a5068);
}
.icon-about::before,
.desktop-icon[data-app="about"] .icon-glyph::before {
  content: "i";
  font-size: 18px;
  font-weight: 800;
  font-style: italic;
  color: #fff;
  width: auto;
  height: auto;
  font-family: var(--display);
}

.icon-snake,
.desktop-icon[data-app="snake"] .icon-glyph,
.store-icon.icon-snake {
  background: linear-gradient(145deg, #3ecf70, #1a8a40);
}
.icon-snake::before,
.desktop-icon[data-app="snake"] .icon-glyph::before {
  width: 18px;
  height: 8px;
  background: #0a4020;
  border-radius: 4px;
  box-shadow: 8px -4px 0 #0a4020;
}

.icon-pong,
.desktop-icon[data-app="pong"] .icon-glyph,
.store-icon.icon-pong {
  background: linear-gradient(145deg, #2a3040, #121820);
}
.icon-pong::before,
.desktop-icon[data-app="pong"] .icon-glyph::before {
  width: 4px;
  height: 14px;
  background: #7ec8e8;
  box-shadow: 12px 0 0 #e87878, 6px 4px 0 2px #fff;
}

.icon-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

.windows-layer {
  position: absolute;
  inset: 0 0 calc(var(--dock-h) + 1rem) 0;
  pointer-events: none;
  z-index: 10;
}

.windows-layer > * {
  pointer-events: auto;
}

/* Windows: soft cards, not classic OS chrome */
.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 260px;
  min-height: 180px;
  background: var(--paper);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: winIn 0.22s ease;
}

@keyframes winIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.window.is-maximized {
  top: 0.5rem !important;
  left: 0.5rem !important;
  width: calc(100% - 1rem) !important;
  height: calc(100% - var(--dock-h) - 1.5rem) !important;
  border-radius: 16px;
}

.window.is-minimized {
  display: none !important;
}

.window-titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem 0.45rem 0.85rem;
  background: var(--ink-soft);
  color: var(--title-text);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.window.is-focused .window-titlebar {
  background: linear-gradient(105deg, #1a3038, #243840 60%, #2a3830);
}

.window-titlebar:active {
  cursor: grabbing;
}

.window-title {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-controls {
  display: flex;
  gap: 0.25rem;
}

.win-btn {
  width: 30px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #eef;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.win-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.win-btn.close {
  background: var(--accent);
  color: #fff;
}

.win-btn.close:hover {
  filter: brightness(1.08);
}

.window-body {
  flex: 1;
  overflow: auto;
  background: var(--paper);
  min-height: 0;
}

/* Custom scrollbars inside OS windows / apps */
.window,
.window * {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

.window::-webkit-scrollbar,
.window *::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.window::-webkit-scrollbar-track,
.window *::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}

.window::-webkit-scrollbar-thumb,
.window *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-2), var(--scroll-thumb));
  border-radius: 999px;
  border: 2px solid var(--scroll-track);
}

.window::-webkit-scrollbar-thumb:hover,
.window *::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  border-color: transparent;
}

.window::-webkit-scrollbar-corner,
.window *::-webkit-scrollbar-corner {
  background: var(--scroll-track);
}

/* Darker apps get matching dark scroll tracks */
.term-app,
.term-app *,
.browser-app,
.browser-app *,
.music-app,
.music-app *,
.code-app,
.code-app *,
.gallery-app,
.gallery-app *,
.calc-app,
.calc-app * {
  scrollbar-color: #3ecfb2 #121820;
}

.term-app::-webkit-scrollbar-track,
.term-app *::-webkit-scrollbar-track,
.browser-app::-webkit-scrollbar-track,
.browser-app *::-webkit-scrollbar-track,
.music-app::-webkit-scrollbar-track,
.music-app *::-webkit-scrollbar-track,
.code-app::-webkit-scrollbar-track,
.code-app *::-webkit-scrollbar-track,
.gallery-app::-webkit-scrollbar-track,
.gallery-app *::-webkit-scrollbar-track,
.calc-app::-webkit-scrollbar-track,
.calc-app *::-webkit-scrollbar-track {
  background: #121820;
}

.term-app::-webkit-scrollbar-thumb,
.term-app *::-webkit-scrollbar-thumb,
.browser-app::-webkit-scrollbar-thumb,
.browser-app *::-webkit-scrollbar-thumb,
.music-app::-webkit-scrollbar-thumb,
.music-app *::-webkit-scrollbar-thumb,
.code-app::-webkit-scrollbar-thumb,
.code-app *::-webkit-scrollbar-thumb,
.gallery-app::-webkit-scrollbar-thumb,
.gallery-app *::-webkit-scrollbar-thumb,
.calc-app::-webkit-scrollbar-thumb,
.calc-app *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3ecfb2, #2a6a5a);
  border-color: #121820;
}

/* Floating dock */
.dock {
  position: fixed;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  z-index: 5000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: min(920px, calc(100vw - 1.25rem));
  height: var(--dock-h);
  padding: 0.4rem 0.55rem;
  background: var(--dock);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  color: #eef2ee;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.hub-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 42px;
  padding: 0 0.9rem 0 0.55rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ff8a60);
  color: #1a1010;
  font-weight: 800;
  font-family: var(--display);
  font-size: 0.85rem;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.hub-btn:hover,
.hub-btn[aria-expanded="true"] {
  filter: brightness(1.06);
}

.hub-orb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff 0 18%, transparent 19%),
    linear-gradient(145deg, var(--accent-2), #1a8a70);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.25);
}

.dock-apps {
  display: flex;
  flex: 1;
  gap: 0.3rem;
  overflow-x: auto;
  min-width: 0;
  scrollbar-width: none;
}

.dock-apps::-webkit-scrollbar {
  display: none;
}

.dock-btn {
  flex-shrink: 0;
  max-width: 140px;
  height: 36px;
  padding: 0 0.85rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef2ee;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-btn.is-active {
  background: rgba(255, 107, 74, 0.35);
}

.dock-btn.is-minimized {
  opacity: 0.55;
}

.dock-meta {
  flex-shrink: 0;
  padding: 0 0.85rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Orb panel (system only, no apps) */
.hub-panel {
  position: fixed;
  left: max(0.75rem, calc(50% - 460px));
  bottom: calc(var(--dock-h) + 1.1rem);
  z-index: 5001;
  width: min(300px, calc(100vw - 1.5rem));
  background: rgba(243, 246, 242, 0.97);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: menuIn 0.18s ease;
}

.hub-panel[hidden] {
  display: none !important;
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hub-header {
  padding: 1rem 1.15rem;
  background: linear-gradient(120deg, #1a3038, #2a4840);
  color: #f0f4f0;
}

.hub-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 800;
}

.hub-tag {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  opacity: 0.8;
}

.hub-list {
  list-style: none;
  margin: 0;
  padding: 0.45rem;
}

.hub-action {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.9rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1a2a30;
}

.hub-action:hover,
.hub-action:focus-visible {
  background: #dce8e0;
}

.hub-foot {
  margin: 0;
  padding: 0.5rem 1rem 0.9rem;
  font-size: 0.75rem;
  color: #5a6a60;
  line-height: 1.4;
}

.hub-sep {
  height: 1px;
  margin: 0.35rem 0.65rem;
  background: #c8d0c8;
  list-style: none;
  padding: 0;
}

.hub-danger {
  color: #a03030 !important;
}

/* App shared */
.app-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.5rem 0.65rem;
  background: #e2e8e2;
  border-bottom: 1px solid #c4ccc4;
}

.app-toolbar label {
  font-size: 0.8rem;
  font-weight: 600;
}

.app-toolbar input[type="color"] {
  width: 32px;
  height: 28px;
  padding: 0;
  border: 1px solid #666;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.app-toolbar input[type="range"] {
  width: 80px;
}

.app-btn {
  padding: 0.35rem 0.7rem;
  border: 1px solid #6a7a6a;
  border-radius: 999px;
  background: #eef2ee;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1a2a20;
}

.app-btn:hover {
  background: #fff;
}

.app-btn.is-active {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #1a1010;
}

.app-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.app-status {
  margin-left: auto;
  font-size: 0.75rem;
  color: #4a5a50;
}

.notepad-file {
  font-size: 0.78rem;
  font-weight: 700;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Paint */
.paint-app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.paint-canvas-wrap {
  flex: 1;
  overflow: auto;
  background: #c8d2cc;
  display: grid;
  place-items: center;
  padding: 0.75rem;
}

.paint-canvas-wrap canvas {
  background: #fff;
  border: 1px solid #888;
  border-radius: 4px;
  cursor: crosshair;
  touch-action: none;
  max-width: 100%;
}

/* Notepad */
.notepad-app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.notepad-app textarea {
  flex: 1;
  width: 100%;
  min-height: 200px;
  border: none;
  resize: none;
  padding: 0.85rem 1rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.5;
  background: #fafcf8;
  color: #1a2a20;
}

.notepad-app textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* Browser */
.browser-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #1a2028;
  min-height: 0;
}

.browser-app.is-incognito {
  background: #0a0c10;
}

.browser-app.is-incognito .browser-toolbar,
.browser-app.is-incognito .browser-bookmarks {
  background: #1a1420;
  border-color: #2a2030;
  color: #e8e0f0;
}

.browser-app.is-incognito .browser-url,
.browser-app.is-incognito .browser-bm {
  background: #121018;
  color: #e8e0f0;
  border-color: #3a3040;
}

.browser-app.is-incognito .browser-home {
  background: radial-gradient(ellipse at 50% 0%, #2a1840, #0a0c10 60%);
}

.browser-app.is-incognito .browser-status {
  background: #08060c;
  color: #b898d0;
}

.browser-incog.is-active {
  background: #4a3080;
  border-color: #6a50a0;
  color: #fff;
}

.browser-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  background: #e2e8e2;
  border-bottom: 1px solid #c4ccc4;
}

.browser-url-form {
  display: flex;
  flex: 1;
  gap: 0.35rem;
  min-width: 160px;
}

.browser-url {
  flex: 1;
  min-width: 0;
  border: 1px solid #6a7a6a;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
}

.browser-external {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.browser-bookmarks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.35rem 0.55rem;
  background: #d8e0d8;
  border-bottom: 1px solid #c4ccc4;
}

.browser-bm {
  border: none;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1a3a4a;
}

.browser-bm:hover,
.browser-bm.is-active {
  background: #ff6b4a;
  color: #1a1010;
}

.browser-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #0e1418;
  display: flex;
  flex-direction: column;
}

.browser-home {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(62, 207, 178, 0.2), transparent),
    #121820;
  color: #eef2ee;
}

.browser-home-brand {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
}

.browser-home-sub {
  margin: 0;
  font-size: 0.9rem;
  color: #8ab8a8;
}

.browser-home-search {
  display: flex;
  gap: 0.4rem;
  width: min(480px, 100%);
  margin-top: 0.5rem;
}

.browser-home-input {
  flex: 1;
  border: 1px solid #4a5a58;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font: inherit;
  background: #0e1418;
  color: #eef2ee;
}

.browser-home-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.35rem;
}

.browser-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: none;
  background: #fff;
}

.browser-blocked {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  background: #1a2430;
  color: #d0d8d8;
  border-top: 1px solid #2a3840;
  max-height: 40%;
  overflow: auto;
}

.browser-blocked.is-strip {
  max-height: 28%;
}

.browser-blocked h3 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 0.95rem;
  color: #fff;
}

.browser-blocked p {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #a8b4b0;
}

.browser-fallback-link {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1010;
  font-weight: 800;
  text-decoration: none;
  font-size: 0.8rem;
}

.browser-status {
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-family: var(--mono);
  color: #8ab8a8;
  background: #0c1216;
  border-top: 1px solid #1a2820;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Explorer */
.explorer-app {
  display: grid;
  grid-template-columns: 120px 1fr;
  height: 100%;
  min-height: 0;
}

.explorer-side {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem;
  background: #d8e0d8;
  border-right: 1px solid #b8c0b8;
  overflow: auto;
}

.explorer-folder {
  border: none;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  padding: 0.55rem 0.65rem;
  font-weight: 700;
  font-size: 0.82rem;
  color: #1a2a20;
}

.explorer-folder.is-active,
.explorer-folder:hover {
  background: #fff;
}

.explorer-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.explorer-folder-system {
  margin-top: 0.35rem;
  border-top: 1px solid #b8c0b8;
  padding-top: 0.65rem;
  border-radius: 0 0 10px 10px;
}

.explorer-system {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.explorer-system-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  color: #1a2a20;
}

.explorer-system-mode {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #3a4a40;
}

.explorer-disk-usage {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #1a2a20;
}

.explorer-disk-usage.is-critical,
.explorer-disk-dl dd.is-critical,
.store-meter-label.is-critical,
.sandbox-line.is-critical {
  color: #b01020;
}

.explorer-disk-bar {
  max-width: 280px;
}

.explorer-disk-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
}

.explorer-disk-dl dt {
  margin: 0;
  font-weight: 700;
  color: #4a5a50;
}

.explorer-disk-dl dd {
  margin: 0;
  font-weight: 800;
  color: #1a2a20;
}

.store-meter-label.is-critical {
  font-weight: 800;
}

.files-app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.files-kind {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
  background: #1a2a28;
  color: #3ecfb2;
}

.waste-app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.waste-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.waste-from {
  font-size: 0.72rem;
  color: #5a6a60;
  padding-left: 0.5rem;
}

.files-path {
  font-weight: 800;
  font-family: var(--display);
  font-size: 0.9rem;
}

.files-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  flex: 1;
  overflow: auto;
}

.files-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem;
  border-radius: 10px;
}

.files-item:hover {
  background: #e4ece4;
}

.files-name {
  flex: 1;
  text-align: left;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: #1a3a4a;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
}

.files-name:hover {
  text-decoration: underline;
}

.files-del {
  flex-shrink: 0;
}

.files-empty {
  padding: 1.5rem;
  text-align: center;
  color: #6a7a70;
}

.files-hint {
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  color: #5a6a60;
  border-top: 1px solid #d0d8d0;
}

/* Store */
.store-app {
  padding: 1rem 1.1rem 1.25rem;
}

.store-app h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
}

.store-intro {
  margin: 0.35rem 0 1rem;
  font-size: 0.88rem;
  color: #4a5a50;
}

.store-meter {
  margin: 0.5rem 0 0.35rem;
}

.store-meter-label {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--mono);
  color: #2a3a30;
}

.store-meter-bar {
  height: 10px;
  border-radius: 999px;
  background: #d0d8d0;
  overflow: hidden;
}

.store-meter-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 999px;
  transition: width 0.25s ease;
}

.store-meter-bar.is-full span {
  background: #c44;
}

.sandbox-status {
  margin-top: 0.35rem;
}

.sandbox-line {
  margin: 0 0 0.4rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.sandbox-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.sandbox-mode-btn.is-active {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #1a1010;
}

.store-meter-bar.is-free span {
  background: linear-gradient(90deg, #3ecfb2, #2a9a70);
}

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

.store-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  background: #e8eee8;
  border-radius: 14px;
}

.store-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.store-icon::before {
  content: "";
  display: block;
}

.store-icon.icon-snake::before {
  width: 18px;
  height: 8px;
  background: #0a4020;
  border-radius: 4px;
  box-shadow: 8px -4px 0 #0a4020;
}

.store-icon.icon-pong::before {
  width: 4px;
  height: 14px;
  background: #7ec8e8;
  box-shadow: 12px 0 0 #e87878, 6px 4px 0 2px #fff;
}

.store-icon.icon-minesweeper::before {
  width: 12px;
  height: 12px;
  background: #111;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #c44;
}

.store-icon.icon-music::before {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 6px -6px 0 -2px #fff;
}

.store-icon.icon-code::before {
  content: "</>";
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 700;
  color: #3ecfb2;
  width: auto;
  height: auto;
}

.store-icon.icon-playmind::before {
  content: "AI";
  font-size: 12px;
  font-family: var(--display);
  font-weight: 800;
  color: #fff;
  width: auto;
  height: auto;
}

.store-body h3 {
  margin: 0;
  font-size: 1rem;
}

.store-cat {
  margin: 0.1rem 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5a7a6a;
}

.store-body p:last-child {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: #3a4a40;
}

/* About / legal app */
.about-app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.about-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  background: #e2e8e2;
  border-bottom: 1px solid #c4ccc4;
}

.about-tab {
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 700;
  color: #3a4a40;
}

.about-tab.is-active,
.about-tab[aria-selected="true"] {
  background: var(--ink-soft);
  color: #fff;
}

.about-panel {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.15rem 1.5rem;
}

.about-panel h2 {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-size: 1.15rem;
}

.about-panel p {
  margin: 0 0 0.75rem;
  line-height: 1.55;
  font-size: 0.92rem;
}

.about-panel a {
  color: #1a5a4a;
  font-weight: 700;
}

/* Games */
.game-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem;
  background: #d8e0d8;
  height: 100%;
}

.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 360px;
  font-weight: 700;
}

.game-tip {
  margin: 0;
  font-size: 0.78rem;
  color: #4a5a50;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  width: 100%;
  max-width: 300px;
}

.memory-card {
  aspect-ratio: 1;
  border: none;
  border-radius: 10px;
  background: #1a2a28;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
}

.memory-card.is-open,
.memory-card.is-matched {
  background: #eef2ee;
  color: #1a2a20;
}

.memory-card.is-matched {
  background: #c8e8d0;
}

.ttt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  width: 220px;
}

.ttt-cell {
  aspect-ratio: 1;
  border: none;
  border-radius: 10px;
  background: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  color: #1a2a20;
}

.ttt-cell.is-x {
  color: #ff6b4a;
}

.ttt-cell.is-o {
  color: #2a6a90;
}

.ttt-cell:disabled {
  opacity: 1;
}

.reaction-pad {
  width: min(280px, 100%);
  min-height: 160px;
  border: none;
  border-radius: 16px;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.reaction-pad.is-idle {
  background: #4a5a60;
}

.reaction-pad.is-wait {
  background: #c45454;
}

.reaction-pad.is-go {
  background: #2aaa5a;
}

.reaction-pad.is-fail {
  background: #803030;
}

.reaction-pad.is-done {
  background: #2a4a6a;
}

.store-icon.icon-flappy::before {
  width: 14px;
  height: 10px;
  background: #ff6b4a;
  border-radius: 50% 50% 40% 40%;
  box-shadow: 8px 2px 0 #3aaa70;
}

.store-icon.icon-memory::before {
  content: "?";
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  width: auto;
  height: auto;
}

.store-icon.icon-tictactoe::before {
  content: "XO";
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 800;
  color: #1a2a20;
  width: auto;
  height: auto;
}

.store-icon.icon-reaction::before {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 3px #50c878;
}

.game-app canvas {
  border-radius: 8px;
  border: 2px solid #1a2a20;
  max-width: 100%;
  background: #111;
}

/* Minesweeper */
.mines-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  gap: 0.75rem;
  height: 100%;
  background: #c8d0c0;
}

.mines-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 280px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.1rem;
  color: #c44;
  background: #1a2a20;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
}

.mines-grid {
  display: grid;
  gap: 2px;
  background: #6a7a6a;
  padding: 4px;
  border-radius: 6px;
  touch-action: manipulation;
}

.mine-cell {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 3px;
  padding: 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  background: #b8c0b0;
  color: #1a2a20;
}

.mine-cell:hover:not(:disabled) {
  filter: brightness(1.05);
}

.mine-cell.is-open {
  background: #d0d8c8;
}

.mine-cell.is-flag {
  background: #c8b090;
}

.mine-cell.is-mine {
  background: #d45454;
  color: #fff;
}

.mine-cell[data-n="1"] { color: #2244aa; }
.mine-cell[data-n="2"] { color: #228822; }
.mine-cell[data-n="3"] { color: #cc2222; }
.mine-cell[data-n="4"] { color: #222288; }
.mine-cell[data-n="5"] { color: #882222; }
.mine-cell[data-n="6"] { color: #228888; }
.mine-cell[data-n="7"] { color: #222; }
.mine-cell[data-n="8"] { color: #666; }

/* Terminal */
.term-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0c1614;
  color: #4dda8a;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.term-output {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.term-output .term-err {
  color: #e87878;
}

.term-output .term-sys {
  color: #8ab8a8;
}

.term-input-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem 0.75rem;
  border-top: 1px solid #1a3028;
}

.term-prompt {
  color: var(--accent);
  flex-shrink: 0;
}

.term-input-row input {
  flex: 1;
  border: none;
  background: transparent;
  color: #4dda8a;
  font-family: inherit;
  font-size: inherit;
  caret-color: #4dda8a;
}

.term-input-row input:focus {
  outline: none;
}

/* Calculator */
.calc-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #1a2028;
  padding: 0.75rem;
  gap: 0.65rem;
}

.calc-display {
  background: #0e1418;
  color: #3ecfb2;
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 600;
  text-align: right;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  min-height: 3.2rem;
  word-break: break-all;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  flex: 1;
}

.calc-key {
  border: none;
  border-radius: 12px;
  background: #2a343c;
  color: #eef2ee;
  font-size: 1.05rem;
  font-weight: 700;
  min-height: 48px;
}

.calc-key:hover {
  filter: brightness(1.1);
}

.calc-op {
  background: #3a4850;
  color: #ff6b4a;
}

.calc-eq {
  background: var(--accent);
  color: #1a1010;
}

.calc-clear {
  background: #4a3030;
}

.calc-zero {
  grid-column: span 2;
}

/* Clock app */
.clock-app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.clock-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1rem;
  background: #e4ece4;
}

.clock-face {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: #f8faf8;
  border: 4px solid #1a2a30;
  box-shadow: inset 0 0 0 2px #c8d0c8;
}

.clock-hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  transform-origin: bottom center;
  background: #1a2a30;
  border-radius: 2px;
}

.clock-hand.hour {
  width: 5px;
  height: 48px;
  margin-left: -2.5px;
}

.clock-hand.minute {
  width: 3px;
  height: 68px;
  margin-left: -1.5px;
}

.clock-hand.second {
  width: 2px;
  height: 74px;
  margin-left: -1px;
  background: var(--accent);
}

.clock-digital {
  margin: 0;
  font-weight: 600;
  text-align: center;
  font-size: 0.9rem;
}

.clock-big {
  margin: 0;
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 700;
}

.clock-actions {
  display: flex;
  gap: 0.5rem;
}

.clock-input {
  width: 100px;
  padding: 0.4rem 0.55rem;
  border: 1px solid #6a7a6a;
  border-radius: 8px;
  font: inherit;
}

/* Gallery */
.gallery-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #1a2028;
}

.gallery-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 0.75rem;
  min-height: 0;
}

.gallery-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.gallery-strip {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem;
  overflow-x: auto;
  background: #121820;
}

.gallery-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 44px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #2a343c;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-thumb.is-active {
  border-color: var(--accent);
}

/* Music */
.music-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(160deg, #2a1830, #1a2028);
  color: #eef2ee;
}

.music-now {
  padding: 1.1rem 1.15rem 0.5rem;
}

.music-now h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
}

.music-now p {
  margin: 0.25rem 0 0.75rem;
  opacity: 0.75;
  font-size: 0.9rem;
}

.music-viz {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 36px;
}

.music-viz span {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.4;
}

.music-viz.is-playing span {
  animation: eq 0.55s ease-in-out infinite alternate;
}

.music-viz.is-playing span:nth-child(2) { animation-delay: 0.1s; }
.music-viz.is-playing span:nth-child(3) { animation-delay: 0.2s; }
.music-viz.is-playing span:nth-child(4) { animation-delay: 0.05s; }
.music-viz.is-playing span:nth-child(5) { animation-delay: 0.15s; }

@keyframes eq {
  from { height: 8px; }
  to { height: 32px; }
}

.music-controls {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
}

.music-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  flex: 1;
  overflow: auto;
}

.music-track {
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #eef2ee;
  padding: 0.65rem 0.75rem;
  font-weight: 600;
  font-size: 0.88rem;
}

.music-track:hover,
.music-track.is-active {
  background: rgba(255, 255, 255, 0.1);
}

.music-app .files-hint {
  border-top-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55);
}

/* Code Studio */
.code-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #121820;
}

.code-editor {
  flex: 1;
  min-height: 160px;
  border: none;
  resize: none;
  padding: 0.85rem 1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.45;
  background: #0e1418;
  color: #b8e8c8;
}

.code-editor:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent-2);
}

.code-out {
  margin: 0;
  max-height: 120px;
  overflow: auto;
  padding: 0.65rem 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  background: #1a242c;
  color: #e8c060;
  border-top: 1px solid #2a343c;
}

/* Playmind */
.ai-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #eef2ee;
}

.ai-banner {
  margin: 0;
  padding: 0.55rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #2a2038;
  color: #e8d8ff;
}

.ai-log {
  flex: 1;
  overflow: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ai-row {
  max-width: 92%;
}

.ai-row p {
  margin: 0.2rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  line-height: 1.45;
  font-size: 0.9rem;
}

.ai-who {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5a6a60;
}

.ai-bot p {
  background: #fff;
  border: 1px solid #d0d8d0;
}

.ai-user {
  align-self: flex-end;
  text-align: right;
}

.ai-user p {
  background: #ff6b4a;
  color: #1a1010;
  font-weight: 600;
}

.ai-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.65rem;
  border-top: 1px solid #d0d8d0;
  background: #e4ece4;
}

.ai-form input {
  flex: 1;
  border: 1px solid #8a9a8a;
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  font: inherit;
}

/* Settings */
.settings-app {
  padding: 1rem 1.15rem 1.5rem;
}

.settings-app h2 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 1.15rem;
}

.settings-app > p {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: #4a5a50;
}

.settings-group {
  margin-bottom: 1.25rem;
}

.settings-group legend,
.settings-group h3 {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #3a5a4a;
}

.settings-hint {
  margin: -0.25rem 0 0.65rem;
  font-size: 0.8rem;
  color: #5a6a60;
  line-height: 1.4;
}

.cursor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.5rem;
}

.cursor-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.4rem;
  border: 2px solid #8a9a8a;
  border-radius: 12px;
  background: #eef2ee;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1a2a20;
}

.cursor-opt:hover,
.cursor-opt:focus-visible {
  border-color: #5a7a6a;
}

.cursor-opt.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 107, 74, 0.35);
  background: #fff;
}

.cursor-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #1a2a20;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
}

.wallpaper-opt {
  height: 64px;
  border: 2px solid #8a9a8a;
  border-radius: 10px;
  padding: 0;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.wallpaper-opt.is-selected,
.wallpaper-opt:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 107, 74, 0.35);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Legal standalone pages */
.legal-body {
  overflow: auto;
  background: var(--wallpaper);
  background-attachment: fixed;
  font-family: var(--font);
  color: #1a2a30;
  min-height: 100vh;
}

.legal-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.legal-card {
  background: rgba(243, 246, 242, 0.96);
  border-radius: 16px;
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
}

.legal-card h1 {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.legal-card h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.1rem;
}

.legal-card p,
.legal-card li {
  line-height: 1.6;
  font-size: 0.95rem;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.legal-nav a {
  color: #1e4a5c;
  font-weight: 600;
}

.legal-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #c8d0c8;
  font-size: 0.85rem;
}

.legal-footer a {
  color: #2a5a4a;
  font-weight: 600;
}

@media (max-width: 640px) {
  :root {
    --dock-h: 54px;
  }

  .desktop-icons {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
    width: 100%;
    padding: 0.5rem 0.75rem;
    overflow-y: auto;
  }

  .desktop-icon {
    width: 76px;
  }

  .edit-hint {
    max-width: calc(100% - 1.5rem);
    border-radius: 12px;
    line-height: 1.35;
  }

  .dock {
    bottom: 0.4rem;
    border-radius: 18px;
    height: auto;
    min-height: var(--dock-h);
    flex-wrap: wrap;
    padding: 0.4rem;
  }

  .hub-label {
    display: none;
  }

  .dock-btn {
    max-width: 100px;
    font-size: 0.72rem;
  }

  .dock-meta {
    font-size: 0.7rem;
    padding: 0 0.5rem;
  }

  .hub-panel {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
  }

  .window {
    min-width: 0;
    border-radius: 12px;
  }

  .window.is-maximized {
    top: 0.25rem !important;
    left: 0.25rem !important;
    width: calc(100% - 0.5rem) !important;
    height: calc(100% - var(--dock-h) - 1rem) !important;
    border-radius: 12px;
  }

  .explorer-app {
    grid-template-columns: 96px 1fr;
  }

  .store-card {
    grid-template-columns: 44px 1fr;
  }

  .store-actions {
    grid-column: 1 / -1;
  }

  .login-card {
    padding: 1.25rem 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
