* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", "Segoe UI Variable", Tahoma, Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  /* Stops mobile browsers from applying their own font-boosting/shrinking
     heuristics on top of our sizes - those heuristics guess at a "readable"
     size from container width and can land far smaller than intended. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#desktop {
  position: relative;
  /* zoom scales this element and everything inside it by 1.2x, so the
     pre-zoom box is sized at 100% / 1.2 ≈ 83.33% - after zooming it ends up
     filling exactly the real viewport again, just with everything (icons,
     text, windows, taskbar) rendered a bit bigger instead of leaving an
     empty strip of unscaled space at an edge. */
  width: 83.333vw;
  height: 83.333vh;
  zoom: 1.2;
  overflow: hidden;
  background-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.28)),
    url(../assets/wallpaper.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ---------- Desktop icons ---------- */

.desktop-icons {
  position: absolute;
  top: 16px;
  left: 12px;
  bottom: 64px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
}

.desktop-icon {
  width: 88px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  cursor: pointer;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
}

.desktop-icon:active,
.desktop-icon.selected {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
}

.desktop-icon .icon {
  width: 38px;
  height: 38px;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
}

.icon svg { width: 100%; height: 100%; display: block; }

.desktop-icon .label {
  font-size: 12px;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  line-height: 1.25;
  word-break: break-word;
}

#desktop-icons-contact {
  left: auto;
  right: 12px;
  flex-wrap: nowrap;
}

/* ---------- Disclaimer watermark ---------- */
/* Styled after the "Activate Windows" watermark real Windows shows on an
   unlicensed install - except this one explains the project isn't Microsoft's. */

#disclaimer {
  position: absolute;
  left: 14px;
  bottom: 64px;
  max-width: 260px;
  color: rgba(255, 255, 255, 0.65);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
  z-index: 3;
  user-select: none;
}

.disclaimer-title { font-size: 13px; font-weight: 400; }
.disclaimer-body { font-size: 11px; color: rgba(255, 255, 255, 0.5); margin-top: 2px; }

/* ---------- Windows ---------- */

#windows-layer { position: absolute; inset: 0; pointer-events: none; }

.app-window {
  position: absolute;
  min-width: 280px;
  min-height: 200px;
  background: rgba(32, 32, 32, 0.82);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
}

.app-window.maximized {
  top: 0 !important;
  left: 0 !important;
  /* % instead of vw/vh: viewport units ignore an ancestor's zoom, which is
     exactly what made the first attempt at scaling the desktop leave maximized
     windows undersized. % of #windows-layer (which fills #desktop) scales
     correctly with it instead. */
  width: 100% !important;
  height: calc(100% - 48px) !important;
  border-radius: 0;
}

