/* ============================================================
   Continuum Pocket RX - Mobile shell styling
   Kernel-owned stylesheet (same convention as qrx.css / aria.css):
   guest apps never depend on these rules. Reuses the neon design
   tokens defined in core.css (:root) for visual continuity with
   the desktop shell and Q-RX.
   ============================================================ */

/* ------------------- Mobile boot screen (pre-kernel) ----------------- */
/* On a phone-sized/mobile-UA browser, Pocket RX always lands in a temporary
   session (see kernel.js _runBootSequence), so the desktop-only "connect an
   empty directory" install path and the download/community promo row never
   apply — only the one-tap temporary-session start remains. */
html.pocket-boot .boot-install-option,
html.pocket-boot #bootStart,
html.pocket-boot .boot-install-note,
html.pocket-boot .bd-split,
html.pocket-boot .promo-row { display: none; }

/* ---------------- Host environment integration --------------- */
/* Pocket takes over #desktopEnvironment's visible chrome; the running-app
   window still uses the exact same WindowManager, just elevated above
   Pocket and stripped of its titlebar while a game/app is in the foreground. */
.desktop-environment.pocket-mode .wallpaper-stack,
.desktop-environment.pocket-mode .system-taskbar,
.desktop-environment.pocket-mode #startMenu { display: none; }
.desktop-environment.pocket-mode .desktop-workspace { display: none; }
.desktop-environment.pocket-mode.pocket-playing .desktop-workspace {
  display: block;
  inset: 0;
  padding: 0;
  z-index: 5;
}
.desktop-environment.pocket-mode .continuum-rx-window .window-titlebar,
.desktop-environment.pocket-mode .continuum-rx-window .win-resize-edge,
.desktop-environment.pocket-mode .continuum-rx-window .win-resize-corner {
  display: none;
}
.desktop-environment.pocket-mode .continuum-rx-window.maximized {
  border: none;
  box-shadow: none;
  background-color: #000;
}

/* -------------------------- Root shell ------------------------ */
.pocket-shell {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(168,85,247,0.16), transparent 60%),
    radial-gradient(ellipse 100% 50% at 15% 110%, rgba(0,243,255,0.10), transparent 55%),
    linear-gradient(180deg, #10121d 0%, #090a11 60%, #050609 100%);
  color: var(--text-primary);
  font-family: var(--font-retro);
  overflow: hidden;
  --pkt-safe-top: env(safe-area-inset-top, 0px);
  --pkt-safe-bottom: env(safe-area-inset-bottom, 0px);
}
.pocket-shell.pkt-no-safe-area { --pkt-safe-top: 0px; --pkt-safe-bottom: 0px; }
.pocket-shell * { box-sizing: border-box; }

.pkt-screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(14px + var(--pkt-safe-top)) 14px 20px;
}

/* ---------------------- Bottom navigation ---------------------- */
.pkt-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex: 0 0 auto;
  padding: 8px 6px calc(8px + var(--pkt-safe-bottom));
  background: rgba(8,9,15,0.94);
  border-top: 1px solid rgba(0,243,255,0.22);
  backdrop-filter: blur(10px);
}
.pkt-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-family: var(--font-retro);
  font-size: 10px;
  letter-spacing: 1px;
  padding: 4px 12px;
  cursor: pointer;
}
.pkt-nav-btn svg { width: 21px; height: 21px; }
.pkt-nav-btn.active { color: var(--neon-cyan); text-shadow: 0 0 8px rgba(0,243,255,0.55); }
.pkt-nav-btn.active svg { filter: drop-shadow(0 0 4px rgba(0,243,255,0.7)); }

