:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; height: 100dvh; margin: 0; overflow: hidden; -webkit-text-size-adjust: 100%; }
button, a { font: inherit; }
button { color: inherit; }

.desktop {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 540px;
  overflow: hidden;
  isolation: isolate;
  background: #11151d;
}

.wallpapers, .wallpaper, .desktop-vignette { position: absolute; inset: 0; }
.wallpapers { z-index: -3; }
.wallpaper {
  background-position: center;
  background-size: cover;
  opacity: 0;
  transform: scale(1.08);
  animation: wallpaperCycle 27s infinite ease-in-out;
}
.wallpaper-1 { background-image: url("/images/bg01.jpg"); animation-delay: 0s; }
.wallpaper-2 { background-image: url("/images/bg02.jpg"); animation-delay: 9s; }
.wallpaper-3 { background-image: url("/images/bg03.jpg"); animation-delay: 18s; }
.wallpapers.paused .wallpaper { animation: none; opacity: 0; transform: scale(1); transition: opacity .5s; }
.wallpapers.paused .wallpaper.chosen { opacity: 1; }
.desktop-vignette {
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4,7,12,.18), transparent 35%, rgba(4,7,12,.26)), radial-gradient(circle at 50% 45%, transparent 12%, rgba(5,8,14,.32) 120%);
}

@keyframes wallpaperCycle {
  0% { opacity: 0; transform: scale(1.08); }
  5%, 31% { opacity: 1; }
  36%, 100% { opacity: 0; }
  18% { transform: scale(1); }
}

.menubar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px 0 7px;
  color: #fff;
  background: rgba(10,14,21,.47);
  border-bottom: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 1px 5px rgba(0,0,0,.12);
  font-size: 13px;
  text-shadow: 0 1px 2px rgba(0,0,0,.34);
  user-select: none;
}

.menu-left, .menu-right { display: flex; align-items: center; height: 100%; }
.menu-left { gap: 1px; }
.menu-right { gap: 13px; font-size: 12px; }
.menu-group { position: relative; height: 100%; display: flex; align-items: center; }
.menu-trigger {
  height: 27px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: default;
  font-weight: 500;
}
.directory-trigger { font-weight: 700; }
.menu-trigger:hover, .menu-group.open > .menu-trigger { background: rgba(255,255,255,.18); }
.brand-trigger { width: 31px; padding: 0; display: grid; place-items: center; }
.brand-trigger img { width: 20px; height: 20px; border-radius: 5px; object-fit: cover; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }

