/* ============================================================
   YancoTab v3.0 — Shell CSS
   Cosmic Glass Honeycomb theme
   Boot screen, status bar, honeycomb grid, nav bar, windows
   ============================================================ */

/* ── Starfield Canvas ── */
#starfield {
  position: fixed;
  inset: 0;
  z-index: var(--z-wallpaper);
  pointer-events: none;
}

/* ── Boot Screen ── */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

div.boot-screen {
  display: flex;
  background: var(--bg);
}

.boot-glow {
  text-align: center;
  padding: 32px 48px;
  border-radius: 16px;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: bootFadeIn 1.2s var(--ease-out) both;
}

div.boot-screen .boot-glow {
  background: transparent;
  border: none;
  box-shadow: none;
}

.boot-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  display: block;
  animation: bootPulse 2s ease-in-out infinite;
}

.boot-text {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
  text-transform: none;
  text-shadow: none;
}

div.boot-screen .boot-text {
  font-size: var(--font-xl);
  text-transform: none;
  text-shadow: none;
}

.boot-subtext {
  font-size: var(--font-sm);
  color: var(--text-dim);
  margin-top: var(--space-xs);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.boot-status {
  position: absolute;
  bottom: 20px;
  width: 100%;
  text-align: center;
  color: var(--text-dim);
  font-size: var(--font-xs);
}

@keyframes bootFadeIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes bootPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.4), 0 0 60px rgba(var(--accent-rgb), 0.1); }
  50%      { box-shadow: 0 0 60px rgba(var(--accent-rgb), 0.6), 0 0 120px rgba(var(--accent-rgb), 0.2); }
}

.boot-logo::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 10px;
  background: var(--yv-platform);
  filter: blur(6px);
  pointer-events: none;
}

.boot-logo { position: relative; }

/* ── App Shell ── */
#app-shell {
  position: fixed;
  inset: 0;
  z-index: var(--z-grid);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.mobile-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.app {
  position: fixed;
  inset: 0;
}

.m-app-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-window);
}

/* ── Status Bar (full-width top tray) ── */
.status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(var(--safe-top, 0px) + 14px) 24px 0 24px;
  z-index: var(--z-statusbar);
  pointer-events: none;
}

.sb-time {
  font-size: 13px;
  font-weight: 400;
  color: rgba(var(--ui-text-rgb), 0.5);
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
}

/* ── Main Content ── */
/* On desktop the content stack (hero + search + widgets + section + grid +
   folder rail) is taller than the viewport, so we let main-content scroll.
   The 100px bottom padding clears the fixed-bottom dock. */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 20px 20px 110px;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

body.in-app .main-content {
  opacity: 0;
  pointer-events: none;
}

/* ── App Grid ── */
/* overflow: clip with overflow-clip-margin lets the hex ::before glow at
   inset:-5px render above the row-0 icons without being sliced. Plain
   overflow:hidden clipped them at the top edge. The 12px margin extends
   the clip region outward in all directions; horizontally that's well
   under the page-width gap to neighboring pages, so no swipe artifacts. */
.m-grid-container {
  position: relative;
  flex: 0 0 auto;
  overflow: clip;
  overflow-clip-margin: 12px;
  margin-top: auto;
  margin-left: auto;
  margin-right: auto;
}

.m-grid-pages {
  display: flex;
  height: 100%;
  will-change: transform;
}

.m-grid-page {
  flex: 0 0 100%;
  display: grid;
  grid-template-columns: repeat(4, 80px);
  grid-auto-rows: min-content;
  gap: 4px 6px;
  padding: var(--space-sm) var(--space-lg);
  align-content: start;
  justify-content: center;
  justify-items: center;
}

/* (Headroom for hex ::before glow handled by .m-grid-container's
   overflow-clip-margin — adding padding here had no effect because
   absolute-positioned icons resolve their containing block to the nearest
   positioned ancestor, which is .m-grid-container, not .m-grid-pages.) */

/* ── Page Dots ── */
.m-grid-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 0 4px;
  z-index: var(--z-grid);
  pointer-events: none;
  margin-bottom: auto;
}

.m-grid-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(var(--ui-text-rgb), 0.2);
  transition: all var(--transition-fast);
}

