/* PC desktop (desktop mode): app/pcdesktop.js.
   Design v3 palette: theme surfaces and text, the accent for selection and
   the active app, thin lines. Glass only on the pop-ups (Start, flyouts,
   menus), with solid fallbacks for Lite and Solid surfaces. Motion lives in
   css/motion.css ("PC desktop"). */

body {
  --pc-bar: 48px;
  --pc-line: color-mix(in srgb, var(--on-surface, #fff) 12%, transparent);
  --pc-line-strong: color-mix(in srgb, var(--on-surface, #fff) 20%, transparent);
  --pc-hover: color-mix(in srgb, var(--on-surface, #fff) 9%, transparent);
  --pc-soft: color-mix(in srgb, var(--on-surface, #fff) 6%, transparent);
  --pc-muted: color-mix(in srgb, var(--on-surface, #fff) 66%, transparent);
  --pc-bar-bg: color-mix(in srgb, var(--surface-color, #191d25) 95%, transparent);
  --pc-pop-bg: color-mix(in srgb, var(--surface-color, #191d25) 90%, transparent);
}
@media (max-height: 540px) {
  body { --pc-bar: 40px; }
}
body.access-targets { --pc-bar: 56px; }

/* ---------- The screen: no phone status bar, the taskbar is the bottom row ---------- */

body.desktop-mode {
  --desktop-bar-space: var(--pc-bar);
}
body.desktop-mode #status-bar {
  display: none !important;
}
body.desktop-mode .os-container {
  padding-top: 0 !important;
}
body.desktop-mode .os-root {
  height: calc(100dvh - var(--pc-bar)) !important;
}
body.desktop-mode #home-screen.hs {
  top: 0;
  bottom: calc(-1 * var(--pc-bar));
}
/* The phone home (pages, widgets, dock) stays saved but isn't shown: the
   desktop draws on the same wallpaper. */
body.desktop-mode #home-screen.hs > * {
  display: none !important;
}
/* A landscape phone with the keyboard up: every pixel goes to the app. */
@media (max-height: 320px) {
  body.desktop-mode { --pc-bar: 0px; }
  body.desktop-mode #desktop-taskbar { display: none !important; }
}

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

#pc-desktop {
  position: absolute;
  inset: 0;
  z-index: 191;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-main);
  --pc-ic: 44px;
  --pc-ink: #fff;
  --pc-ink-shadow: 0 1px 2px rgb(0 0 0 / 0.75), 0 0 6px rgb(0 0 0 / 0.35);
}
#pc-desktop[hidden],
body:not(.desktop-mode) #pc-desktop,
.pc-icons[hidden] {
  display: none;
}
#pc-desktop[data-size="s"] { --pc-ic: 32px; }
#pc-desktop[data-size="l"] { --pc-ic: 56px; }
@media (max-height: 540px) {
  #pc-desktop { --pc-ic: 36px; }
  #pc-desktop[data-size="s"] { --pc-ic: 28px; }
  #pc-desktop[data-size="l"] { --pc-ic: 46px; }
}
/* Light themes on the light default wallpaper get dark names. */
#home-screen.hs--light ~ #pc-desktop {
  --pc-ink: #1b1f27;
  --pc-ink-shadow: 0 0 4px rgb(255 255 255 / 0.6);
}
.pc-icons {
  position: absolute;
  inset: 0;
}
.pc-icon {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 3px 4px;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--pc-ink);
  font: 500 12px/1.25 var(--font-main);
  text-align: center;
  cursor: default;
  outline: none;
  touch-action: none;
}
@media (max-height: 540px) {
  .pc-icon { font-size: 11px; gap: 3px; padding-top: 4px; }
}
.pc-icon .hs-icon,
#desktop-taskbar .hs-icon,
.pc-start .hs-icon,
.pc-menu .hs-icon,
.desktop-app-icon .hs-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--tile, #3b82f6);
  color: #fff;
  box-shadow: none;
}
.pc-icon .hs-icon {
  width: var(--pc-ic);
  height: var(--pc-ic);
  border-radius: calc(var(--pc-ic) * 0.26);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.28);
}
:is(.pc-icon, #desktop-taskbar, .pc-start, .pc-menu, .desktop-app-icon) .hs-icon.has-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pc-icon-label {
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  text-shadow: var(--pc-ink-shadow);
}
@media (hover: hover) {
  .pc-icon:hover {
    background: rgb(255 255 255 / 0.12);
    border-color: rgb(255 255 255 / 0.16);
  }
}
.pc-icon.is-selected {
  background: color-mix(in srgb, var(--accent-primary, #6aa4f5) 30%, transparent);
  border-color: color-mix(in srgb, var(--accent-primary, #6aa4f5) 65%, transparent);
}
.pc-icon.is-selected .pc-icon-label {
  -webkit-line-clamp: 4;
}
html.kbd-nav .pc-icon:focus-visible {
  outline: 1px dashed var(--pc-ink);
  outline-offset: -3px;
}
.pc-icon.is-dragging {
  z-index: 3;
  opacity: 0.82;
  pointer-events: none;
}
#pc-desktop.is-dragging .pc-icon:not(.is-dragging) {
  pointer-events: none;
}
.pc-drop {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px dashed rgb(255 255 255 / 0.6);
  border-radius: 6px;
  background: rgb(255 255 255 / 0.08);
  pointer-events: none;
}
.pc-marquee {
  position: absolute;
  z-index: 4;
  border: 1px solid var(--accent-primary, #6aa4f5);
  background: color-mix(in srgb, var(--accent-primary, #6aa4f5) 20%, transparent);
  pointer-events: none;
}
.pc-marquee[hidden] {
  display: none;
}

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

#desktop-taskbar {
  display: none;
}
body.desktop-mode #desktop-taskbar:not([hidden]) {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 610;
  height: var(--pc-bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 0 0 4px;
  box-sizing: border-box;
  background: var(--pc-bar-bg);
  border-top: 1px solid var(--pc-line);
  color: var(--on-surface);
  font-family: var(--font-main);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.pcb-main {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  height: 100%;
}
#desktop-taskbar[data-align="center"] .pcb-main {
  justify-content: center;
  padding-left: 150px;
}
@media (max-width: 900px) {
  #desktop-taskbar[data-align="center"] .pcb-main { padding-left: 0; }
}
#desktop-taskbar button {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--pc-bar) - 8px);
  min-width: calc(var(--pc-bar) - 6px);
  min-height: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: 500 12px var(--font-main);
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  #desktop-taskbar button:hover {
    background: var(--pc-hover);
  }
}
html.kbd-nav #desktop-taskbar button:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: -2px;
}
#desktop-taskbar button > svg,
#desktop-taskbar button > .hs-icon {
  flex-shrink: 0;
}
.pcb-start {
  color: var(--accent-primary, #6aa4f5) !important;
}
.pcb-start.is-open {
  background: var(--pc-hover) !important;
}
.pcb-search {
  gap: 8px;
  justify-content: flex-start !important;
  width: 210px;
  margin: 0 4px;
  padding: 0 14px !important;
  height: calc(var(--pc-bar) - 14px) !important;
  border: 1px solid var(--pc-line) !important;
  border-radius: 999px !important;
  background: var(--pc-soft) !important;
  color: var(--pc-muted) !important;
  font-weight: 400 !important;
}
@media (hover: hover) {
  .pcb-search:hover { background: var(--pc-hover) !important; }
}
@media (max-width: 960px) {
  .pcb-search {
    width: auto;
    margin: 0;
    padding: 0 8px !important;
    height: calc(var(--pc-bar) - 8px) !important;
    border-color: transparent !important;
    border-radius: 6px !important;
    background: transparent !important;
    color: inherit !important;
  }
  .pcb-search span { display: none; }
}
.pcb-apps {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.pcb-apps::-webkit-scrollbar {
  display: none;
}
#desktop-taskbar .pcb-app .hs-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}
@media (max-height: 540px) {
  #desktop-taskbar .pcb-app .hs-icon { width: 22px; height: 22px; border-radius: 6px; }
}
.pcb-ind {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 0;
  height: 3px;
  border-radius: 3px;
  translate: -50% 0;
  background: color-mix(in srgb, var(--on-surface) 55%, transparent);
  pointer-events: none;
}
.pcb-app.is-running .pcb-ind {
  width: 6px;
}
.pcb-app.is-active {
  background: var(--pc-hover) !important;
}
.pcb-app.is-active .pcb-ind {
  width: 16px;
  background: var(--accent-primary, #6aa4f5);
}
.pcb-tray {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
  flex-shrink: 0;
}
.pcb-sys {
  gap: 8px;
  padding: 0 10px !important;
}
.pcb-clock {
  flex-direction: column;
  align-items: flex-end !important;
  justify-content: center;
  gap: 1px;
  padding: 0 8px !important;
  font-size: 12px !important;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.pcb-date {
  font-weight: 400;
  font-size: 11px;
  color: var(--pc-muted);
}
@media (max-width: 720px) {
  .pcb-date { display: none; }
}
.pcb-bell b {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  box-sizing: border-box;
  border-radius: 8px;
  background: var(--accent-primary, #6aa4f5);
  color: var(--background, #111);
  font: 700 9px/15px var(--font-main);
  text-align: center;
}
.pcb-bell b[hidden] {
  display: none;
}
#desktop-taskbar .pcb-peek {
  width: 9px;
  min-width: 9px;
  height: 100%;
  margin-left: 4px;
  padding: 0;
  border-left: 1px solid var(--pc-line-strong);
  border-radius: 0;
}

/* Upright phone: Start already has search and Task view lives in its menu,
   so the bar keeps its room for pinned and running apps. */
@media (max-width: 599px) {
  #desktop-taskbar .pcb-search,
  #desktop-taskbar [data-desktop="recents"] { display: none; }
  #desktop-taskbar button { min-width: 36px; padding: 0 6px; }
  .pcb-sys { gap: 5px; padding: 0 6px !important; }
  .pcb-clock { padding: 0 4px !important; }
  #desktop-taskbar .pcb-peek { margin-left: 2px; }
}

/* ---------- Pop-ups: Start, flyouts, menus ---------- */

.pc-pop {
  color: var(--on-surface);
  font-family: var(--font-main);
  background: var(--pc-pop-bg);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid var(--pc-line-strong);
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
html.lite .pc-pop,
html.surface-solid .pc-pop,
body.access-transparency .pc-pop {
  background: var(--surface-color, #191d25);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.pc-pop button {
  font-family: var(--font-main);
  -webkit-tap-highlight-color: transparent;
}
html.kbd-nav .pc-pop button:focus-visible,
html.kbd-nav .pc-pop input:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: -2px;
}
.pc-start,
.pc-fly {
  position: fixed;
  z-index: 620;
  bottom: calc(var(--pc-bar) + 8px);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgb(0 0 0 / 0.42);
}

/* Start */
.pc-start {
  left: 8px;
  width: min(600px, calc(100vw - 16px));
  height: min(660px, calc(100dvh - var(--pc-bar) - 16px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: 30px 100%;
}
#desktop-taskbar[data-align="center"] ~ .pc-start {
  left: calc(50% + 75px - min(600px, calc(100vw - 16px)) / 2);
  transform-origin: 50% 100%;
}
@media (max-width: 900px) {
  #desktop-taskbar[data-align="center"] ~ .pc-start { left: calc(50% - min(600px, calc(100vw - 16px)) / 2); }
}
.pcs-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  height: 40px;
  margin: 18px 22px 6px;
  padding: 0 16px;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid var(--pc-line);
  border-bottom: 2px solid var(--accent-primary, #6aa4f5);
  background: var(--pc-soft);
  color: var(--pc-muted);
}
.pcs-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--on-surface);
  font: 14px var(--font-main);
}
.pcs-search input::-webkit-search-cancel-button {
  filter: grayscale(1);
}
.pcs-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 22px 14px;
  scrollbar-width: thin;
}
.pcs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 6px 8px;
  font-size: 13px;
}
.pcs-head b {
  font-weight: 600;
}
.pcs-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--pc-line);
  border-radius: 6px;
  background: var(--pc-soft);
  color: inherit;
  font: 500 12px var(--font-main);
  cursor: pointer;
}
.pcs-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}
.pcs-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 12px 4px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: 12px/1.2 var(--font-main);
  cursor: pointer;
}
.pcs-app > span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pcs-app .hs-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}
.pcs-rec {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
.pcs-rows,
.pcs-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pcs-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: 13px var(--font-main);
  text-align: left;
  cursor: pointer;
}
.pcs-row .hs-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}
.pcs-row > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pcs-row small,
.pcs-best small {
  font-size: 11px;
  color: var(--pc-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (hover: hover) {
  .pcs-app:hover,
  .pcs-row:hover,
  .pcs-best-card:hover,
  .pcs-user:hover,
  .pcs-icon-btn:hover,
  .pcs-pill:hover {
    background: var(--pc-hover);
  }
}
.pcs-letter {
  margin: 10px 10px 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-primary, #6aa4f5);
}
.pcs-label {
  margin: 14px 6px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pc-muted);
}
.pcs-best-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--pc-line);
  border-radius: 10px;
  background: var(--pc-soft);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.pcs-best-card .hs-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
}
.pcs-best-card > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  font-size: 15px;
}
.pcs-best-go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent-primary, #6aa4f5);
}
.pcs-none,
.pcs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 12px;
  color: var(--pc-muted);
  font-size: 13px;
  text-align: center;
  grid-column: 1 / -1;
}
.pcs-none b {
  color: var(--on-surface);
}
.pcs-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 8px 22px;
  border-top: 1px solid var(--pc-line);
  background: color-mix(in srgb, var(--on-surface, #fff) 4%, transparent);
}
.pcs-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: 500 13px var(--font-main);
  cursor: pointer;
}
.pcs-user > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pcs-foot-acts {
  display: flex;
  gap: 2px;
}
.pcs-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
@media (max-height: 540px) {
  .pcs-search { height: 34px; margin: 10px 14px 2px; }
  .pcs-body { padding: 0 14px 8px; }
  .pcs-head { margin: 8px 4px 4px; }
  .pcs-app { padding: 7px 2px 6px; gap: 5px; font-size: 11px; }
  .pcs-app .hs-icon { width: 32px; height: 32px; border-radius: 9px; }
  .pcs-row { padding: 5px 8px; }
  .pcs-row .hs-icon { width: 26px; height: 26px; border-radius: 7px; }
  .pcs-foot { padding: 3px 14px; }
  .pcs-icon-btn { width: 32px; height: 32px; }
  .pcs-user { padding: 4px 8px; }
}
@media (max-width: 520px) {
  .pcs-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pcs-rec { grid-template-columns: 1fr; }
}