.menu-dropdown {
  position: absolute;
  top: 31px;
  left: 0;
  z-index: 60;
  display: none;
  width: max-content;
  min-width: 225px;
  max-width: min(330px, calc(100vw - 16px));
  padding: 6px;
  border: 1px solid rgba(255,255,255,.46);
  border-radius: 9px;
  color: #1d2530;
  background: rgba(246,248,252,.86);
  backdrop-filter: blur(30px) saturate(170%);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  box-shadow: 0 18px 46px rgba(0,0,0,.31), inset 0 1px rgba(255,255,255,.55);
  text-shadow: none;
  transform-origin: top left;
  animation: menuIn .12s ease-out;
}
.menu-group.open > .menu-dropdown { display: block; }
.menu-dropdown.align-right { left: auto; right: 0; }
.menu-dropdown a, .menu-dropdown button {
  width: 100%;
  min-height: 27px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 4px 9px;
  border: 0;
  border-radius: 5px;
  color: #202733;
  background: transparent;
  text-align: left;
  text-decoration: none;
  cursor: default;
  white-space: nowrap;
}
.menu-dropdown a:hover, .menu-dropdown button:hover, .menu-dropdown a:focus-visible, .menu-dropdown button:focus-visible {
  outline: none;
  color: #fff;
  background: #1677f2;
}
.menu-dropdown [role="menuitemradio"]::before, .menu-dropdown [role="menuitemcheckbox"]::before { content: ""; width: 12px; flex: 0 0 12px; }
.menu-dropdown [aria-checked="true"]::before { content: "✓"; }
.menu-dropdown kbd { margin-left: auto; color: #687381; font: 12px inherit; }
.menu-dropdown a:hover kbd, .menu-dropdown button:hover kbd { color: #fff; }
.menu-separator { height: 1px; margin: 5px 7px; background: rgba(53,63,77,.17); }
.menu-note { display: block; padding: 5px 9px; color: #7a8491; font-size: 12px; }
.brand-card { display: flex; align-items: center; gap: 12px; padding: 8px 9px 10px; }
.brand-card img { width: 46px; height: 46px; border-radius: 11px; object-fit: cover; box-shadow: 0 3px 9px rgba(0,0,0,.18); }
.brand-card div { display: flex; flex-direction: column; gap: 3px; }
.brand-card strong { font-size: 14px; }
.brand-card span { color: #687381; font-size: 11px; }
.category-menu { max-height: min(455px, calc(100vh - 48px)); overflow: auto; }
.category-menu .count { margin-left: 26px; color: #788390; font-size: 11px; }
.category-menu a:hover .count { color: rgba(255,255,255,.78); }

@keyframes menuIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

.wifi { width: 17px; height: 13px; border: 2px solid transparent; border-top-color: #fff; border-radius: 50%; position: relative; }
.wifi::after { content: ""; position: absolute; left: 4px; top: 3px; width: 5px; height: 5px; border: 2px solid transparent; border-top-color: #fff; border-radius: 50%; }
.battery { position: relative; width: 23px; height: 11px; padding: 1.5px; border: 1.4px solid rgba(255,255,255,.9); border-radius: 3px; }
.battery::after { content: ""; position: absolute; right: -3px; top: 3px; width: 2px; height: 4px; border-radius: 0 2px 2px 0; background: #fff; }
.battery i { display: block; width: 100%; height: 100%; border-radius: 1px; background: #fff; }

.desktop-quote {
  position: absolute;
  left: clamp(32px, 6vw, 100px);
  top: 50%;
  z-index: 4;
  width: min(620px, calc(100vw - 260px));
  padding: 0;
  color: #fff;
  transform: translateY(-58%);
  text-shadow: 0 2px 12px rgba(0,0,0,.8), 0 1px 3px rgba(0,0,0,.65);
  opacity: 1;
  transition: opacity .22s ease;
}
.desktop-quote.is-loading { opacity: 0; }
.desktop-quote::before { content: "“"; display: block; height: 45px; margin-left: -8px; font: 74px/1 Georgia, serif; opacity: .72; }
.desktop-quote p { margin: 0; font: 500 clamp(27px, 3.3vw, 52px)/1.35 Georgia, "Songti SC", "STSong", serif; letter-spacing: .03em; transition: opacity .2s; }
.quote-meta { width: 100%; min-width: 0; display: flex; align-items: center; flex-wrap: nowrap; gap: 10px; margin-top: 17px; font-size: 13px; letter-spacing: .08em; opacity: .82; overflow: visible; }
#quote-from { display: block; flex: 0 0 auto; width: auto; max-width: none; white-space: nowrap; overflow: visible; }
.quote-meta button { width: 26px; height: 26px; border: 1px solid rgba(255,255,255,.32); border-radius: 50%; color: #fff; background: rgba(20,25,34,.2); cursor: pointer; backdrop-filter: blur(10px); transition: transform .2s, background .2s; }
.quote-meta button:hover { transform: rotate(45deg); background: rgba(255,255,255,.2); }

.desktop-icons { position: absolute; right: 18px; top: 54px; z-index: 5; display: grid; grid-auto-flow: column; grid-template-rows: repeat(4, 92px); gap: 10px 16px; transition: opacity .2s, transform .2s; }
.desktop-icons.hidden { opacity: 0; transform: translateX(30px); pointer-events: none; }
.desktop-item { width: 78px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px; border: 0; border-radius: 6px; color: #fff; background: none; text-shadow: 0 1px 3px #000; cursor: pointer; }
.desktop-item:hover, .desktop-item:focus-visible { outline: none; background: rgba(67,123,210,.34); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.desktop-item:active .app-icon { transform: scale(.91); }
.desktop-item .app-icon { width: 54px; height: 54px; }
.desktop-item > span:last-child { max-width: 76px; font-size: 12px; line-height: 14px; text-align: center; }

.app-icon { position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 13px; color: #fff; background: linear-gradient(145deg, var(--c1), var(--c2)); box-shadow: inset 0 1px 1px rgba(255,255,255,.55), inset 0 -1px 2px rgba(0,0,0,.12), 0 6px 14px rgba(0,0,0,.22); transform-origin: center bottom; transition: transform .12s; }
.app-icon::before { content: ""; position: absolute; inset: 1px; border-radius: 12px; background: linear-gradient(150deg, rgba(255,255,255,.28), transparent 48%); }
.app-icon svg { position: relative; width: 62%; height: 62%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0,0,0,.18)); }

.dock { position: absolute; left: 50%; bottom: 8px; z-index: 35; height: 72px; display: flex; align-items: flex-end; gap: 7px; padding: 7px 10px 8px; border: 1px solid rgba(255,255,255,.32); border-radius: 19px; background: rgba(224,231,241,.3); backdrop-filter: blur(26px) saturate(170%); -webkit-backdrop-filter: blur(26px) saturate(170%); box-shadow: 0 12px 30px rgba(0,0,0,.25), inset 0 1px rgba(255,255,255,.25); transform: translateX(-50%); transition: opacity .22s, transform .22s; }
.dock.hidden { opacity: 0; transform: translate(-50%, 95px); pointer-events: none; }
.dock-items { display: flex; align-items: flex-end; gap: 7px; }
.dock-item { position: relative; width: 54px; height: 54px; padding: 0; border: 0; background: none; cursor: pointer; }
.dock-item .dock-icon { width: 54px; height: 54px; display: grid; transition: transform .13s ease-out; }
.dock-item:hover .dock-icon { transform: translateY(-13px) scale(1.3); }
.dock-item:hover::after { content: attr(data-label); position: absolute; left: 50%; bottom: 75px; padding: 5px 9px; border-radius: 6px; color: #fff; background: rgba(25,30,38,.82); box-shadow: 0 4px 12px rgba(0,0,0,.2); transform: translateX(-50%); white-space: nowrap; font-size: 12px; }
.dock-item::before { content: ""; position: absolute; left: 50%; bottom: -5px; width: 4px; height: 4px; border-radius: 50%; background: #111; opacity: .75; transform: translateX(-50%); }
.dock-separator { width: 1px; height: 48px; margin: 0 2px; background: rgba(50,58,69,.35); }
.photo-icon { overflow: hidden; border-radius: 13px; background: #fff; box-shadow: inset 0 1px rgba(255,255,255,.7), 0 6px 14px rgba(0,0,0,.22); }
.photo-icon img { width: 100%; height: 100%; object-fit: cover; }

.toast { position: absolute; left: 50%; bottom: 104px; z-index: 70; padding: 9px 16px; border-radius: 20px; color: #fff; background: rgba(15,20,28,.76); backdrop-filter: blur(18px); opacity: 0; pointer-events: none; transform: translate(-50%,20px); transition: .25s; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 760px) {
  .desktop { min-height: 0; }
  .wallpaper-1 { background-image: url("/images/mobile/bg01.jpg"); }
  .wallpaper-2 { background-image: url("/images/mobile/bg02.jpg"); }
  .wallpaper-3 { background-image: url("/images/mobile/bg03.jpg"); }
  .menubar { height: calc(32px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 9px 0 max(7px, env(safe-area-inset-left)); }
  .menu-trigger { padding: 0 7px; }
  .hide-small { display: none; }
  .menu-right { gap: 8px; }
  .wifi, .battery { display: none; }
  .desktop-quote { left: 22px; top: 38%; width: calc(100vw - 44px); padding-right: 8px; }
  .desktop-quote::before { height: 30px; font-size: 50px; }
  .desktop-quote p { max-width: 92%; font-size: clamp(22px, 6.6vw, 32px); line-height: 1.4; }
  .quote-meta { width: calc(100vw - 52px); margin-top: 11px; padding-right: 4px; font-size: 11px; }
  #quote-from { font-size: 11px; letter-spacing: .04em; }
  .quote-meta button { flex: 0 0 26px; }
  .desktop-icons { top: auto; right: 18px; bottom: calc(82px + env(safe-area-inset-bottom)); left: 18px; width: auto; display: grid; grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 75px); gap: 5px 14px; }
  .desktop-item { width: 100%; min-width: 0; }
  .desktop-item .app-icon { width: 46px; height: 46px; }
  .desktop-item > span:last-child { max-width: 95px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dock { bottom: max(7px, env(safe-area-inset-bottom)); height: 62px; max-width: calc(100vw - 12px - env(safe-area-inset-left) - env(safe-area-inset-right)); gap: 3px; padding: 6px; border-radius: 17px; }
  .dock-items { gap: 4px; }
  .dock-item, .dock-item .dock-icon { width: clamp(40px, 11.7vw, 46px); height: clamp(40px, 11.7vw, 46px); }
  .dock-item:hover .dock-icon { transform: translateY(-8px) scale(1.12); }
  .menu-dropdown { top: calc(31px + env(safe-area-inset-top)); max-height: calc(100dvh - 48px - env(safe-area-inset-top)); overflow: auto; }
}

@media (max-width: 390px) {
  .menu-trigger { padding-inline: 6px; }
  .menu-right { font-size: 11px; }
  .desktop-quote { top: 36%; }
  .desktop-icons { right: 12px; left: 12px; gap-inline: 8px; }
  .dock-items { gap: 3px; }
  .dock-separator { margin-inline: 1px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .wallpaper-1 { opacity: 1; }
}