.m-grid-dot.active {
  background: var(--accent);
  width: 18px;
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.5), 0 0 4px rgba(var(--accent-rgb), 0.3);
  border-radius: 3px;
}

/* ── Icon Entrance Animation ── */
@keyframes iconFadeIn {
  from { opacity: 0; }
}

.m-grid-pages > .app-icon {
  animation: iconFadeIn 0.4s var(--ease-out) backwards;
  animation-delay: calc(var(--icon-i, 0) * 40ms);
}

@keyframes iconScaleIn {
  from { transform: scale(0.85) translateY(8px); }
}

.m-grid-pages > .app-icon > .app-icon-inner {
  animation: iconScaleIn 0.45s var(--ease-spring) backwards;
  animation-delay: calc(var(--icon-i, 0) * 40ms);
}

/* ── Hex App Icon ── */
.m-app-item,
.app-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.m-app-item:hover,
.app-icon:hover {
  transform: translateY(-6px) scale(1.08);
}

.m-app-item:active,
.app-icon:active {
  transform: scale(0.95);
}

.hex-icon {
  width: var(--hex-size);
  height: var(--hex-size);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: none;
  position: relative;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

/* ── YancoVerse: Outer bloom glow ── */
.hex-icon::before {
  content: '';
  position: absolute;
  inset: -5px;
  clip-path: var(--hex-clip);
  background: linear-gradient(135deg,
    rgba(var(--accent-rgb), 0.8),
    rgba(var(--accent-rgb), 0.3) 30%,
    rgba(var(--accent-rgb), 0.5) 70%,
    rgba(var(--accent-rgb), 0.7));
  opacity: 0.5;
  filter: blur(1px);
  transition: all 0.35s;
}

.hex-icon:hover::before,
.hex-icon:active::before {
  opacity: 0.9;
  filter: blur(0.5px);
  inset: -6px;
}

/* ── YancoVerse: Inner ring ── */
.hex-ring {
  position: absolute;
  inset: -3px;
  clip-path: var(--hex-clip);
  background: linear-gradient(160deg,
    rgba(var(--accent-rgb), 0.9),
    rgba(var(--accent-rgb), 0.35) 50%,
    rgba(var(--accent-rgb), 0.7));
  z-index: 1;
  transition: all 0.35s;
}

.hex-icon:hover .hex-ring {
  background: linear-gradient(160deg,
    rgba(var(--accent-rgb), 1),
    rgba(var(--accent-rgb), 0.5) 50%,
    rgba(var(--accent-rgb), 0.9));
}

/* ── YancoVerse: Glass reflection ── */
.hex-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: var(--hex-clip);
  background: var(--yv-glass);
  pointer-events: none;
  z-index: 4;
}

/* ── YancoVerse: Floating platform shadow ── */
.hex-platform {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 8px;
  background: var(--yv-platform);
  filter: blur(4px);
  transition: all 0.35s;
  pointer-events: none;
  z-index: 0;
}

.hex-icon:hover ~ .hex-platform,
.app-icon:hover .hex-platform,
.m-app-item:hover .hex-platform {
  width: 60px;
  height: 10px;
  background: var(--yv-platform-hover);
  bottom: -14px;
}

/* Inner content fills the hex */
.hex-icon-content {
  width: 100%;
  height: 100%;
  clip-path: var(--hex-clip);
  background: linear-gradient(160deg, rgba(10, 28, 52, 0.97), rgba(4, 12, 24, 0.99));
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* ── YancoVerse: Inner edge glow ── */
.hex-icon-content::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--yv-edge-glow);
  pointer-events: none;
  z-index: 1;
}

.hex-icon img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

/* Per-app hex container backgrounds are now category-tinted via inline style
   from SmartIcon → getCategoryColor() (single source of truth in AppIcons.js).
   Game-specific accent overlays (used by .game-tint inside the SVG render)
   stay below — they're a different concern (overlay tone, not base color). */