/* --------------------- Floating "playing" pill ------------------ */
.pkt-playbar {
  position: absolute;
  top: calc(10px + var(--pkt-safe-top));
  left: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(5,6,10,0.85);
  border: 1px solid var(--neon-cyan);
  border-radius: 20px;
  padding: 6px 14px 6px 6px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 14px rgba(0,243,255,0.25);
}
.pkt-play-back {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 0;
  background: var(--neon-cyan);
  color: #04121a;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.pkt-play-back svg { width: 16px; height: 16px; }
.pkt-play-title {
  font-size: 11px; font-weight: bold;
  max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ----------------------------- Header --------------------------- */
.pkt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.pkt-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pkt-brand-c {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 19px;
  border-radius: 8px;
  border: 2px solid var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0,243,255,0.5), inset 0 0 8px rgba(0,243,255,0.22);
}
.pkt-brand-text {
  display: flex; flex-direction: column;
  font-weight: bold; letter-spacing: 2px; font-size: 13px; line-height: 1.2;
  white-space: nowrap;
}
.pkt-brand-text small {
  display: block; font-size: 9px; letter-spacing: 2px; font-weight: normal;
  color: var(--neon-magenta);
}
.pkt-profile {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--window-border);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}
.pkt-avatar {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-magenta));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: bold;
  flex: 0 0 auto;
}
.pkt-profile-meta { display: flex; flex-direction: column; gap: 2px; font-size: 10px; }
.pkt-profile-name { color: var(--text-primary); font-weight: bold; line-height: 1; }
.pkt-xp { display: block; width: 66px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.08); overflow: hidden; }
.pkt-xp-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta)); }
.pkt-profile-lvl { color: var(--text-dim); line-height: 1; }

/* ------------------------------ Sections ------------------------ */
.pkt-section { margin-bottom: 22px; }
.pkt-section-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--neon-cyan);
  margin-bottom: 10px;
}
.pkt-section-head a { color: var(--neon-magenta); text-decoration: none; font-size: 10px; letter-spacing: 1px; }
.pkt-empty { font-size: 11px; color: var(--text-dim); padding: 8px 2px; }
.pkt-empty a { color: var(--neon-cyan); }
.pkt-loading { padding: 32px 0; text-align: center; color: var(--text-dim); font-size: 11px; letter-spacing: 1px; }

/* Horizontal scrolling rows of mini cards. */
.pkt-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.pkt-row::-webkit-scrollbar { display: none; }

.pkt-mini-card {
  flex: 0 0 106px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--window-bg);
  border: 1px solid var(--window-border);
  border-radius: 10px;
  padding: 10px 8px;
  color: inherit; font-family: inherit;
  cursor: pointer;
}
.pkt-mini-card:active { transform: scale(0.97); border-color: var(--neon-cyan); }
.pkt-icon-img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; }
.pkt-icon-img.lg { width: 74px; height: 74px; }
.pkt-icon-glyph { font-size: 28px; line-height: 1; filter: drop-shadow(0 0 6px rgba(0,243,255,0.32)); }
.pkt-icon-glyph.lg { font-size: 44px; }
.pkt-mini-name {
  font-size: 11px; text-align: center; line-height: 1.2; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pkt-tag {
  font-size: 8px; letter-spacing: 1px; padding: 2px 6px; border-radius: 10px;
  border: 1px solid var(--neon-magenta); color: var(--neon-magenta);
  text-transform: uppercase; white-space: nowrap;
}
.pkt-tag--sm { font-size: 8px; }
.pkt-tag--accent { border-color: var(--neon-purple); color: var(--neon-purple); }

/* --------------------------- Continue Playing --------------------- */
.pkt-continue-card {
  display: flex; gap: 14px;
  background: var(--window-bg);
  border: 1px solid rgba(0,243,255,0.35);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 0 24px rgba(0,243,255,0.08);
}
.pkt-continue-art { flex: 0 0 auto; }
.pkt-continue-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pkt-continue-body h3 { margin: 0; font-size: 16px; }
.pkt-continue-body p { margin: 0; font-size: 11px; color: var(--text-dim); }
.pkt-continue-foot { font-size: 10px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; }
.pkt-continue-foot svg { width: 12px; height: 12px; }

/* ------------------------------ Buttons ---------------------------- */
.pkt-btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 0; border-radius: 8px; padding: 10px 18px;
  font-family: var(--font-retro); font-weight: bold; font-size: 12px; letter-spacing: 1px;
  cursor: pointer; color: #04121a;
  align-self: flex-start;
}
.pkt-btn svg { width: 15px; height: 15px; }
.pkt-btn--primary { background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta)); box-shadow: 0 4px 16px rgba(0,243,255,0.32); }
.pkt-btn--sm { padding: 7px 12px; font-size: 10px; }
.pkt-btn:active { transform: translateY(1px); }