/* Quick settings and Calendar flyouts */
.pc-fly {
  right: 8px;
  width: min(360px, calc(100vw - 16px));
  max-height: calc(100dvh - var(--pc-bar) - 16px);
  overflow-y: auto;
  transform-origin: calc(100% - 60px) 100%;
  scrollbar-width: thin;
}
#pc-quick,
.pc-fly.pcq {
  padding: 14px 14px 0;
}
.pcq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.pcq-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--pc-line);
  border-radius: 8px;
  background: var(--pc-soft);
  color: inherit;
  font: 500 12px/1.2 var(--font-main);
  text-align: left;
  cursor: pointer;
}
.pcq-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (hover: hover) {
  .pcq-tile:hover { background: var(--pc-hover); }
}
.pcq-tile.is-on {
  border-color: transparent;
  background: var(--accent-primary, #6aa4f5);
  color: var(--background, #111);
}
.pcq-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 0 4px;
}
.pcq-slider > span {
  display: flex;
  color: var(--pc-muted);
}
.pcq-slider input {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent-primary, #6aa4f5);
}
.pcq-slider output {
  width: 28px;
  font-size: 12px;
  text-align: right;
  color: var(--pc-muted);
  font-variant-numeric: tabular-nums;
}
.pcq-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 14px -14px 0;
  padding: 4px 6px 4px 14px;
  border-top: 1px solid var(--pc-line);
  background: color-mix(in srgb, var(--on-surface, #fff) 4%, transparent);
  font-size: 12px;
}
.pcq-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--pc-muted);
  min-width: 0;
  white-space: nowrap;
}
.pcq-foot > span:last-child {
  display: flex;
}
@media (max-height: 540px) {
  #pc-quick { padding-top: 10px; }
  .pcq-tile { min-height: 50px; padding: 7px 9px; gap: 4px; }
  .pcq-slider { margin-top: 8px; }
  .pcq-foot { margin-top: 8px; }
}