/* Game hex backgrounds */
.app-icon-snake .hex-icon-content { --game-accent: rgba(40, 255, 170, 0.35); }
.app-icon-memory .hex-icon-content { --game-accent: rgba(120, 190, 255, 0.35); }
.app-icon-tictactoe .hex-icon-content { --game-accent: rgba(255, 120, 210, 0.35); }
.app-icon-minesweeper .hex-icon-content { --game-accent: rgba(255, 200, 110, 0.35); }
.app-icon-solitaire .hex-icon-content { --game-accent: rgba(255, 90, 120, 0.35); }
.app-icon-spider-solitaire .hex-icon-content { --game-accent: rgba(255, 70, 90, 0.35); }
.app-icon-mahjong .hex-icon-content { --game-accent: rgba(120, 255, 200, 0.35); }
.app-icon-tarneeb .hex-icon-content { --game-accent: rgba(100, 120, 255, 0.35); }
.app-icon-trix .hex-icon-content { --game-accent: rgba(180, 80, 255, 0.35); }

.hex-icon-label,
.app-label {
  font-size: 12px;
  font-weight: 500;
  /* Explicit line-height so the line-box is 1.4 * 12px = 16.8px — taller
     than the 10px glyph + descenders + stroke + halo combined. The label
     slot inside .app-icon is 17px (90 - 66 hex - 7 gap) so this fits with
     0.2px headroom. Without an explicit line-height the flex item collapses
     to ~10.17px (`line-height: normal`) which then clips descenders and
     the text-stroke when overflow: hidden kicks in. */
  line-height: 1.4;
  /* Brighter base color so labels stay legible against busy wallpapers
     without relying purely on the text-shadow halo. */
  color: rgba(var(--ui-text-rgb), 0.92);
  text-align: center;
  max-width: calc(var(--hex-size) + 20px);
  /* Horizontal-only clipping for ellipsis. Vertical content (descenders,
     text-stroke, halo) must remain visible. `overflow: clip` avoids the
     box becoming a scroll container while still truncating x-overflow. */
  overflow-x: clip;
  overflow-y: visible;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Halo (the polish layer in glass.css adds the text-stroke and a stronger
     halo on top of this base — kept here so older themes still get a halo). */
  text-shadow:
    0 0 1px rgba(0, 0, 0, 0.85),
    0 1px 2px rgba(0, 0, 0, 0.85),
    0 -1px 2px rgba(0, 0, 0, 0.55),
    0 0 6px rgba(0, 0, 0, 0.65),
    0 0 12px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.3px;
}

/* ── Nav Bar (replaces Dock) ── */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  margin: 0 auto calc(var(--safe-bottom, 0px) + 16px);
  width: fit-content;
  min-width: 320px;
  max-width: 520px;
  background: rgba(4, 10, 20, 0.6);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: none;
  border-radius: 20px;
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.35),
    inset 0 0 0 3px rgba(var(--accent-rgb), 0.1),
    0 -4px 30px rgba(0, 0, 0, 0.3),
    0 0 40px rgba(var(--accent-rgb), 0.08);
  z-index: var(--z-dock);
  position: relative;
  overflow: visible;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
}

.nav-bar.is-hidden {
  transform: translateY(100px);
  opacity: 0;
  pointer-events: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 16px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  color: rgba(var(--ui-text-rgb), 0.35);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:hover {
  background: rgba(var(--accent-rgb), 0.08);
  color: rgba(var(--accent-rgb), 0.8);
}

.nav-item.active {
  background: rgba(var(--accent-rgb), 0.1);
  color: rgba(var(--accent-rgb), 0.9);
  box-shadow: inset 0 0 12px rgba(var(--accent-rgb), 0.06), 0 0 18px rgba(var(--accent-rgb), 0.1);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 16px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6), 0 0 20px rgba(var(--accent-rgb), 0.2);
}

.nav-item:active {
  transform: scale(0.95);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.nav-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── Home Bar ── */
.home-bar {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.3);
  z-index: calc(var(--z-dock) + 1);
  cursor: pointer;
}

/* ── App Windows ── */
#app-windows {
  position: fixed;
  inset: 0;
  z-index: var(--z-window);
  pointer-events: none;
}

#app-windows > * {
  pointer-events: auto;
}

/* ── Standalone app-window fallback (not inside window chrome) ── */
.app-window:not(.window-chrome__content .app-window) {
  position: fixed;
  inset: 0;
  z-index: var(--z-window);
  background: var(--bg);
  color: var(--text-bright);
  font-family: var(--font-sans);
  overflow: hidden;
}