.title-bar {
  height: 32px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 0 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.title-bar .title-icon { width: 16px; height: 16px; margin-right: 8px; flex: 0 0 auto; }
.title-bar .title-icon svg { width: 100%; height: 100%; display: block; }

.title-bar .title-text {
  font-size: 12px;
  color: #e8e8e8;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-bar .win-btn {
  width: 44px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #e8e8e8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-bar .win-btn:hover { background: rgba(255, 255, 255, 0.08); }
.title-bar .win-btn.close:hover { background: #e81123; color: #fff; }

.window-body {
  flex: 1 1 auto;
  overflow: auto;
  color: #f1f1f1;
}

/* The textarea already shows its own native scrollbar when its content
   overflows, so letting the body scroll too just doubles up the scrollbar. */
.window-body:has(.notepad-textarea) { overflow: hidden; }

.app-window.minimized { display: none; }

/* ---------- Calculator ---------- */

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

.calc-display {
  flex: 0 0 auto;
  padding: 18px 14px 8px;
  text-align: right;
  font-size: 32px;
  color: #fff;
  word-break: break-all;
  min-height: 44px;
}

.calc-sub-display {
  text-align: right;
  font-size: 12px;
  color: #a8adb8;
  padding: 0 14px;
  min-height: 16px;
}

.calc-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 1px;
  padding: 6px;
}

.calc-grid button {
  border: none;
  background: rgba(255, 255, 255, 0.07);
  font-size: 16px;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
}

.calc-grid button:hover { background: rgba(255, 255, 255, 0.15); }
.calc-grid button:active { background: rgba(255, 255, 255, 0.22); }

.calc-grid button.op { background: rgba(255, 255, 255, 0.04); }
.calc-grid button.equals { background: #0067c0; color: #fff; }
.calc-grid button.equals:hover { background: #1975c4; }

.calc-grid button.sci {
  font-size: 13px;
  color: #cfd2d8;
  background: rgba(255, 255, 255, 0.03);
}

.calc-grid button.sci:hover { background: rgba(255, 255, 255, 0.1); }

/* ---------- PDF reader ---------- */

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

.pdf-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: #f1f1f1;
}

.pdf-toolbar .pdf-filename { flex: 1 1 auto; font-weight: 600; }

.pdf-toolbar a {
  text-decoration: none;
  color: #6bd3ff;
  font-size: 12px;
}

.pdf-toolbar .pdf-doi {
  flex: 0 0 auto;
  color: rgba(107, 211, 255, 0.75);
  white-space: nowrap;
}

.pdf-frame { flex: 1 1 auto; border: none; width: 100%; height: 100%; background: #525659; }

/* ---------- About Me ---------- */

.aboutme-app { height: 100%; padding: 18px 20px; overflow: auto; color: #f1f1f1; }

.aboutme-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.aboutme-avatar { width: 52px; height: 52px; flex: 0 0 auto; }
.aboutme-avatar svg { width: 100%; height: 100%; display: block; }
.aboutme-name { font-size: 17px; font-weight: 700; }
.aboutme-role { font-size: 12.5px; color: rgba(255, 255, 255, 0.6); margin-top: 2px; }

.aboutme-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 14px;
}

.aboutme-closing {
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.55);
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------- Notepad ---------- */

.notepad-textarea {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: #f1f1f1;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
}

/* ---------- Paint ---------- */

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

.paint-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.paint-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.12);
  flex: 0 0 auto;
}

.paint-colors { display: flex; gap: 7px; flex-wrap: wrap; }

.paint-color {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease;
}

.paint-color:hover { transform: scale(1.1); }

.paint-color.active {
  border-color: #6bd3ff;
  transform: scale(1.18);
  box-shadow: 0 0 0 2px rgba(107, 211, 255, 0.35);
}

.paint-size-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.paint-size-preview {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.4);
  flex: 0 0 auto;
}

.paint-size {
  width: 90px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
}

.paint-size::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #6bd3ff;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.paint-size::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: none;
  border-radius: 50%;
  background: #6bd3ff;
  cursor: pointer;
}

.paint-size::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
}

.paint-clear {
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #f1f1f1;
  font-size: 12px;
  border-radius: 4px;
  padding: 5px 12px;
  cursor: pointer;
}

.paint-clear:hover { background: rgba(255, 255, 255, 0.14); }

.paint-canvas-frame {
  flex: 1 1 auto;
  display: flex;
  padding: 12px;
  background: #14151b;
  overflow: hidden;
}

.paint-canvas {
  flex: 1 1 auto;
  width: 100%;
  cursor: crosshair;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
  touch-action: none;
}

/* ---------- Generic folder view ---------- */

.folder-app { height: 100%; overflow: auto; padding: 14px; }

.folder-search {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #f1f1f1;
  font-size: 13px;
}

.folder-search::placeholder { color: rgba(255, 255, 255, 0.4); }
.folder-search:focus { outline: none; border-color: rgba(96, 165, 250, 0.6); }

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
}

.folder-year-heading {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.folder-year-heading:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.folder-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #f1f1f1;
  cursor: pointer;
  font-size: 12px;
  text-align: center;
}

.folder-item:hover { background: rgba(255, 255, 255, 0.08); }
.folder-item-icon { width: 36px; height: 36px; }
.folder-item-icon svg { width: 100%; height: 100%; display: block; }
.folder-item-label {
  word-break: break-word;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.folder-item-venue {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.55);
  background: rgba(96, 165, 250, 0.22);
  color: #bfdbfe;
  white-space: nowrap;
}

.folder-empty {
  grid-column: 1 / -1;
  padding: 30px 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
}

/* ---------- Pictures ---------- */

.pictures-app { position: relative; height: 100%; overflow: auto; background: #1b1d24; }

.pictures-albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  padding: 14px;
}

.pictures-albums.hidden { display: none; }

.pictures-album, .pictures-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #f1f1f1;
  cursor: pointer;
  font-size: 12px;
  text-align: center;
}