#pc-cal,
.pc-fly.pcc {
  display: flex;
  flex-direction: column;
}
.pcc-notifs {
  padding: 12px 14px;
  border-bottom: 1px solid var(--pc-line);
}
.pcc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 26px;
  margin-bottom: 8px;
  font-size: 13px;
}
.pcc-head b {
  font-weight: 600;
}
.pcc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.pcc-note {
  display: flex;
  align-items: flex-start;
  border: 1px solid var(--pc-line);
  border-radius: 8px;
  background: var(--pc-soft);
}
.pcc-note-main {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: 12px var(--font-main);
  text-align: left;
  cursor: pointer;
}
.pcc-note-main > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.pcc-note small {
  font-size: 11px;
  color: var(--pc-muted);
}
.pcc-note b {
  font-size: 13px;
  font-weight: 600;
}
.pcc-note em {
  font-style: normal;
  color: var(--pc-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.pcc-note .nt-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #fff;
}
.pcc-x {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin: 6px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--pc-muted);
  cursor: pointer;
}
@media (hover: hover) {
  .pcc-note:hover { background: var(--pc-hover); }
  .pcc-x:hover { background: var(--pc-hover); color: var(--on-surface); }
}
.pcc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  color: var(--pc-muted);
  font-size: 12px;
}
.pcc-cal {
  padding: 12px 14px 14px;
}
.pcc-month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 0 6px;
  font-size: 13px;
  font-weight: 600;
}
.pcc-month > span:last-child {
  display: flex;
}
.pcc-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  text-align: center;
}
.pcc-wk {
  padding: 4px 0;
  font-size: 11px;
  color: var(--pc-muted);
}
.pcc-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0 auto;
  border-radius: 50%;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.pcc-day.is-out {
  opacity: 0.35;
}
.pcc-day.is-today {
  background: var(--accent-primary, #6aa4f5);
  color: var(--background, #111);
  font-weight: 700;
}
/* Landscape phones: notifications beside the calendar so both fit. */
@media (max-height: 540px) {
  .pcc-day { width: 24px; height: 24px; font-size: 11px; }
  .pcc-wk { padding: 2px 0; }
  .pcc-cal { padding: 8px 12px 10px; }
  .pcc-notifs { padding: 8px 12px; }
}
@media (max-height: 540px) and (min-width: 640px) {
  #pc-cal {
    flex-direction: row;
    width: min(620px, calc(100vw - 16px));
  }
  #pc-cal > * { flex: 1; min-width: 0; }
  #pc-cal .pcc-notifs { border-bottom: 0; border-right: 1px solid var(--pc-line); }
  #pc-cal .pcc-list { max-height: calc(100dvh - var(--pc-bar) - 80px); }
}

/* Right-click menus */
.pc-menu {
  position: fixed;
  z-index: 650;
  min-width: 210px;
  max-width: 290px;
  max-height: calc(100dvh - 12px);
  overflow-y: auto;
  padding: 4px;
  border-radius: 8px;
  box-shadow: 0 10px 32px rgb(0 0 0 / 0.38);
  font-size: 13px;
  scrollbar-width: thin;
}
.pc-sub {
  max-height: min(60vh, calc(100dvh - var(--pc-bar) - 12px));
}
.pc-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 32px;
  min-height: 0;
  padding: 0 10px 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: 13px var(--font-main);
  text-align: left;
  cursor: default;
  outline: none;
}
@media (pointer: coarse) {
  .pc-menu-item { height: 40px; }
}
.pc-menu-item:hover,
.pc-menu-item:focus-visible {
  background: var(--pc-hover);
}
.pc-menu-item:disabled {
  opacity: 0.45;
}
.pc-menu-ico,
.pc-menu-check {
  display: flex;
  justify-content: center;
  width: 18px;
  flex-shrink: 0;
  color: var(--pc-muted);
}
.pc-menu-check {
  color: var(--accent-primary, #6aa4f5);
}
.pc-menu-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pc-menu kbd {
  font: 11px var(--font-main);
  color: var(--pc-muted);
}
.pc-menu-more {
  display: flex;
  color: var(--pc-muted);
}
.pc-menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--pc-line);
}
.pc-menu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 3px;
  font-size: 12px;
}
.pc-menu-head .hs-icon {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

/* ---------- Windows: app icon in the title bar, PC shadows ---------- */

.desktop-app-icon {
  display: none;
}
body.desktop-mode .desktop-window > .desktop-titlebar .desktop-app-icon {
  display: flex;
  padding-left: 12px;
  flex-shrink: 0;
}
.desktop-app-icon .hs-icon {
  width: 18px;
  height: 18px;
  border-radius: 5px;
}
body.desktop-mode .desktop-window > .desktop-titlebar .desktop-caption {
  padding: 0 10px;
}
body.desktop-mode .os-root > .desktop-window {
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.28);
}
body.desktop-mode .os-root > .desktop-window.desktop-active {
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.42);
  border-color: color-mix(in srgb, var(--on-surface) 20%, transparent);
}
body.desktop-mode .os-root > .desktop-window.desktop-expanded {
  border-radius: 0 !important;
}