/* ── Rich Animated App Icons ── */
.phosphor-wrap {
  width: 88%;
  height: 88%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phosphor-wrap svg {
  width: 100%;
  height: 100%;
}

.gear-spin {
  animation: gearSpin 12s linear infinite;
  transform-origin: 34px 28.5px;
}
@keyframes gearSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.globe-ring {
  animation: ringOrbit 6s ease-in-out infinite;
  transform-origin: 32px 32px;
}
@keyframes ringOrbit {
  0%, 100% { transform: rotate(-20deg); opacity: 0.5; }
  50% { transform: rotate(-25deg); opacity: 0.8; }
}

.sun-pulse {
  animation: sunPulse 3s ease-in-out infinite;
}
@keyframes sunPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.sun-spin {
  animation: sunRaysSpin 20s linear infinite;
}
@keyframes sunRaysSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.cloud-float {
  animation: cloudFloat 4s ease-in-out infinite;
}
@keyframes cloudFloat {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(2px); }
}

.pin-bounce {
  animation: pinBounce 2s ease-in-out infinite;
}
@keyframes pinBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* ── Smart Search (v3 teal glass pill) ── */
/* Compact 44px height (was 56px) so the whole hero + search + tabs stack
   fits within a 1280×720 viewport without scrolling. */
.m-search-container {
  position: relative;
  width: 620px;
  max-width: 90vw;
  height: 44px;
  z-index: var(--z-search, 1150);
}

.m-search-input {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-pill);
  border: none;
  background: rgba(var(--accent-rgb), 0.04);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  padding: 0 22px;
  color: var(--text-bright);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.3),
    inset 0 0 0 2.5px rgba(var(--accent-rgb), 0.08),
    0 0 20px rgba(var(--accent-rgb), 0.06);
  transition: box-shadow 0.3s var(--ease-out),
              background 0.3s var(--ease-out), backdrop-filter 0.3s var(--ease-out),
              -webkit-backdrop-filter 0.3s var(--ease-out);
}

.m-search-container::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 6px;
  background: var(--yv-platform);
  filter: blur(4px);
  pointer-events: none;
  transition: all 0.3s;
}

.m-search-input::placeholder {
  color: rgba(var(--ui-text-rgb), 0.35);
  font-weight: 400;
}

.m-search-input:hover {
  background: rgba(var(--accent-rgb), 0.06);
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.4),
    inset 0 0 0 3px rgba(var(--accent-rgb), 0.1),
    0 0 30px rgba(var(--accent-rgb), 0.1);
}

.m-search-input:focus {
  background: rgba(var(--accent-rgb), 0.08);
  -webkit-backdrop-filter: blur(32px);
  backdrop-filter: blur(32px);
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.5),
    inset 0 0 0 3px rgba(var(--accent-rgb), 0.12),
    0 0 40px rgba(var(--accent-rgb), 0.12);
}

body.in-app .m-search-container {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Context Menu ── */
.context-menu,
.ctx-menu {
  position: fixed;
  z-index: var(--z-context);
  min-width: 180px;
  padding: var(--space-sm);
  background: var(--bg-panel);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: none;
  border-radius: var(--radius-md);
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.35),
    inset 0 0 0 3px rgba(var(--accent-rgb), 0.1),
    var(--glow-md);
  animation: ctxMenuIn 0.15s var(--ease-out) both;
  overflow: visible;
}

@keyframes ctxMenuIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  color: var(--text-bright);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.ctx-item:hover,
.ctx-item:active {
  background: var(--accent-bg);
  box-shadow: inset 0 0 12px rgba(var(--accent-rgb), 0.06);
}

.ctx-item.danger {
  color: var(--danger);
}

.ctx-separator {
  height: 1px;
  margin: var(--space-xs) 0;
  background: var(--border);
}

/* ── Hex Folder Icon ── */
.folder-hex {
  cursor: pointer;
  background: radial-gradient(circle, rgba(8, 18, 32, 0.85) 30%, transparent 70%);
}

