/**
 * 主桌面 — 毛玻璃 + 天气条 + 分页滑动 + 底部导航
 */

#view-desktop.view-desktop {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: #f7f7f7;
}

#view-desktop .desktop-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#view-desktop .desktop-float-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

#view-desktop .desktop-float-top > * {
  pointer-events: auto;
}

#view-desktop .desktop-float-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  padding: 0 14px calc(16px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

#view-desktop .desktop-float-bottom > * {
  pointer-events: auto;
}

#view-desktop .desktop-pages-viewport {
  position: absolute;
  inset: 0;
  padding-top: var(--desktop-top-inset, 132px);
  padding-bottom: var(--desktop-bottom-inset, 96px);
  overflow: hidden;
  touch-action: pan-y;
}

#view-desktop .desktop-pages-track {
  display: flex;
  height: 100%;
  will-change: transform;
}

#view-desktop .desktop-page {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 4px 14px 8px;
  overflow: hidden;
}

#view-desktop .desktop-page-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

#view-desktop .desktop-page-dot {
  pointer-events: auto;
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(120, 120, 120, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

#view-desktop .desktop-page-dot.is-active {
  background: rgba(80, 80, 80, 0.78);
  transform: scale(1.15);
}

html.silas-standalone #app-root,
html.silas-standalone #main-app.silas-phone-root,
html.silas-standalone #view-desktop.view-desktop {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

@media (display-mode: standalone) {
  #app-root,
  #main-app.silas-phone-root,
  #view-desktop.view-desktop {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }
}

#view-desktop .desktop-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.desktop-glass-surface {
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(16px) saturate(1.12);
  -webkit-backdrop-filter: blur(16px) saturate(1.12);
  border: 1px solid rgba(255, 255, 255, 0.48);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.42),
    0 8px 22px rgba(0, 0, 0, 0.07);
}

.desktop-status-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  padding: 0 4px;
}

.desktop-battery {
  width: 72px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  overflow: hidden;
}

.desktop-battery-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(180, 220, 160, 0.95), rgba(140, 200, 130, 0.95));
  transition: width 0.4s ease;
}

.desktop-clock {
  font-family: 'Outfit', 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: rgba(80, 80, 80, 0.85);
  font-weight: 400;
}

.desktop-settings-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(60, 60, 60, 0.88);
  line-height: 1;
}

.desktop-settings-btn:active {
  transform: scale(0.97);
}

/* 顶部天气组件 */
.desktop-weather {
  flex-shrink: 0;
  width: calc(100% + 8px);
  margin-left: -4px;
  margin-right: -4px;
  min-height: 78px;
  border-radius: 24px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-sizing: border-box;
}

.desktop-weather-icon {
  flex-shrink: 0;
  font-size: 2.1rem;
  line-height: 1;
}

.desktop-weather-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.desktop-weather-line1,
.desktop-weather-line2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.desktop-weather-city {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}

.desktop-weather-temp {
  font-family: 'Outfit', 'DM Sans', sans-serif;
  font-size: 1.45rem;
  font-weight: 500;
  color: #222;
  letter-spacing: -0.02em;
}

.desktop-weather-label {
  font-size: 0.88rem;
  color: rgba(80, 80, 80, 0.92);
}

.desktop-weather-range {
  font-size: 0.82rem;
  color: rgba(100, 100, 100, 0.88);
  white-space: nowrap;
}

.desktop-weather-tip {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: rgba(90, 90, 90, 0.82);
  line-height: 1.35;
}