/* ---------- Full screen (games while playing, F11) ---------- */

body.desktop-mode.pc-fullscreen {
  --pc-bar: 0px;
}
body.desktop-mode.pc-fullscreen #desktop-taskbar {
  display: none !important;
}
body.desktop-mode .desktop-window.desktop-fullscreen > :is(.desktop-titlebar, .desktop-resize) {
  display: none !important;
}
body.desktop-mode .os-root > .desktop-window.desktop-fullscreen {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.desktop-fs-exit {
  display: none;
}
body.desktop-mode .desktop-window.desktop-fullscreen > .desktop-fs-exit {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  min-height: 0 !important;
  padding: 0 14px;
  border: 1px solid var(--pc-line-strong);
  border-radius: 999px;
  background: var(--pc-pop-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: var(--on-surface);
  font: 500 12px var(--font-main);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
  cursor: pointer;
  translate: -50% calc(-100% - 12px);
  opacity: 0;
  pointer-events: none;
}
body.desktop-mode .desktop-window.desktop-fullscreen.fs-reveal > .desktop-fs-exit {
  translate: -50% 0;
  opacity: 1;
  pointer-events: auto;
}
html.lite .desktop-fs-exit {
  background: var(--surface-color) !important;
}
/* Games scale up to fill their window (app/pcdesktop.js fitGames): no
   phone-sized board floating in empty space. */
body.desktop-mode .desktop-window .games-body.pc-fit-body {
  display: flex !important;
  flex-direction: column;
}
body.desktop-mode .desktop-window .games-stage:is(.pc-fit, .pc-fit-measure) {
  min-height: 0 !important;
  flex-shrink: 0;
  margin: auto !important;
}
body.desktop-mode .desktop-window .games-stage.pc-fit-measure {
  width: 100%;
  zoom: 1 !important;
}
/* Short screens: the side panel drops helper text and Wordle's streaks. */
@media (max-height: 540px) {
  body.desktop-mode .desktop-window .games-stage.pc-split > .games-hint,
  body.desktop-mode .desktop-window .games-stage.pc-split:has(> .wd-grid) > .games-stats {
    display: none !important;
  }
}
/* Boards in a window are sized from the window's own height, not the whole
   screen minus a phone's status bar (that made them tiny on a landscape phone). */
body.desktop-mode .desktop-window .games-body {
  container-type: size;
}
body.desktop-mode .desktop-window .games-stage .wd-grid { width: min(420px, calc((100cqh - 24px) * 0.83)); min-width: 150px; }
body.desktop-mode .desktop-window .games-stage .su-board { width: min(640px, calc(100cqh - 24px)); min-width: 200px; }
body.desktop-mode .desktop-window .games-stage .ms-board { width: min(560px, calc((100cqh - 24px) * 0.8)); min-width: 180px; }
body.desktop-mode .desktop-window .games-stage .games-board-wrap > :is(.tw-board, .tt-board),
body.desktop-mode .desktop-window .games-stage :is(.lo-board, .sl-board, .rv-board) { width: min(560px, calc(100cqh - 24px)); min-width: 200px; }
body.desktop-mode .desktop-window .games-stage .ws-board { width: min(560px, calc(100cqh - 48px)); min-width: 200px; }
body.desktop-mode .desktop-window .games-stage .rx-pad { min-height: min(52cqh, 360px); }

/* Side by side: the board on the left, stats, buttons and keys on the right. */
body.desktop-mode .desktop-window .games-stage.pc-split {
  display: grid !important;
  max-width: none !important;
  column-gap: 28px;
  row-gap: 12px;
  align-content: center;
  align-items: center;
  grid-auto-rows: min-content;
}
body.desktop-mode .desktop-window .games-stage.pc-split > * {
  grid-column: 2;
  min-width: 0;
  max-width: 100%;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
body.desktop-mode .desktop-window .games-stage.pc-split > .pc-main {
  grid-column: 1;
  align-self: center;
}
body.desktop-mode .desktop-window .games-stage.pc-split > .games-stats {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ---------- Apps in windows: PC layout, not a phone column ---------- */

/* The title bar already names the app: the app's own header becomes a
   slim toolbar (back, page name, actions). */
body.desktop-mode .os-root > .desktop-window > .fullscreen-app-header {
  flex-shrink: 0;
  min-height: 44px;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  border-bottom: 1px solid var(--pc-line);
}
body.desktop-mode .desktop-window > .fullscreen-app-header .fullscreen-app-title {
  font-size: 15px !important;
}
body.desktop-mode .desktop-window > .fullscreen-app-header .fullscreen-app-title :is(svg, .ok-app-icon, .hs-icon, img):first-child {
  transform: scale(0.82);
}
@media (max-height: 540px) {
  body.desktop-mode .os-root > .desktop-window > .fullscreen-app-header {
    min-height: 38px;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
  }
}
/* Content uses the window's width. */
@container (min-width: 900px) {
  body.desktop-mode .desktop-window .ok-column,
  body.desktop-mode .desktop-window .games-hub,
  body.desktop-mode .desktop-window .store-column,
  body.desktop-mode .desktop-window .wv-page {
    max-width: 1080px !important;
  }
  body.desktop-mode .desktop-window .games-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@container (min-width: 1200px) {
  body.desktop-mode .desktop-window .games-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* ---------- Settings: categories on the left, the page on the right ---------- */

@container (min-width: 720px) {
  body.desktop-mode .desktop-window.settings-v3 .fullscreen-app-body {
    overflow: hidden !important;
    padding: 0 !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-column {
    display: grid !important;
    grid-template-columns: 270px minmax(0, 1fr);
    grid-template-rows: 100%;
    gap: 0;
    height: 100%;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-column > * {
    grid-area: 1 / 2;
    min-height: 0;
    overflow-y: auto;
    margin: 0 !important;
    padding: 18px max(24px, calc((100% - 760px) / 2)) 40px !important;
    box-sizing: border-box;
    scrollbar-width: thin;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-column > .settings-home {
    grid-area: 1 / 1;
    display: block !important;
    padding: 14px 10px 24px !important;
    border-right: 1px solid var(--pc-line);
    background: color-mix(in srgb, var(--on-surface, #fff) 3%, transparent);
    animation: none !important;
  }
  /* No page picked: Desktop mode's own page. */
  body.desktop-mode .desktop-window.settings-v3:not([data-page]) .settings-page[data-card="interface"] {
    display: block !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-profile {
    padding: 10px !important;
    margin-bottom: 8px;
    border-radius: 10px;
    min-height: 0 !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-profile :is(.settings-profile-sub, .settings-profile-tags, .settings-profile-add, .settings-profile-action) {
    display: none !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-profile > :not(.settings-profile-text):not(:first-child) {
    display: none !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home :is(.settings-group, .settings-results) {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-group-label {
    margin: 12px 10px 4px !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-row {
    min-height: 0 !important;
    padding: 7px 10px !important;
    border: 0 !important;
    border-radius: 7px !important;
    gap: 10px !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-row-hint,
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-row > svg:last-child {
    display: none !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-row-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 7px !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-row-icon svg {
    width: 16px;
    height: 16px;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-row-title {
    font-size: 13px !important;
    font-weight: 500 !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-row:hover {
    background: var(--pc-hover) !important;
  }
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-row.is-current,
  body.desktop-mode .desktop-window.settings-v3:not([data-page]) .settings-home .settings-row[data-cat="interface"] {
    background: color-mix(in srgb, var(--accent-primary, #6aa4f5) 16%, transparent) !important;
    box-shadow: inset 3px 0 0 var(--accent-primary, #6aa4f5);
  }
  /* The back arrow means nothing when the list is always there. */
  body.desktop-mode .desktop-window.settings-v3 .settings-back-btn {
    display: none !important;
  }
}
@media (max-height: 540px) {
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-profile {
    display: none !important;
  }
}

/* PC options in Settings > Desktop mode. */
.pc-settings-head {
  margin: 18px 4px 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pc-muted);
}
@container (min-width: 720px) {
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-profile > :first-child {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    font-size: 15px !important;
  }
}
@container (min-width: 720px) {
  body.desktop-mode .desktop-window.settings-v3 .settings-home .settings-row::before {
    display: none !important;
  }
}

/* ---------- Keyboard shortcuts (Ctrl+/) ---------- */

.pc-keys-shade {
  position: fixed;
  inset: 0;
  z-index: 660;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(0 0 0 / 0.35);
}
.pc-keys {
  display: flex;
  flex-direction: column;
  width: min(880px, 100%);
  max-height: min(640px, 100%);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.5);
  overflow: hidden;
}
.pck-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 18px;
  border-bottom: 1px solid var(--pc-line);
}
.pck-head b {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.pck-ico {
  display: flex;
  color: var(--accent-primary, #6aa4f5);
}
.pck-find {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 300px;
  height: 34px;
  margin-left: auto;
  padding: 0 12px;
  border: 1px solid var(--pc-line);
  border-radius: 999px;
  background: var(--pc-soft);
  color: var(--pc-muted);
}
.pck-find input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--on-surface);
  font: 13px var(--font-main);
}
.pck-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px 22px;
  align-content: start;
  padding: 14px 18px 18px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.pck-group h3 {
  margin: 8px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-primary, #6aa4f5);
}
.pck-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  padding: 3px 0;
  border-bottom: 1px solid var(--pc-line);
  font-size: 13px;
}
.pck-keys {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.pck-keys i {
  font-style: normal;
  font-size: 11px;
  color: var(--pc-muted);
}
.pck-keys kbd {
  min-width: 14px;
  padding: 2px 7px;
  border: 1px solid var(--pc-line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--pc-soft);
  color: var(--on-surface);
  font: 600 11px/1.5 var(--font-main);
  text-align: center;
}
.pck-none {
  grid-column: 1 / -1;
  padding: 30px;
  text-align: center;
  color: var(--pc-muted);
}
@media (max-height: 540px) {
  .pc-keys-shade { padding: 8px; }
  .pck-head { padding: 6px 8px 6px 14px; }
  .pck-body { padding: 6px 14px 12px; }
  .pck-row { min-height: 28px; }
}
@media (max-width: 560px) {
  .pck-head b { display: none; }
}

/* ---------- Taskbar overflow (apps that don't fit an upright phone) ---------- */
#desktop-taskbar .pcb-app.is-over { display: none; }
#desktop-taskbar .pcb-more[hidden] { display: none; }
#desktop-taskbar .pcb-more {
  gap: 1px;
  padding: 0 4px;
  color: var(--pc-muted);
}
#desktop-taskbar .pcb-more b {
  font: 700 11px var(--font-main);
  font-variant-numeric: tabular-nums;
}
#desktop-taskbar .pcb-more.has-running::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 6px;
  height: 3px;
  border-radius: 3px;
  translate: -50% 0;
  background: color-mix(in srgb, var(--on-surface) 55%, transparent);
}
.pc-menu-ico > .hs-icon { width: 18px; height: 18px; border-radius: 5px; }