.folder-glass3d .folder-hex-content {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.folder-hex .folder-preview-grid {
  background:
    radial-gradient(120% 120% at var(--fx, 50%) var(--fy, 35%),
      rgba(var(--accent-rgb), 0.08), rgba(var(--accent-rgb), 0.02) 50%, rgba(0, 0, 0, 0.1) 100%),
    linear-gradient(180deg, rgba(8, 18, 32, 0.92) 0%, rgba(6, 11, 20, 0.96) 100%);
  border: none;
  border-radius: 0;
  opacity: 0.85;
}

/* ── Folder Overlay ── */
.folder-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(6, 11, 20, 0.85);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: searchFadeIn 0.2s var(--ease-out) both;
}

.folder-panel {
  width: min(340px, 90vw);
  max-height: 70vh;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.4),
    inset 0 0 0 3px rgba(var(--accent-rgb), 0.1),
    var(--glow-lg);
  overflow: hidden;
  position: relative;
}

.folder-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.folder-title {
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--text-bright);
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  padding: var(--space-lg);
  overflow-y: auto;
  max-height: calc(70vh - 60px);
}

/* ── Notification Toast ── */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 50px);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  padding: 12px 24px;
  background: var(--bg-card);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: none;
  border-radius: var(--radius-md);
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.35),
    inset 0 0 0 3px rgba(var(--accent-rgb), 0.1),
    var(--glow-sm);
  color: var(--text-bright);
  font-size: var(--font-sm);
  animation: toastIn 0.3s var(--ease-spring) both;
}

/* Toast pills from ToastManager */
.toast-pill {
  background: var(--bg-panel);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 14px;
  color: var(--text-bright);
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.3),
    inset 0 0 0 3px rgba(var(--accent-rgb), 0.08),
    var(--shadow-md);
  border-left: 3px solid var(--toast-color, var(--accent));
  pointer-events: auto;
  cursor: pointer;
  max-width: 90vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ── Mobile Context Menu ── */
.mobile-context-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-context-menu {
  background: var(--bg-panel);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 14px;
  width: 260px;
  padding: 6px;
  border: none;
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.3),
    inset 0 0 0 3px rgba(var(--accent-rgb), 0.08),
    0 25px 50px rgba(0, 0, 0, 0.55);
}

.mobile-context-menu .context-item {
  padding: 11px 14px;
  color: var(--text-bright);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.1s;
}

.mobile-context-menu .context-item.destructive {
  color: var(--danger, #ff453a);
}

.mobile-context-menu .context-item:hover {
  background: rgba(var(--accent-rgb), 0.08);
}

.mobile-context-menu .context-item:active {
  background: rgba(var(--accent-rgb), 0.15);
}

.mobile-context-menu .ctx-separator {
  height: 1px;
  background: var(--border-light);
  margin: 4px 8px;
}

.mobile-context-menu .ctx-header {
  display: flex;
  align-items: center;
  padding: 10px 12px 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border-light);
}

.mobile-context-menu .ctx-header-icon {
  width: 36px;
  height: 36px;
  margin-right: 10px;
  border-radius: 10px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background-size: cover;
}

.mobile-context-menu .ctx-header-title {
  color: var(--text-bright);
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Onboarding Modal ── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.onboarding-modal {
  background: var(--bg-panel);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  border: none;
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.3),
    inset 0 0 0 3px rgba(var(--accent-rgb), 0.08),
    var(--shadow-lg);
}

.onboarding-modal .ob-primary-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.3);
  transition: transform 150ms var(--ease-out), box-shadow 150ms;
}

.onboarding-modal .ob-primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 28px rgba(var(--accent-rgb), 0.45);
}

.onboarding-modal .ob-primary-btn:active {
  transform: scale(0.98);
}

.onboarding-modal .ob-skip {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 8px;
}

.onboarding-modal .ob-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  background: var(--bg-surface);
  color: var(--text-bright);
  font-size: 16px;
  box-sizing: border-box;
  outline: none;
  margin-bottom: 24px;
  box-shadow: inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.2);
  transition: box-shadow 200ms;
}

.onboarding-modal .ob-input:focus {
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.5),
    0 0 12px rgba(var(--accent-rgb), 0.15);
}

.onboarding-modal .ob-radio-group {
  display: flex;
  gap: 8px;
}

.onboarding-modal .ob-radio-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-bright);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.onboarding-modal .ob-radio-btn.selected {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.2);
}