/* ------------------------------ Pocket Tools ------------------------ */
.pkt-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pkt-tool {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 4px;
  border-radius: 12px;
  border: 1px solid var(--window-border);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-family: inherit; font-size: 10px; letter-spacing: 0.5px;
  cursor: pointer;
}
.pkt-tool svg { width: 22px; height: 22px; color: var(--neon-cyan); }
.pkt-tool:active { border-color: var(--neon-cyan); }

/* --------------------------- Library: search/chips/tabs -------------- */
.pkt-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--window-bg);
  border: 1px solid var(--window-border);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 12px;
}
.pkt-search-ic svg { width: 16px; height: 16px; color: var(--text-dim); }
.pkt-search input {
  flex: 1; min-width: 0;
  background: none; border: 0;
  color: var(--text-primary); font-family: var(--font-retro); font-size: 12px;
  outline: none;
}

.pkt-chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.pkt-chips::-webkit-scrollbar { display: none; }
.pkt-chip {
  flex: 0 0 auto;
  background: none;
  border: 1px solid var(--window-border);
  color: var(--text-dim);
  border-radius: 16px;
  padding: 6px 13px;
  font-size: 10px; font-family: var(--font-retro); white-space: nowrap;
  cursor: pointer;
}
.pkt-chip.active { border-color: var(--neon-cyan); color: var(--neon-cyan); background: rgba(0,243,255,0.08); }

.pkt-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--window-border); margin-bottom: 16px; }
.pkt-tab {
  background: none; border: 0;
  color: var(--text-dim);
  font-family: var(--font-retro); font-size: 11px; letter-spacing: 1px;
  padding: 8px 2px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.pkt-tab.active { color: var(--neon-cyan); border-color: var(--neon-cyan); }

/* ------------------------------ Ready to Play ------------------------ */
.pkt-ready { display: flex; gap: 10px; overflow-x: auto; }
.pkt-ready::-webkit-scrollbar { display: none; }
.pkt-ready-card {
  flex: 0 0 216px; display: flex; gap: 10px;
  background: var(--window-bg);
  border: 1px solid rgba(168,85,247,0.4);
  border-radius: 12px;
  padding: 10px;
}
.pkt-ready-body { display: flex; flex-direction: column; min-width: 0; }
.pkt-ready-body h4 { margin: 0 0 2px; font-size: 12px; }
.pkt-ready-body p { margin: 0 0 8px; font-size: 10px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------ Card grid ----------------------------- */
.pkt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pkt-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pkt-card-art {
  position: relative;
  border: 1px solid var(--window-border);
  border-radius: 10px;
  background: var(--window-bg);
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1;
  cursor: pointer;
  width: 100%;
}
.pkt-card-art:active { border-color: var(--neon-cyan); }
.pkt-compat { position: absolute; top: 4px; right: 4px; font-size: 12px; line-height: 1; }
.pkt-card-body { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.pkt-card-name { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pkt-fav { flex: 0 0 auto; background: none; border: 0; color: var(--window-border); cursor: pointer; padding: 0; }
.pkt-fav svg { width: 14px; height: 14px; }
.pkt-fav.active { color: var(--neon-magenta); }

/* -------------------------------- Discover ------------------------------ */
.pkt-featured {
  position: relative;
  border-radius: 16px;
  padding: 20px 16px;
  background: linear-gradient(160deg, rgba(168,85,247,0.25), rgba(0,243,255,0.07));
  border: 1px solid var(--neon-purple);
  overflow: hidden;
}
.pkt-featured h2 { margin: 6px 0; font-size: 19px; line-height: 1.2; }
.pkt-featured p { margin: 0 0 12px; font-size: 11px; color: var(--text-dim); max-width: 86%; }
.pkt-featured-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* -------------------------------- System --------------------------------- */
.pkt-workspace-card, .pkt-desktop-card, .pkt-toggle-row, .pkt-perf, .pkt-storage {
  background: var(--window-bg);
  border: 1px solid var(--window-border);
  border-radius: 12px;
}
.pkt-workspace-card { padding: 14px; }
.pkt-kicker {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--neon-cyan);
}
.pkt-kicker svg { width: 14px; height: 14px; }
.pkt-workspace-card h3 { margin: 6px 0 4px; font-size: 15px; }
.pkt-workspace-card p { margin: 0; font-size: 11px; color: var(--text-dim); }

.pkt-settings-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pkt-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; font-size: 12px; }
.pkt-switch {
  width: 38px; height: 20px;
  border-radius: 12px;
  border: 1px solid var(--window-border);
  background: rgba(255,255,255,0.06);
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
}
.pkt-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-dim);
  transition: transform .15s ease, background .15s ease;
}
.pkt-switch.on { border-color: var(--neon-cyan); background: rgba(0,243,255,0.16); }
.pkt-switch.on::after { transform: translateX(18px); background: var(--neon-cyan); box-shadow: 0 0 6px rgba(0,243,255,0.7); }