/* 第二页：天气详情 */
.desktop-weather-detail {
  height: 100%;
  border-radius: 24px;
  padding: 22px 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.desktop-weather-detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.desktop-weather-detail-icon {
  font-size: 3.2rem;
  line-height: 1;
}

.desktop-weather-detail-temp {
  font-family: 'Outfit', 'DM Sans', sans-serif;
  font-size: 2.4rem;
  font-weight: 500;
  color: #222;
  line-height: 1.1;
}

.desktop-weather-detail-label {
  margin-top: 4px;
  font-size: 1rem;
  color: rgba(80, 80, 80, 0.92);
}

.desktop-weather-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.desktop-weather-detail-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.desktop-weather-detail-k {
  display: block;
  font-size: 0.72rem;
  color: rgba(100, 100, 100, 0.85);
  margin-bottom: 4px;
}

.desktop-weather-detail-v {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
}

.desktop-weather-detail-tip {
  margin: auto 0 0;
  padding-top: 8px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(70, 70, 70, 0.9);
}

/* 中间：音乐圆钮 + 见面 + 装饰图 */
.desktop-mid-row {
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.desktop-app-column {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(2, 88px);
  gap: 12px;
  margin-top: 8px;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-content: start;
  justify-items: center;
}

.desktop-app-column--float {
  position: absolute;
  left: 14px;
  top: 4px;
  z-index: 12;
  margin-top: 0;
  max-height: min(42vh, 280px);
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.desktop-page {
  position: relative;
}

.desktop-draggable-app {
  touch-action: none;
  user-select: none;
}

.desktop-app-dragging {
  z-index: 50;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  opacity: 0.92;
}

body.desktop-icon-dragging .desktop-pages-viewport {
  touch-action: none;
}

.desktop-mid-left {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.desktop-music-circle {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 2rem;
  color: #222;
  line-height: 1;
}

.desktop-music-circle:active {
  transform: scale(0.97);
}

.desktop-meeting-circle {
  width: 88px;
  min-height: 88px;
  padding: 10px 8px 12px;
  border-radius: 22px;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ui-accent-btn-hot, #c2185b);
}

.desktop-meeting-circle:active {
  transform: scale(0.97);
}

.desktop-meeting-heart {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--ui-accent-heart, #e91e8c);
  text-shadow: 0 2px 8px color-mix(in srgb, var(--ui-accent-heart, #e91e8c) 25%, transparent);
}

.desktop-meeting-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.04em;
}

.desktop-deco-panel {
  flex: 1;
  min-width: 0;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  user-select: none;
  -webkit-user-select: none;
}

.desktop-deco-panel.has-image {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

.desktop-deco-panel.has-image::before {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(28px) saturate(1.15);
  -webkit-backdrop-filter: blur(28px) saturate(1.15);
  background: transparent;
  pointer-events: none;
}

.desktop-deco-panel.has-image.desktop-glass-surface {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.desktop-deco-menu {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 1.25rem;
  line-height: 1;
  color: #444;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.desktop-deco-popover {
  position: absolute;
  top: 52px;
  right: 10px;
  z-index: 4;
  min-width: 120px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.desktop-deco-popover button {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  color: #333;
}

.desktop-deco-popover button:active {
  background: rgba(239, 191, 214, 0.35);
}

.desktop-deco-heart {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  font-size: 3.5rem;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 1;
}

/* 底部导航 */
.desktop-bottom-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
  min-height: 68px;
  padding: 10px 8px;
  border-radius: 24px;
  box-sizing: border-box;
}

.desktop-nav-btn {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #222;
  font-size: 0.58rem;
}

.desktop-nav-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.desktop-bottom-nav .desktop-nav-btn > span:last-child {
  font-size: 0.7rem;
}

.desktop-nav-btn:active {
  opacity: 0.7;
}

#main-app.desktop-active > .silas-phone-top,
#main-app.desktop-active > .app-header-stack {
  display: none !important;
}

#main-app.desktop-active > .view:not(#view-desktop) {
  visibility: hidden !important;
  pointer-events: none !important;
}

#main-app:not(.desktop-active) > .view:not(.hidden) {
  visibility: visible !important;
  pointer-events: auto !important;
}

#main-app.desktop-active #view-desktop {
  display: flex !important;
}

#app-root:has(#main-app.desktop-active:not(.hidden)) {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}

#main-app.silas-phone-root.desktop-active {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}

html:has(#main-app.desktop-active:not(.hidden)),
body:has(#main-app.desktop-active:not(.hidden)) {
  background: #f7f7f7 !important;
}

#main-app:not(.desktop-active) #view-desktop {
  display: none !important;
}

#main-app.moments-active > .silas-phone-top {
  display: none !important;
}

#main-app.music-active > .silas-phone-top,
#main-app.music-active > .app-header-stack {
  display: none !important;
}

#main-app.music-active > .silas-home-fab {
  z-index: 20;
}

#main-app.contacts-active > .silas-phone-top,
#main-app.contacts-active > .app-header-stack,
#main-app.favorites-active > .silas-phone-top,
#main-app.favorites-active > .app-header-stack,
#main-app.reading-active > .silas-phone-top,
#main-app.reading-active > .app-header-stack {
  display: none !important;
}

#main-app.learning-active > .silas-phone-top,
#main-app.learning-active > .app-header-stack {
  display: none !important;
}

/* 第三页：使用统计 */
.desktop-stats-panel {
  height: 100%;
  border-radius: 24px;
  padding: 18px 18px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.desktop-stats-clock-block {
  text-align: center;
  padding: 6px 0 2px;
}

.desktop-stats-time {
  display: block;
  font-family: 'Outfit', 'DM Sans', sans-serif;
  font-size: 2.6rem;
  font-weight: 500;
  color: #222;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.desktop-stats-date {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: rgba(80, 80, 80, 0.9);
}

.desktop-stats-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.desktop-stats-section-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(90, 90, 90, 0.88);
  text-transform: uppercase;
}

.desktop-stats-reading,
.desktop-stats-usage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.desktop-stats-reading-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.desktop-stats-reading-label {
  font-size: 0.72rem;
  color: rgba(100, 100, 100, 0.85);
}

.desktop-stats-reading-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: #222;
  line-height: 1.35;
}

.desktop-stats-reading-meta {
  font-size: 0.82rem;
  color: rgba(90, 90, 90, 0.9);
}

.desktop-stats-reading-bar {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.desktop-stats-reading-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(120, 140, 180, 0.75), rgba(90, 110, 160, 0.9));
}

.desktop-stats-reading-total,
.desktop-stats-reading-empty,
.desktop-stats-usage-empty {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: rgba(90, 90, 90, 0.88);
  line-height: 1.4;
}

.desktop-stats-usage-row {
  display: grid;
  grid-template-columns: 4.2em 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.desktop-stats-usage-row + .desktop-stats-usage-row {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.desktop-stats-usage-label {
  font-size: 0.82rem;
  color: #333;
}

.desktop-stats-usage-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.07);
  overflow: hidden;
}

.desktop-stats-usage-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: rgba(100, 120, 170, 0.55);
}

.desktop-stats-usage-time {
  font-size: 0.78rem;
  color: rgba(80, 80, 80, 0.92);
  white-space: nowrap;
}

.desktop-stats-usage-toggle {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  color: #444;
  font-size: 0.8rem;
  cursor: pointer;
}

.desktop-stats-usage-week {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.desktop-stats-usage-week-day + .desktop-stats-usage-week-day {
  margin-top: 8px;
}

.desktop-stats-usage-week-head {
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.desktop-stats-usage-row--sub {
  grid-template-columns: 1fr auto;
  padding: 3px 0;
  border-top: none;
}