/* ── Edit Mode (Jiggle) ── */
.is-editing .m-app-item,
.is-editing .app-icon {
  animation: jiggle 0.3s ease-in-out infinite alternate;
}

@keyframes jiggle {
  0%   { transform: rotate(-1deg); }
  100% { transform: rotate(1deg); }
}

/* ── Keyboard Focus ── */
.app-icon:focus-visible .hex-icon {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Responsive: Small Phones ── */
@media (max-width: 700px) {
  :root {
    --hex-size: 52px;
  }

  .nav-item {
    padding: 8px 12px;
  }

  .nav-bar {
    min-width: 280px;
  }

  .m-search-container {
    height: 42px;
  }

  .m-search-input {
    font-size: 13px;
  }
}

/* ── Responsive: Large Screens ── */
@media (min-width: 1400px) {
  :root {
    --hex-size: 68px;
  }
}

/* ── Touch Devices ── */
@media (pointer: coarse) {
  .nav-item {
    padding: 10px 18px;
  }

  .m-search-container {
    height: 50px;
  }
}

/* ── Landscape Adjustments ── */

/* ============================================================
   Light Mode Overrides — Shell Components
   ============================================================ */

/* Nav bar: frosted white glass */
body.theme-light .nav-bar {
  background: rgba(255, 255, 255, 0.65);
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.2),
    inset 0 0 0 2.5px rgba(var(--accent-rgb), 0.06),
    0 -2px 20px rgba(0, 0, 0, 0.06),
    0 0 30px rgba(var(--accent-rgb), 0.04);
}

body.theme-light .nav-item {
  color: rgba(var(--ui-text-rgb), 0.55);
}

body.theme-light .nav-item:hover {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

body.theme-light .nav-item.active {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}

/* Hex icons: light glass — YancoVerse luminous */
body.theme-light .hex-icon::before {
  background: linear-gradient(135deg,
    rgba(var(--accent-rgb), 0.4),
    rgba(var(--accent-rgb), 0.15) 30%,
    rgba(var(--accent-rgb), 0.25) 70%,
    rgba(var(--accent-rgb), 0.35));
  opacity: 0.4;
}

body.theme-light .hex-ring {
  background: linear-gradient(160deg,
    rgba(var(--accent-rgb), 0.5),
    rgba(var(--accent-rgb), 0.2) 50%,
    rgba(var(--accent-rgb), 0.4));
}

body.theme-light .hex-icon-content {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(240, 242, 245, 0.95));
}

body.theme-light .hex-icon::after {
  background: var(--yv-glass);
}