.pkt-perf { padding: 12px; }
.pkt-perf-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.pkt-perf-label svg { width: 14px; height: 14px; }
.pkt-perf-modes { display: flex; gap: 6px; }
.pkt-perf-btn {
  flex: 1;
  background: none;
  border: 1px solid var(--window-border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 8px 0;
  font-family: var(--font-retro); font-size: 10px; letter-spacing: 1px;
  cursor: pointer;
}
.pkt-perf-btn.active { background: var(--neon-purple); border-color: var(--neon-purple); color: #fff; }

.pkt-storage { display: flex; align-items: center; gap: 16px; padding: 14px; }
.pkt-storage-donut {
  flex: 0 0 auto;
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: bold;
  background: conic-gradient(rgba(255,255,255,0.08) 0deg, rgba(255,255,255,0.08) 0deg);
  position: relative;
}
.pkt-storage-donut::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--window-bg); }
.pkt-storage-donut span { position: relative; z-index: 1; }
.pkt-storage-body { min-width: 0; }
.pkt-storage-body p { margin: 0; font-size: 10px; color: var(--text-dim); }
.pkt-storage-body strong { font-size: 20px; }
.pkt-storage-size { margin-top: 2px !important; }

.pkt-desktop-card {
  display: block; width: 100%; text-align: left;
  padding: 14px;
  color: inherit; font-family: inherit;
  cursor: pointer;
}
.pkt-desktop-card strong { display: block; font-size: 14px; margin: 4px 0; }
.pkt-desktop-card p { margin: 0; font-size: 11px; color: var(--text-dim); }

/* Eco performance mode: strip blur/backdrop-filter and heavy shadows so a
   low-power device isn't paying for effects it can't render smoothly. */
.pocket-shell[data-perf="eco"] .pkt-nav,
.pocket-shell[data-perf="eco"] .pkt-playbar { backdrop-filter: none; }
.pocket-shell[data-perf="eco"] .pkt-continue-card,
.pocket-shell[data-perf="eco"] .pkt-featured { box-shadow: none; }

/* ------------------------------ Small screens ---------------------------- */
@media (max-width: 340px) {
  .pkt-grid { grid-template-columns: repeat(2, 1fr); }
  .pkt-tools { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .pocket-shell * { transition: none !important; animation: none !important; }
}