.pictures-album:hover, .pictures-file:hover { background: rgba(255, 255, 255, 0.08); }
.pictures-album-icon { width: 40px; height: 40px; }
.pictures-album-icon svg { width: 100%; height: 100%; display: block; }
.pictures-album-label { word-break: break-word; line-height: 1.25; }

.pictures-album-view.hidden { display: none; }

.pictures-album-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.pictures-album-title { font-size: 13px; font-weight: 600; }

.pictures-album-header .pictures-back {
  position: static;
}

.pictures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 0 14px 14px;
}

.pictures-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pictures-grid .pictures-file {
  width: 100%;
  aspect-ratio: 4 / 3;
  justify-content: center;
  border-radius: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.pictures-grid img:hover { outline: 2px solid #6bd3ff; }

.pictures-viewer {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 14, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pictures-viewer.hidden { display: none; }

.pictures-viewer img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
  border-radius: 4px;
}

.pictures-back {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.pictures-back:hover { background: rgba(255, 255, 255, 0.2); }

.pictures-viewer-back {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.pictures-viewer-back:hover { background: rgba(255, 255, 255, 0.2); }

.pictures-viewer-prev,
.pictures-viewer-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.pictures-viewer-prev:hover,
.pictures-viewer-next:hover { background: rgba(255, 255, 255, 0.22); }

.pictures-viewer-prev { left: 14px; }
.pictures-viewer-next { right: 14px; }

/* ---------- Browser ---------- */

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

.browser-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: #cfd2d8;
}

.browser-bar-dot { width: 8px; height: 8px; border-radius: 50%; background: #3fb950; flex: 0 0 auto; }

.browser-tiles {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
}

.browser-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 110px;
  padding: 18px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #f1f1f1;
  cursor: pointer;
  font-size: 12px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.browser-tile:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-3px);
}

.browser-tile-icon { font-size: 28px; }

.browser-hint {
  flex: 0 0 auto;
  text-align: center;
  font-size: 11px;
  color: #8d9099;
  padding-bottom: 14px;
}

/* ---------- Terminal ---------- */

.terminal-app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0c0c0c;
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
  font-size: 13px;
  color: #e6e6e6;
}

.terminal-output {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-output a { color: #6bd3ff; }

.terminal-output > div { margin-bottom: 2px; }

.terminal-prompt { color: #3fcf6e; }

.terminal-input-line {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 10px;
}

.terminal-input {
  flex: 1 1 auto;
  border: none;
  outline: none;
  background: transparent;
  color: #e6e6e6;
  font-family: inherit;
  font-size: 13px;
}

.terminal-ascii {
  color: #3fcf6e;
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.2;
}

.terminal-neofetch { display: flex; flex-direction: column; }
.terminal-neofetch-info .t-accent { color: #3fcf6e; font-weight: 600; }

.terminal-matrix {
  position: absolute;
  inset: 0;
  z-index: 50;
}

/* ---------- Vapor (game library) ---------- */

.vapor-app { display: flex; height: 100%; }

.vapor-sidebar {
  width: 140px;
  flex: 0 0 auto;
  background: #10151f;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.vapor-brand {
  color: #6bd3ff;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 13px;
  padding: 6px 8px 14px;
}

.vapor-game-item {
  text-align: left;
  background: transparent;
  border: none;
  color: #cfd2d8;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.vapor-game-item:hover { background: rgba(255, 255, 255, 0.08); }
.vapor-game-item.active { background: rgba(107, 211, 255, 0.16); color: #fff; }

.vapor-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  overflow: auto;
  color: #f1f1f1;
  gap: 12px;
}

.vapor-game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 340px;
  font-size: 13px;
}

.vapor-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #f1f1f1;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.vapor-btn:hover { background: rgba(255, 255, 255, 0.14); }
.vapor-hint { font-size: 11px; color: #8d9099; }

.vapor-banner {
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(63, 207, 110, 0.15);
  color: #3fcf6e;
  font-size: 13px;
}

.vapor-banner-bad { background: rgba(232, 80, 91, 0.15); color: #e8505b; }

.snake-canvas, .breakout-canvas {
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  touch-action: none;
}

/* ---- 2048 ---- */

.g2048-grid {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  grid-template-rows: repeat(4, 64px);
  gap: 8px;
  background: #b8ad9d;
  padding: 8px;
  border-radius: 8px;
  touch-action: none;
}

.g2048-cell {
  background: rgba(238, 228, 218, 0.35);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #776e65;
}

.g2048-v2 { background: #eee4da; }
.g2048-v4 { background: #ede0c8; }
.g2048-v8 { background: #f2b179; color: #fff; }
.g2048-v16 { background: #f59563; color: #fff; }
.g2048-v32 { background: #f67c5f; color: #fff; }
.g2048-v64 { background: #f65e3b; color: #fff; }
.g2048-v128 { background: #edcf72; color: #fff; font-size: 20px; }
.g2048-v256 { background: #edcc61; color: #fff; font-size: 20px; }
.g2048-v512 { background: #edc850; color: #fff; font-size: 20px; }
.g2048-v1024 { background: #edc53f; color: #fff; font-size: 18px; }
.g2048-v2048 { background: #edc22e; color: #fff; font-size: 18px; box-shadow: 0 0 12px #edc22e; }
.g2048-vmax { background: #3c3a32; color: #f4ecd8; font-size: 16px; }

/* ---- Minesweeper ---- */

.mines-grid {
  display: grid;
  gap: 2px;
  background: #1b2330;
  padding: 6px;
  border-radius: 6px;
}

.mines-cell {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 3px;
  background: #2b3650;
  color: #f1f1f1;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.mines-cell:hover { background: #344164; }
.mines-cell.revealed { background: #161c28; cursor: default; }
.mines-cell.revealed.mine { background: #5a1e1e; }
.mines-cell.n1 { color: #6bd3ff; }
.mines-cell.n2 { color: #3fcf6e; }
.mines-cell.n3 { color: #e8505b; }
.mines-cell.n4 { color: #8764b8; }

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  gap: 8px;
}

.memory-card {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: #1b2330;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.memory-card::before {
  content: "?";
  color: #4a5568;
  font-size: 22px;
}

.memory-card .memory-card-inner { display: none; }

.memory-card.flipped, .memory-card.matched { background: #243044; }
.memory-card.flipped::before, .memory-card.matched::before { display: none; }
.memory-card.flipped .memory-card-inner, .memory-card.matched .memory-card-inner { display: block; }
.memory-card.matched { opacity: 0.6; }

.ttt-grid {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  grid-template-rows: repeat(3, 72px);
  gap: 6px;
}

.ttt-cell {
  background: #1b2330;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 32px;
  font-weight: 700;
  color: #6bd3ff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ttt-cell:hover { background: #243044; }

/* ---------- Desktop marquee selection ---------- */

#selection-box {
  position: absolute;
  display: none;
  border: 1px solid #4cc2ff;
  background: rgba(76, 194, 255, 0.18);
  border-radius: 2px;
  pointer-events: none;
  z-index: 5;
}

/* ---------- Shutdown overlay ---------- */

#shutdown-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  cursor: pointer;
}

#shutdown-overlay.hidden { display: none; }

.shutdown-canvas {
  width: min(70vmin, 420px);
  height: min(70vmin, 420px);
  border-radius: 50%;
  box-shadow: 0 0 80px rgba(63, 134, 196, 0.35);
}

.shutdown-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  letter-spacing: 0.04em;
}

/* ---------- Crypto widget ---------- */

.crypto-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  font-size: 13px;
}

.crypto-row + .crypto-row { border-top: 1px solid rgba(255, 255, 255, 0.07); }

.crypto-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.crypto-badge-btc { background: linear-gradient(135deg, #f7b84a, #c9750f); }
.crypto-badge-eth { background: linear-gradient(135deg, #94a4ff, #627eea); }

.crypto-name { flex: 1 1 auto; color: #cfd2d8; }
.crypto-price { font-weight: 600; }
.crypto-change {
  font-size: 11px;
  font-weight: 600;
  min-width: 54px;
  text-align: center;
  padding: 3px 6px;
  border-radius: 10px;
}

.crypto-change.positive { color: #3fcf6e; background: rgba(63, 207, 110, 0.16); }
.crypto-change.negative { color: #e8505b; background: rgba(232, 80, 91, 0.16); }

/* ---------- Widgets panel ---------- */

#widgets-panel {
  position: absolute;
  left: 8px;
  bottom: 56px;
  width: 340px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 8500;
}

#widgets-panel.hidden { display: none; }

.widget-card {
  background: rgba(32, 32, 32, 0.88);
  backdrop-filter: blur(40px) saturate(170%);
  -webkit-backdrop-filter: blur(40px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  padding: 18px;
  color: #f1f1f1;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.widget-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.55);
}

.widget-card-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.widget-card-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.widget-card-icon svg { width: 15px; height: 15px; }

.weather-card .widget-card-icon { background: rgba(255, 212, 81, 0.18); color: #ffd451; }
.crypto-card .widget-card-icon { background: rgba(95, 214, 196, 0.18); color: #5fd6c4; }
.calendar-card .widget-card-icon { background: rgba(107, 211, 255, 0.18); color: #6bd3ff; }

.widget-card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.weather-icon { font-size: 38px; line-height: 1; }
.weather-main-text { display: flex; flex-direction: column; }
.weather-temp { font-size: 32px; font-weight: 300; line-height: 1; }
.weather-desc { font-size: 12px; color: #cfd2d8; margin-top: 5px; }
.weather-place { font-size: 11px; color: #8d9099; margin-top: 12px; }

.weather-forecast {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.forecast-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #cfd2d8;
}

.forecast-day-name { text-transform: capitalize; }
.forecast-day-icon { font-size: 16px; }
.forecast-day-temps { color: #f1f1f1; font-weight: 600; }
.forecast-day-min { color: #8d9099; font-weight: 400; margin-left: 3px; }

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.calendar-title { font-size: 13px; font-weight: 600; text-transform: capitalize; }

.calendar-nav {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: #f1f1f1;
  cursor: pointer;
  font-size: 14px;
}

.calendar-nav:hover { background: rgba(255, 255, 255, 0.16); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.calendar-weekday {
  font-size: 11px;
  color: #8d9099;
  text-transform: uppercase;
  padding-bottom: 4px;
}

.calendar-day {
  font-size: 12px;
  padding: 5px 0;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
}

.calendar-day.empty { cursor: default; }
.calendar-day:not(.empty):hover { background: rgba(255, 255, 255, 0.1); }

.calendar-day.today {
  background: #0067c0;
  color: #fff;
  font-weight: 600;
}

.calendar-day.selected {
  outline: 2px solid #6bd3ff;
  outline-offset: -2px;
}

.calendar-dot {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffd451;
}

.calendar-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.calendar-note.hidden { display: none; }
.calendar-note-date { font-size: 12px; font-weight: 600; margin-bottom: 6px; text-transform: capitalize; }

.calendar-note-input {
  width: 100%;
  min-height: 52px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #f1f1f1;
  font-size: 12px;
  font-family: inherit;
  padding: 6px;
  box-sizing: border-box;
}

.calendar-note-input:focus { outline: 1px solid #6bd3ff; }

/* ---------- Start menu ---------- */

#start-menu {
  position: absolute;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 560px;
  max-width: 92vw;
  background: rgba(32, 32, 32, 0.86);
  backdrop-filter: blur(36px) saturate(160%);
  -webkit-backdrop-filter: blur(36px) saturate(160%);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  padding: 22px 26px;
  z-index: 9000;
  color: #f1f1f1;
}

#start-menu.hidden { display: none; }

.start-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 18px;
}

.start-search .icon { width: 16px; height: 16px; flex: 0 0 auto; color: #c7c9cf; }
.start-search input {
  border: none;
  outline: none;
  flex: 1 1 auto;
  font-size: 13px;
  background: transparent;
  color: #f1f1f1;
}

.start-section-title { font-size: 13px; font-weight: 600; color: #f1f1f1; margin-bottom: 10px; }

.start-pinned {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.start-app {
  background: transparent;
  border: none;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  cursor: pointer;
  font-size: 12px;
  color: #f1f1f1;
}

.start-app:hover { background: rgba(255, 255, 255, 0.08); }
.start-app .icon { width: 28px; height: 28px; }

.start-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.start-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #f1f1f1; }
.start-user .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #0067c0; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}

.power-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.07);
  color: #f1f1f1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.power-btn svg { width: 16px; height: 16px; }
.power-btn:hover { background: rgba(255, 255, 255, 0.15); }

/* ---------- Taskbar ---------- */

#taskbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 48px;
  background: rgba(28, 28, 28, 0.72);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9500;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#taskbar-center {
  display: flex;
  align-items: center;
  height: 100%;
}

#start-button {
  width: 44px;
  height: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f1f1f1;
}

#start-button svg { width: 22px; height: 22px; }
#start-button:hover { background: rgba(255, 255, 255, 0.08); }

.search-pill, .widgets-pill {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #cfd2d8;
  font-size: 12px;
  padding: 0 14px;
  margin: 0 6px;
  cursor: pointer;
}

.search-pill:hover, .widgets-pill:hover { background: rgba(255, 255, 255, 0.16); }
.search-pill .icon, .widgets-pill .icon { width: 15px; height: 15px; color: #cfd2d8; }

.widgets-pill { border: 1px solid rgba(255, 255, 255, 0.12); }
.widgets-temp { font-size: 12px; font-weight: 600; color: #f1f1f1; min-width: 16px; }

#taskbar-pinned, #taskbar-running {
  display: flex;
  align-items: center;
  height: 100%;
}

.taskbar-icon {
  width: 44px;
  height: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.taskbar-icon svg { width: 22px; height: 22px; }
.taskbar-icon:hover { background: rgba(255, 255, 255, 0.08); }

.taskbar-icon.active::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: #6bd3ff;
}

#systray {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 2px;
}

#language-toggle {
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #f1f1f1;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 0 8px;
  margin-right: 4px;
  cursor: pointer;
}

#language-toggle:hover { background: rgba(255, 255, 255, 0.14); }

#tray-chevron {
  width: 24px;
  height: 100%;
  border: none;
  background: transparent;
  color: #cfd2d8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#tray-chevron svg { width: 13px; height: 13px; }

.tray-icon-group {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 8px;
  gap: 9px;
  color: #f1f1f1;
}

.tray-icon { width: 16px; height: 16px; display: flex; }
.tray-icon svg { width: 100%; height: 100%; display: block; }

.tray-icon-group:hover,
#tray-chevron:hover {
  background: rgba(255, 255, 255, 0.08);
}

#clock {
  font-size: 11px;
  line-height: 1.3;
  text-align: right;
  white-space: pre;
  color: #f1f1f1;
  padding: 0 10px;
  height: 100%;
  display: flex;
  align-items: center;
}

#clock:hover { background: rgba(255, 255, 255, 0.08); }

#show-desktop {
  position: absolute;
  right: 0;
  top: 0;
  width: 6px;
  height: 100%;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  cursor: pointer;
}

#show-desktop:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- Mobile home screen ---------- */
/* On square-or-taller screens the desktop metaphor (draggable windows, a
   taskbar, a start menu) is replaced wholesale by a terminal-style shell: a
   short boot sequence, then a flat, filterable command list standing in for
   a home screen/app drawer. Apps still open through the same WindowManager
   every desktop app already uses - they just render as fullscreen
   "activities" instead of floating windows. */

#mobile-home { display: none; }
.widgets-mobile-back { display: none; }

/* Switches to the Android-style mobile layout based on aspect ratio, not raw
   width - a narrow-but-wide desktop window stays desktop, while anything
   square or taller-than-wide (a phone, in practice) gets the mobile shell. */
@media (max-aspect-ratio: 1/1) {
  /* Material (Android) color + elevation tokens. Scoped to mobile only -
     the desktop UI keeps its own Windows/Fluent look untouched. */
  :root {
    --md-surface: #141218;
    --md-surface-container: #1d1b20;
    --md-surface-container-high: #28262c;
    --md-on-surface: #e6e0e9;
    --md-on-surface-variant: #cac4cf;
    --md-primary: #a9c7ff;
    --md-on-primary-container: #d4e3ff;
    --md-primary-container: rgba(169, 199, 255, 0.16);
    --md-outline: rgba(230, 224, 233, 0.16);
    --md-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  }

  .app-window,
  .widgets-mobile-back {
    font-family: Roboto, "Google Sans", "Segoe UI", Tahoma, Arial, sans-serif;
  }

  .desktop-icons,
  #disclaimer,
  #taskbar,
  #start-menu,
  #selection-box {
    display: none !important;
  }

  html, body {
    /* Anchors the shell to the real viewport - without this, scrolling the
       page (rather than just the inner output list) could slide the fixed
       mobile shell up and reveal the desktop wallpaper sitting behind it. */
    overflow: hidden;
  }

  #mobile-home {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: #0b0d10;
    color: #d8ffe2;
    font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
  }

  #mobile-term-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(63, 207, 110, 0.25);
    background: #0f1318;
  }

  .mobile-term-host { font-size: clamp(13px, 3.4vw, 15px); color: #3fcf6e; font-weight: 600; }
  #mobile-clock { font-size: clamp(12px, 3.1vw, 14px); color: rgba(216, 255, 226, 0.6); margin-right: auto; }
  .mobile-term-actions { display: flex; align-items: center; gap: 8px; }

  .mobile-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(63, 207, 110, 0.35);
    background: rgba(63, 207, 110, 0.1);
    color: #d8ffe2;
    font-size: clamp(12px, 3.2vw, 14px);
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .mobile-icon-btn svg { width: 19px; height: 19px; }
  .mobile-icon-btn:active { background: rgba(63, 207, 110, 0.25); }

  #mobile-term-screen {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #mobile-term-output {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 16px;
  }

  .mobile-term-typed {
    font-size: clamp(13px, 3.8vw, 16px);
    line-height: 1.55;
    color: #d8ffe2;
  }

  .mobile-term-typed::after {
    content: '▋';
    color: #3fcf6e;
    margin-left: 2px;
    animation: mobile-term-blink 1s step-start infinite;
  }

  @keyframes mobile-term-blink {
    50% { opacity: 0; }
  }

  .mobile-term-echo {
    color: #d8ffe2;
    font-weight: 600;
    font-size: clamp(13px, 3.6vw, 15px);
    margin-top: 14px;
  }

  .mobile-term-echo::before { content: '$ '; color: #3fcf6e; }

  .mobile-term-output-block {
    font-size: clamp(13px, 3.6vw, 15px);
    line-height: 1.55;
    color: #d8ffe2;
    margin: 6px 0 10px;
    white-space: pre-wrap;
  }

  .mobile-term-output-block a {
    color: #6bd3ff;
    text-decoration: underline;
  }

  .mobile-term-year-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(12px, 3.3vw, 14px);
    font-weight: 600;
    color: #3fcf6e;
    margin: 16px 0 6px;
  }

  .mobile-term-year-heading:first-child { margin-top: 15px; }

  .mobile-term-year-heading::before { content: '# '; opacity: 0.75; }

  .mobile-term-year-heading::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: rgba(63, 207, 110, 0.25);
  }

  .mobile-term-output-block a.mobile-term-card {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(63, 207, 110, 0.3);
    border-radius: 10px;
    padding: 3px 12px;
    margin-bottom: -1px;
    color: #d8ffe2;
    text-decoration: none;
  }

  .mobile-term-card:active { background: rgba(63, 207, 110, 0.14); }
  .mobile-term-card-emoji { font-size: clamp(20px, 5.8vw, 24px); flex-shrink: 0; }
  .mobile-term-card-body { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
  .mobile-term-card-title { font-size: clamp(13px, 3.6vw, 15px); font-weight: 600; }
  .mobile-term-card-meta { font-size: clamp(11px, 3vw, 13px); color: #6bd3ff; }
  .mobile-term-card-open {
    flex-shrink: 0;
    font-size: clamp(13px, 3.6vw, 15px);
    font-weight: 600;
    color: #3fcf6e;
    white-space: nowrap;
  }

  /* Fixed command bar: three big, always-reachable tap targets - the only
     navigation on mobile, so there's no on-screen keyboard fighting for
     space on a small screen. */
  #mobile-term-commands {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    flex-shrink: 0;
    background: #0f1318;
    border-top: 1px solid rgba(63, 207, 110, 0.3);
  }

  .mobile-term-cmd-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    padding: 0 4px;
    border: none;
    border-right: 1px solid rgba(63, 207, 110, 0.15);
    background: #0f1318;
    color: #d8ffe2;
    font-family: inherit;
    cursor: pointer;
  }

  .mobile-term-cmd-btn:last-child { border-right: none; }

  .mobile-term-cmd-btn:active,
  .mobile-term-cmd-btn.active { background: rgba(63, 207, 110, 0.18); }

  .mobile-term-cmd-btn .mobile-term-cmd-label {
    font-size: clamp(12px, 3.4vw, 14px);
    font-weight: 600;
    text-align: left;
  }

  .mobile-term-cmd-btn .mobile-term-cmd-label::before {
    content: '$ ';
    color: #3fcf6e;
    font-weight: 700;
  }

  /* App windows become fullscreen "activities": no dragging, no minimize/
     maximize (everything already opens maximized, see windowManager.js).
     They get a solid Material surface + a proper top app bar instead of the
     desktop's frosted-glass window chrome. The close button moves to the
     front and becomes a back arrow, so every fullscreen page on mobile
     (apps, widgets, the app drawer) shares the same "back arrow top-left"
     navigation pattern. */
  .app-window {
    border-radius: 0 !important;
    background: var(--md-surface) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
  }

  .window-body { color: var(--md-on-surface); }

  .title-bar {
    height: 56px;
    background: var(--md-surface-container);
    box-shadow: var(--md-elevation-2);
    border-bottom: none;
  }

  .title-bar .win-btn {
    position: relative;
    overflow: hidden;
    width: 52px;
    height: 56px;
    font-size: 17px;
    color: var(--md-on-surface);
  }

  .title-bar .win-btn.minimize,
  .title-bar .win-btn.maximize { display: none; }

  .title-bar .win-btn.close {
    order: -1;
    font-size: 0;
    margin-right: 4px;
  }

  .title-bar .win-btn.close::before {
    content: '\2190';
    font-size: 19px;
  }

  .title-bar .win-btn:active { background: var(--md-primary-container); }
  .title-bar .title-icon { width: 20px; height: 20px; }
  .title-bar .title-text { font-size: 15px; font-weight: 500; color: var(--md-on-surface); }

  /* The widgets panel becomes a fullscreen page reachable from the weather
     peek above, with its own back button instead of click-outside-to-close.
     Its cards switch from the desktop's frosted glass to solid Material
     surfaces with proper elevation. */
  #widgets-panel {
    position: absolute;
    inset: 0;
    width: auto;
    max-width: none;
    border-radius: 0;
    padding: 16px 14px;
    overflow-y: auto;
    z-index: 9000;
    background: var(--md-surface);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 180ms ease;
  }

  #widgets-panel.hidden {
    display: flex;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
  }

  .widget-card {
    background: var(--md-surface-container) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: var(--md-elevation-1) !important;
    border-radius: 16px !important;
    color: var(--md-on-surface) !important;
  }

  .widget-card-title { color: var(--md-on-surface); font-size: 14px; }
  .weather-desc, .weather-place, .forecast-day { color: var(--md-on-surface-variant); font-size: 13px; }
  .weather-temp { font-size: 36px; }
  .crypto-name, .crypto-price, .crypto-change { font-size: 14px; }
  .calendar-day, .calendar-weekday, .calendar-title { font-size: 13px; }
  .calendar-nav { position: relative; overflow: hidden; background: var(--md-surface-container-high); color: var(--md-on-surface); font-size: 16px; }
  .calendar-day.today { background: var(--md-primary-container); color: var(--md-on-primary-container); }
  .calendar-note-input, .calendar-note-date { font-size: 13px; }

  .widgets-mobile-back {
    position: relative;
    overflow: hidden;
    display: flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
    font-size: 17px;
    margin-bottom: 12px;
    cursor: pointer;
  }

  .widgets-mobile-back:active { background: var(--md-primary-container); }


  /* Vapor: the sidebar+stage side-by-side layout was sized for a 560px
     desktop window. On a phone the sidebar becomes a horizontal scrollable
     tab strip across the top, and game boards shrink to fit the width. */
  .vapor-app { flex-direction: column; }

  .vapor-sidebar {
    width: auto;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding: 8px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .vapor-brand { display: none; }
  .vapor-game-item { flex: 0 0 auto; white-space: nowrap; }

  .snake-canvas, .breakout-canvas {
    max-width: 100%;
    height: auto;
  }

  .g2048-grid {
    width: min(296px, 100%);
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    aspect-ratio: 1;
  }

  .g2048-cell { font-size: 18px; }

  /* The calculator's buttons stretch to fill a whole phone screen once
     maximized, so the text inside needs to scale up with them too. */
  .calc-display { font-size: 40px; }
  .calc-sub-display { font-size: 14px; }
  .calc-grid button { font-size: 20px; }
  .calc-grid button.sci { font-size: 15px; }
}