/* App-specific hex backgrounds for light mode */
body.theme-light .app-icon-settings .hex-icon-content { background: linear-gradient(145deg, #e8edf5, #d5dbe8); }
body.theme-light .app-icon-browser .hex-icon-content { background: linear-gradient(145deg, #e0eaf8, #cdd8ec); }
body.theme-light .app-icon-weather .hex-icon-content { background: linear-gradient(to top, #cce4f5, #a8d4f0); }
body.theme-light .app-icon-notes .hex-icon-content { background: linear-gradient(145deg, #f5edd8, #e8dcc0); }
body.theme-light .app-icon-files .hex-icon-content,
body.theme-light .app-icon-folder .hex-icon-content { background: linear-gradient(145deg, #d8e8f5, #c5d8ec); }
body.theme-light .app-icon-calculator .hex-icon-content { background: linear-gradient(145deg, #e5e5f0, #d0d0e0); }
body.theme-light .app-icon-photos .hex-icon-content { background: linear-gradient(145deg, #e0e5f0, #ced5e8); }
body.theme-light .app-icon-maps .hex-icon-content { background: linear-gradient(145deg, #d0eae0, #b8dcd0); }
body.theme-light .app-icon-clock .hex-icon-content { background: radial-gradient(circle, #e0e8f0, #cdd5e0); }
body.theme-light .app-icon-calendar .hex-icon-content,
body.theme-light .app-icon-date .hex-icon-content { background: linear-gradient(145deg, #dce4f0, #c8d2e5); }

/* Labels in light mode: darker glyphs, white halo (inverted) so they read
   on light-colored wallpapers and pastel backgrounds. */
body.theme-light .hex-icon-label,
body.theme-light .app-label {
  color: rgba(var(--ui-text-rgb), 0.95);
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.95),
    0 1px 2px rgba(255, 255, 255, 0.85),
    0 -1px 2px rgba(255, 255, 255, 0.55),
    0 0 6px rgba(255, 255, 255, 0.65),
    0 0 12px rgba(0, 0, 0, 0.10);
}

/* Search: light glass — luminous */
body.theme-light .m-search-input {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-bright);
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.2),
    inset 0 0 0 2.5px rgba(var(--accent-rgb), 0.05),
    0 1px 6px rgba(0, 0, 0, 0.04);
}

body.theme-light .m-search-input::placeholder {
  color: rgba(var(--ui-text-rgb), 0.45);
}

body.theme-light .m-search-input:hover {
  background: rgba(255, 255, 255, 0.65);
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.3),
    inset 0 0 0 2.5px rgba(var(--accent-rgb), 0.08),
    0 0 15px rgba(var(--accent-rgb), 0.06);
}

body.theme-light .m-search-input:focus {
  background: rgba(255, 255, 255, 0.75);
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.35),
    inset 0 0 0 3px rgba(var(--accent-rgb), 0.1),
    0 0 20px rgba(var(--accent-rgb), 0.08);
}

/* Dots */
body.theme-light .m-grid-dot {
  background: rgba(var(--ui-text-rgb), 0.25);
}

body.theme-light .m-grid-dot.active {
  box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.3);
}

/* Mobile Context Menu: light */
body.theme-light .mobile-context-menu {
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.15),
    inset 0 0 0 2.5px rgba(var(--accent-rgb), 0.04),
    0 25px 50px rgba(0, 0, 0, 0.15);
}

body.theme-light .mobile-context-menu .context-item:hover {
  background: rgba(var(--accent-rgb), 0.06);
}

/* Onboarding: light */
body.theme-light .onboarding-modal {
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.15),
    inset 0 0 0 2.5px rgba(var(--accent-rgb), 0.04),
    var(--shadow-lg);
}

body.theme-light .onboarding-modal .ob-primary-btn {
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.15);
}

body.theme-light .onboarding-modal .ob-input {
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.12);
}

body.theme-light .onboarding-modal .ob-radio-btn.selected {
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.12);
}

/* ── Alarm Ring Overlay ── */
.m-alarm-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 500);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out, ease-out);
}

.m-alarm-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.m-alarm-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 48px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(0, 229, 193, 0.08), transparent 60%),
    rgba(14, 20, 32, 0.95);
  border: 1px solid rgba(0, 229, 193, 0.15);
  border-radius: 24px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 40px rgba(0, 229, 193, 0.08);
  min-width: 280px;
  max-width: 360px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.35s var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
}

.m-alarm-overlay.is-visible .m-alarm-card {
  transform: scale(1);
}

.m-alarm-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent, #00e5c1);
}

.m-alarm-label {
  font-size: 22px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 4px;
}

.m-alarm-time {
  font-size: 48px;
  font-weight: 200;
  color: rgba(255, 255, 255, 0.95);
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  margin: 8px 0 16px;
}

.m-alarm-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.m-alarm-btn {
  flex: 1;
  padding: 14px 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.m-alarm-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.m-alarm-btn.is-primary {
  background: var(--accent, #00e5c1);
  color: #0a101c;
  border-color: var(--accent, #00e5c1);
}

.m-alarm-btn.is-primary:hover {
  filter: brightness(1.1);
}

/* Light mode */
body.theme-light .m-alarm-overlay {
  background: rgba(255, 255, 255, 0.6);
}

body.theme-light .m-alarm-card {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(0, 122, 255, 0.06), transparent 60%),
    rgba(255, 255, 255, 0.97);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15);
}

body.theme-light .m-alarm-title { color: var(--accent, #007AFF); }
body.theme-light .m-alarm-label { color: rgba(0, 0, 0, 0.85); }
body.theme-light .m-alarm-time { color: rgba(0, 0, 0, 0.9); }
body.theme-light .m-alarm-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.7);
}
body.theme-light .m-alarm-btn.is-primary {
  background: var(--accent, #007AFF);
  color: #fff;
  border-color: var(--accent, #007AFF);
}
