/* Reference desktop framework: frosted glass surfaces, compact four-column pages. */
.screen {
  grid-template-rows: 28px minmax(0, 1fr);
  padding: 0;
  background: var(--screen-wallpaper, linear-gradient(135deg, #e4e6eb 0%, #f2f3f7 100%));
  background-position: center;
  background-size: cover;
}

.status-bar {
  min-height: 28px;
  padding: 0 24px;
  color: #222;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.desktop-pager {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y;
}

.desktop-track {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  transform: translate3d(0, 0, 0);
  transition: transform .32s cubic-bezier(.2, .84, .26, 1);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.desktop-track.desktop-swiping { transition: none; }

.desktop-page {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.desktop-page::-webkit-scrollbar { display: none; }

.desktop-grid {
  --framework-row-height: 82px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: var(--framework-row-height);
  grid-auto-flow: row;
  align-content: start;
  align-items: stretch;
  gap: 20px 16px;
  width: min(100%, 420px);
  min-height: 100%;
  margin-inline: auto;
  padding: 28px 20px 132px;
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.desktop-pagination {
  position: absolute;
  right: 0;
  bottom: 125px;
  left: 0;
  z-index: 4;
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.desktop-pagination-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .14);
  transition: transform .2s ease, background .2s ease;
}

.desktop-pagination-dot.active { background: #111; transform: scale(1.2); }

.desktop-widget,
.app-button,
.dock-button {
  min-width: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.desktop-widget-surface,
.app-icon,
.dock {
  border-top: 1.5px solid rgba(255, 255, 255, .9);
  border-left: 1.5px solid rgba(255, 255, 255, .9);
  border-right: .5px solid rgba(255, 255, 255, .1);
  border-bottom: .5px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .45);
  box-shadow: 6px 6px 18px rgba(0,0,0,.05), -2px -2px 10px rgba(255,255,255,.7) inset, 4px 4px 10px rgba(0,0,0,.03) inset;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.time-media-widget {
  display: flex;
  flex-direction: column;
  grid-column: 1 / -1;
  grid-row: span 3;
  min-height: 0;
  padding: 18px 20px;
  gap: 16px;
  overflow: hidden;
  border-radius: 24px;
}

.time-block-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  gap: 10px;
}

.replaced-header { display: inline-flex; align-items: center; gap: 6px; }
.breathing-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #888;
  box-shadow: 0 0 6px rgba(0,0,0,.2);
  animation: framework-breathe 2s ease-in-out infinite;
}
.nexa-text { color: #444; font-size: 14px; font-weight: 500; letter-spacing: .5px; }
.time-and-seconds-wrapper { display: flex; align-items: flex-end; gap: 4px; min-width: 0; }
.big-time {
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 52px;
  font-variant-numeric: tabular-nums;
  font-weight: 300;
  line-height: 1;
  white-space: nowrap;
}
.seconds-display { margin-bottom: 3px; color: #555; font: 300 18px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
.date-replaced { display: flex; flex-direction: column; align-items: flex-end; color: #555; font-size: 11px; line-height: 1.35; text-align: right; }
.date-replaced span:first-child { color: #333; font-weight: 600; }

.photo-record-wrapper {
  display: flex;
  flex: 1;
  align-items: center;
  min-height: 0;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 18px;
  background: rgba(255,255,255,.35);
  box-shadow: inset 2px 2px 5px rgba(255,255,255,.8), inset -1px -1px 4px rgba(0,0,0,.02), 0 3px 8px rgba(0,0,0,.03);
}
.replaced-col-1,
.replaced-col-2 { flex: 1; min-width: 0; }
.replaced-col-1 { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.widget-image-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: #888;
  border: 1.5px solid rgba(255,255,255,.8);
  background: rgba(0,0,0,.025);
  cursor: pointer;
}
.widget-image-button img { position: absolute; inset: 0; z-index: 2; display: block; width: 100%; height: 100%; object-fit: cover; }
.widget-image-placeholder { position: relative; z-index: 1; width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.widget-image-button.has-photo .widget-image-placeholder { display: none; }
.hero-photo-button { width: 100%; height: 100%; min-height: 108px; border-radius: 14px; }
.editable-name { max-width: 100%; padding: 2px 6px; overflow: hidden; color: #333; border-radius: 4px; font-size: 13px; font-weight: 500; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.editable-name[contenteditable="true"] { background: rgba(0,0,0,.05); outline: none; }

.record-player { position: relative; width: min(100%, 164px); aspect-ratio: 1; margin-inline: auto; }
.record-player::after { content: ""; position: absolute; top: calc(50% - 5px); left: calc(50% - 5px); z-index: 5; width: 10px; height: 10px; border: 1px solid #aaa; border-radius: 50%; background: radial-gradient(circle, #fcfcfc, #a8a8a8 40%, #555); box-shadow: 0 2px 4px rgba(0,0,0,.3), inset 0 1px 2px rgba(255,255,255,.9); pointer-events: none; }
.record-disc {
  position: absolute;
  inset: 0;
  border: 1.5px solid rgba(255,255,255,.8);
  border-radius: 50%;
  background: conic-gradient(from 45deg, rgba(255,255,255,0) 0deg, rgba(255,255,255,.7) 20deg, rgba(255,255,255,0) 40deg, transparent 80deg, rgba(255,255,255,.7) 180deg, transparent 240deg), rgba(255,255,255,.22);
  box-shadow: 0 6px 14px rgba(0,0,0,.08), inset 0 0 16px rgba(255,255,255,.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: framework-record-spin 8s linear infinite;
}
.record-center-cover { position: absolute; top: 22%; left: 22%; z-index: 3; width: 56%; height: 56%; border-radius: 50%; background: rgba(253,253,253,.85); box-shadow: 0 2px 8px rgba(0,0,0,.1), inset 0 0 4px rgba(255,255,255,1); }
.record-center-cover .widget-image-placeholder { width: 22px; height: 22px; }
.tone-arm { position: absolute; top: -2%; right: -4%; z-index: 4; width: 48%; height: 5%; border: 1px solid rgba(255,255,255,.6); border-radius: 4px; background: linear-gradient(to bottom,#d4d4d4,#fff 30%,#a3a3a3 70%,#d4d4d4); box-shadow: -2px 4px 6px rgba(0,0,0,.25); transform: rotate(30deg); transform-origin: 85% 50%; pointer-events: none; }
.tone-arm::before { content: ""; position: absolute; top: calc(50% - 6px); left: -10px; width: 15px; height: 12px; border: 1px solid #444; border-radius: 2px; background: linear-gradient(135deg,#333,#111); box-shadow: -2px 3px 5px rgba(0,0,0,.4); transform: rotate(-15deg); }
.tone-arm::after { content: ""; position: absolute; top: calc(50% - 9px); right: 5%; width: 18px; height: 18px; border: 1px solid #777; border-radius: 50%; background: radial-gradient(circle,#e0e0e0,#999 70%,#444); box-shadow: 0 3px 6px rgba(0,0,0,.3); }

.cd-widget,
.capsule-widget,
.call-photo-widget { grid-column: span 2; grid-row: span 2; min-height: 0; border-radius: 24px; }
.cd-widget { display: flex; flex-direction: column; padding: 14px; gap: 10px; overflow: hidden; }
.cd-widget-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cd-widget-text { display: flex; flex-direction: column; min-width: 0; }
.cd-widget-text strong { color: #222; font-size: 15px; line-height: 1.2; }
.cd-widget-text span { color: #888; font-size: 11px; font-weight: 500; }
.battery-widget-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; background: conic-gradient(#111 0%,#e0e0e0 0%); box-shadow: 0 2px 5px rgba(0,0,0,.1), inset 0 0 2px rgba(255,255,255,1); }
.battery-widget-inner { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg,#f8f9fa,#e9ecef); box-shadow: inset 1px 1px 3px rgba(255,255,255,1), inset -1px -1px 3px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.15); }
.battery-widget-inner svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.cd-widget-body { position: relative; display: flex; flex: 1; align-items: center; min-height: 0; margin-top: 4px; }
.cd-widget-image { position: absolute; left: 0; z-index: 2; width: 85px; height: 85px; border-radius: 10px; box-shadow: 2px 0 10px rgba(0,0,0,.08); }
.cd-widget-image .widget-image-placeholder { width: 22px; height: 22px; }
.cd-widget-disc { position: absolute; left: 60px; z-index: 1; display: grid; place-items: center; width: 75px; height: 75px; clip-path: inset(0 0 0 40%); border-radius: 50%; background: conic-gradient(from 180deg,#d8d8d8,#f9f9f9,#bfbfbf,#f9f9f9,#d8d8d8,#f9f9f9,#bfbfbf,#f9f9f9,#d8d8d8); }
.cd-widget-disc::after { content: ""; width: 16px; height: 16px; border: 2.5px solid #eaeaea; border-radius: 50%; background: rgba(255,255,255,.5); box-shadow: inset 1px 1px 2px rgba(0,0,0,.1); }

.capsule-widget { position: relative; display: flex; align-items: flex-start; align-self: start; justify-content: space-between; width: 100%; height: 160px; gap: 8px; padding: 0 4px; border-radius: 0; }
.capsule-item { position: relative; width: 31%; height: 100%; min-height: 120px; border-radius: 60px; background: rgba(255,255,255,.6); box-shadow: 4px 4px 12px rgba(0,0,0,.05), -2px -2px 8px rgba(255,255,255,.8) inset, 2px 2px 6px rgba(0,0,0,.02) inset; }
.capsule-one { margin-top: 30px; height: 130px; }
.capsule-two { margin-top: 0; }
.capsule-three { margin-top: 15px; height: 140px; }
.capsule-item .widget-image-placeholder { width: 24px; height: 24px; }

.call-photo-widget { position: relative; display: flex; flex-direction: column; padding: 12px; overflow: hidden; }
.call-widget-image { width: 100%; flex: 1; min-height: 120px; border-radius: 14px; box-shadow: inset 1px 1px 3px rgba(0,0,0,.05); }
.call-widget-image .widget-image-placeholder { width: 38px; height: 38px; }
.call-widget-copy { position: absolute; top: 12px; left: 14px; z-index: 4; display: flex; flex-direction: column; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.35); }
.call-widget-copy strong { font-size: 15px; }
.call-widget-copy span { font-size: 11px; opacity: .86; }
.call-widget-buttons { position: absolute; right: 0; bottom: 12px; left: 0; z-index: 5; display: flex; justify-content: space-between; padding-inline: 16px; pointer-events: none; }
.call-action { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; color: #fff; cursor: pointer; pointer-events: auto; box-shadow: 0 4px 10px rgba(0,0,0,.15), inset 0 0 4px rgba(255,255,255,.3); transition: transform .15s ease; }
.call-action svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.call-decline { background: linear-gradient(135deg,#ff4d4f,#d9363e); transform: rotate(135deg); }
.call-answer { background: linear-gradient(135deg,#52c41a,#389e0d); }
.call-decline:active { transform: rotate(135deg) scale(.92); }
.call-answer:active { transform: scale(.92); }
.call-action:disabled { cursor: default; opacity: .65; }
.call-widget-status,
.weather-widget-status { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.weather-dashboard-card { position: relative; display: flex; flex-direction: column; grid-column: 1 / -1; grid-row: span 1; min-height: 0; padding: 14px 16px; gap: 8px; overflow: hidden; color: #111; border-radius: 24px; }
.weather-dashboard-top { display: flex; align-items: center; justify-content: space-between; min-height: 22px; gap: 10px; }
.weather-location-button { display: inline-flex; align-items: center; gap: 3px; min-width: 0; color: #222; cursor: pointer; }
.weather-location-button span { max-width: 130px; overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.weather-location-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.weather-current-text { min-width: 0; overflow: hidden; color: #444; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.weather-forecast { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); min-width: 0; min-height: 0; border-top: 1px solid rgba(17,17,17,.1); }
.weather-forecast-item { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; gap: 2px; padding: 4px 3px 0; }
.weather-forecast-item + .weather-forecast-item { border-left: 1px solid rgba(17,17,17,.08); }
.weather-forecast-condition { display: flex; flex-direction: column; align-items: center; min-width: 0; gap: 1px; color: #222; }
.weather-forecast-condition > span { max-width: 100%; overflow: hidden; font-size: 9px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.weather-forecast-icon { width: 19px; height: 19px; color: rgba(20,23,27,.82); }
.weather-forecast-values { display: flex; flex-direction: column; align-items: center; gap: 1px; color: #666; font-size: 9px; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.weather-forecast-values strong { color: #111; font-size: 10px; font-weight: 600; }
.weather-dashboard-card[data-weather-state="loading"] .weather-forecast { opacity: .62; }
.weather-dashboard-card[data-weather-state="error"] .weather-forecast-condition,
.weather-dashboard-card[data-weather-state="error"] .weather-forecast-values strong { color: #9e2f2f; }
.weather-icon-library,
.desktop-icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-button { display: grid; justify-items: center; align-content: start; gap: 8px; min-height: var(--framework-row-height); cursor: pointer; outline: none; }
.app-icon { position: relative; display: grid; place-items: center; width: 55px; height: 55px; overflow: hidden; border-radius: 18px; padding: 2px; transition: transform .15s ease, box-shadow .15s ease; }
.app-icon::before { content: none; }
.app-icon img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 15px; }
.app-button span:last-child { max-width: 84px; min-height: 16px; overflow-wrap: anywhere; color: #333; text-align: center; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 12px; font-weight: 500; line-height: 1.3; }
.app-button:active .app-icon { transform: scale(.92); }
.app-button:focus-visible .app-icon,
.dock-button:focus-visible .dock-icon,
.widget-image-button:focus-visible,
.weather-location-button:focus-visible { outline: 2px solid rgba(0,0,0,.42); outline-offset: 3px; }

.dock {
  position: absolute;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 96px;
  min-height: 96px;
  margin: 0;
  padding: 0 10px;
  border-radius: 30px;
}
.dock::before,
.dock::after { content: none; }
.dock-button { position: relative; display: grid; justify-items: center; gap: 0; cursor: pointer; }
.dock-icon { position: relative; display: grid; place-items: center; width: 60px; height: 60px; overflow: hidden; border: 0; border-radius: 18px; background: transparent; }
.dock-icon img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.dock-button span:not(.dock-icon) { display: none; }
.dock-button:active .dock-icon { transform: scale(.92); }

.screen.desktop-editing .desktop-widget,
.screen.desktop-editing .app-button,
.screen.desktop-editing .dock-button { cursor: grab; animation: framework-jiggle .16s ease-in-out infinite alternate; }
.screen.desktop-editing .desktop-widget:nth-child(even),
.screen.desktop-editing .app-button:nth-child(even),
.screen.desktop-editing .dock-button:nth-child(even) { animation-delay: -.08s; }
.desktop-pressing { transform: scale(.97); transition: transform .12s ease; }
.desktop-dragging { cursor: grabbing; opacity: .98; filter: drop-shadow(0 16px 22px rgba(0,0,0,.18)); animation: none !important; }
html .screen.app-icon-border-disabled .app-button .app-icon,
html .screen.app-icon-border-disabled .desktop-widget-surface {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.desktop-drag-placeholder { align-self: stretch; min-height: 82px; border: 1px dashed rgba(0,0,0,.26); border-radius: 18px; background: rgba(255,255,255,.3); opacity: .72; }
.desktop-grid > .desktop-drag-placeholder[data-placeholder-id^="widget-"] { grid-column: span 2; grid-row: span 2; }
.desktop-grid > .desktop-drag-placeholder[data-placeholder-id="widget-time-media"],
.desktop-grid > .desktop-drag-placeholder[data-placeholder-id="widget-weather-dashboard"] { grid-column: 1 / -1; grid-row: span 1; }
.desktop-grid > .desktop-drag-placeholder[data-placeholder-id="widget-time-media"] { grid-row: span 3; }
.dock > .desktop-drag-placeholder { min-width: 58px; min-height: 60px; border-radius: 18px; }

@keyframes framework-record-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes framework-breathe { 0%,100% { opacity: .3; box-shadow: 0 0 4px rgba(120,120,120,.2); } 50% { opacity: 1; box-shadow: 0 0 10px rgba(170,170,170,.5); } }
@keyframes framework-jiggle { from { transform: rotate(-.7deg) translateY(-1px); } to { transform: rotate(.7deg) translateY(1px); } }

@media (max-width: 460px) {
  .desktop-grid { --framework-row-height: 78px; gap: 18px 12px; padding: 20px 20px 132px; }
  .app-icon { width: 55px; height: 55px; }
  .time-media-widget { padding: 16px; gap: 12px; }
  .big-time { font-size: 46px; }
  .photo-record-wrapper { padding: 10px; gap: 10px; }
  .record-player { width: min(100%, 142px); }
  .dock { right: 20px; bottom: 20px; left: 20px; height: 86px; min-height: 86px; }
  .dock-icon { width: 56px; height: 56px; }
  .widget-photo-actions { grid-template-columns: 1fr 1fr; }
  .widget-photo-actions > span { display: none; }
  .widget-photo-actions button:first-child { grid-column: 1 / -1; }
}

@media (max-width: 340px) {
  .big-time { font-size: 40px; }
}

@media (max-height: 740px) {
  .desktop-grid { --framework-row-height: 74px; gap: 16px 12px; padding-top: 16px; }
  .time-media-widget { padding-block: 14px; gap: 10px; }
  .dock { height: 82px; min-height: 82px; bottom: 14px; }
  .desktop-pagination { bottom: 110px; }
}

html.night-mode .screen {
  background: var(--screen-wallpaper, linear-gradient(135deg, #1d2024 0%, #25282d 100%));
  background-position: center;
  background-size: cover;
}

html.night-mode .desktop-widget-surface,
html.night-mode .app-icon,
html.night-mode .dock {
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.12);
  box-shadow: 0 14px 34px rgba(0,0,0,.28), inset 1px 1px 0 rgba(255,255,255,.1), inset -1px -1px 0 rgba(0,0,0,.16);
}

html.night-mode .desktop-grid,
html.night-mode .big-time,
html.night-mode .nexa-text,
html.night-mode .date-replaced,
html.night-mode .weather-dashboard-card,
html.night-mode .weather-location-button,
html.night-mode .weather-current-text,
html.night-mode .cd-widget-text strong,
html.night-mode .app-button span:last-child { color: #f4f1eb; }

html.night-mode .weather-forecast-item + .weather-forecast-item { border-left-color: rgba(255,255,255,.1); }
html.night-mode .weather-forecast { border-top-color: rgba(255,255,255,.13); }
html.night-mode .weather-forecast-icon { color: rgba(250,249,246,.88); }
html.night-mode .desktop-pagination-dot { background: rgba(255,255,255,.24); }
html.night-mode .desktop-pagination-dot.active { background: #f4f1eb; }

@media (prefers-reduced-motion: reduce) {
  .breathing-led,
  .record-disc { animation: none; }
}
