body[data-theme] {
  --wall: radial-gradient(ellipse at 21% 9%, #345a73 0, transparent 42%),
    radial-gradient(ellipse at 79% 4%, #242e61 0, transparent 53%),
    radial-gradient(ellipse at 88% 68%, #16576a 0, transparent 58%), #10192a;
  --wall-ink: #f3f8ff;
  --glass: #09152757;
  --glass-line: #f3f8ff36;
  background: var(--wall) fixed;
  color: var(--wall-ink);
  font-family: "Inter", "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
}
body[data-theme="forest"] { --wall: radial-gradient(ellipse at 78% 15%, #31655b, transparent 65%), radial-gradient(ellipse at 15% 0%, #315641, transparent 64%), #102b29; }
body[data-theme="sunset"] { --wall: radial-gradient(ellipse at 70% 6%, #904b49, transparent 62%), radial-gradient(ellipse at 12% 8%, #904823, transparent 57%), #311e35; }
body[data-theme="lavender"] { --wall: radial-gradient(ellipse at 76% 7%, #66599c, transparent 63%), radial-gradient(ellipse at 10% 7%, #413566, transparent 58%), #25233f; }
body[data-theme="oat"], body[data-theme="slate"], body[data-theme="rose"] {
  --wall-ink: #20283a; --glass: #fff7; --glass-line: #2938552b;
}
body[data-theme="oat"] { --wall: radial-gradient(ellipse at 75% 8%, #edd8b7, transparent 70%), #f9f5ee; }
body[data-theme="slate"] { --wall: radial-gradient(ellipse at 75% 8%, #b6c9d9, transparent 70%), #e8eef4; }
body[data-theme="rose"] { --wall: radial-gradient(ellipse at 75% 8%, #e6bed0, transparent 70%), #f7ecf0; }
body[data-theme="custom"] {
  --wall: var(--custom-page); --wall-ink: var(--custom-page-ink);
  --glass: color-mix(in srgb, var(--wall-ink) 9%, transparent);
  --glass-line: color-mix(in srgb, var(--wall-ink) 25%, transparent);
}
body[data-theme="photo"] { --wall: #10192a; }
body[data-theme="photo"] .app-shell { background: #111a2d78; }
body[data-theme] .app-shell { display: grid; grid-template-columns: 70px minmax(0, 1fr); min-height: 100dvh; }
body[data-theme] .sidebar {
  z-index: 5; display: flex; align-items: center; gap: 18px; padding: 18px 7px 10px;
  height: 100dvh; overflow: visible; border: 0; border-right: 1px solid var(--glass-line);
  color: var(--wall-ink); background: var(--glass); backdrop-filter: blur(18px);
}
body[data-theme="custom"] .sidebar { background: var(--custom-sidebar); color: var(--custom-sidebar-ink); }
.rail-brand {
  width: 42px; height: 42px; padding: 0; border: 1px solid #ffffff65; background: #e53847; color: white;
  font: 800 15px "Inter", sans-serif; cursor: pointer; flex: none;
}
.sidebar > nav, .rail-bottom { width: 100%; display: grid; gap: 6px; }
.sidebar > nav {
  flex: 0 1 auto; min-height: 0;
  grid-template-rows: auto auto auto minmax(0, auto) auto;
}
.rail-bottom { margin-top: auto; flex: none; }
.rail-button {
  width: 100%; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 4px 0; border: 0; border-radius: 12px; background: transparent; color: inherit;
  font: inherit; font-size: 11px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.rail-button > span { font-size: 23px; line-height: 1; }
.rail-button:is(:hover, [aria-pressed="true"], .active), .category-disclosure[open] > .rail-button {
  background: color-mix(in srgb, currentColor 15%, transparent);
}
.rail-button::-webkit-details-marker { display: none; }
.sidebar .category-disclosure { border: 0; padding: 0; }
.rail-panel {
  position: absolute; top: min(140px, 19dvh); left: calc(100% + 10px); width: min(290px, calc(100vw - 100px));
  max-height: calc(100dvh - min(140px, 19dvh) - 24px); overflow: auto; padding: 12px;
  background: #f8fafc; color: #22324b; border-radius: 16px; border: 1px solid #dae3ef;
  box-shadow: 0 18px 55px #07162b55;
}
.rail-panel .category-group-label { display: flex; }
.rail-panel-heading { padding: 6px 8px 10px; font-weight: 700; font-size: 14px; }
.rail-panel-heading span { float: right; color: #536887; }
body[data-theme="custom"] .sidebar .rail-panel :is(.category-btn:not(.active), .disclosure-heading, .disclosure-count, .category-btn:not(.active) .category-count) { color: #293e5b; }
body[data-theme] .topbar {
  position: relative; display: flex; justify-content: space-between; gap: 12px;
  min-height: 67px; padding: 12px clamp(18px, 4vw, 64px); background: transparent; border: 0;
}
body[data-theme="custom"] .topbar { background: var(--custom-topbar); color: var(--custom-topbar-ink); }
.topbar h1 { margin: 0; font-size: 16px; font-weight: 650; }
body[data-theme] .topbar .top-btn {
  font-size: 12px; padding: 7px 12px; background: var(--glass); color: inherit; border: 1px solid var(--glass-line);
}
body[data-theme] .topbar .manage-btn { background: #f2f7ff; color: #172944; border-color: #dbe7fb; }
.launcher, .library { position: relative; width: min(calc(100% - 64px), var(--tile-width, 980px)); margin: 0 auto; }
.launcher { padding-top: clamp(34px, 7vh, 88px); }
.library-view .launcher { padding-top: 24px; }
.home-clock { text-align: center; margin-bottom: clamp(22px, 4vh, 38px); }
.clock-line { display: flex; justify-content: center; align-items: baseline; gap: 10px; }
.clock-line time {
  font-family: "Inter", "Segoe UI", sans-serif; font-size: clamp(62px, 10vw, 114px); font-weight: 300;
  font-variant-numeric: tabular-nums; letter-spacing: -.07em; line-height: .99;
}
.clock-line span { font-size: clamp(12px, 2vw, 19px); }
.home-clock p { font-size: 14px; letter-spacing: .12em; margin: 14px 0 0; }
body[data-theme] .launcher .search-box {
  width: min(100%, 620px); max-width: none; height: 54px; margin: 0 auto; gap: 11px; padding: 0 18px;
  background: #f7fbff; color: #182842; border: 1px solid #edf5ffb0; border-radius: 999px; box-shadow: 0 12px 38px #0b14252b;
}
.launcher .search-box input { color: #182842; }
.home-widgets { padding: 22px 0 46px; }
.home-weather {
  display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; align-items: center; gap: 12px;
  margin: 0 auto 24px; padding: 8px 18px; border: 1px solid var(--glass-line); border-radius: 16px; background: var(--glass);
}
.weather-glyph, #weatherTemp { font-size: 26px; line-height: 1; }
.weather-text { font-size: 13px; line-height: 1.6; }
.weather-text a { color: inherit; margin-left: 4px; font-size: 10px; text-decoration: underline; }
.weather-text small { font-size: 11px; }
.launcher-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
.launcher-heading h2, .content-heading h2 { font-size: 16px; font-weight: 650; margin: 0; }
.launcher-link {
  padding: 5px 9px; border: 1px solid var(--glass-line); border-radius: 8px;
  background: var(--glass); color: inherit; font-size: 12px; cursor: pointer;
}
.launcher-link:hover { background: color-mix(in srgb, currentColor 18%, transparent); }
.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(var(--card-width, 206px), var(--card-column-width, 0px), calc(var(--tile-size, 58px) + 84px))), 1fr));
  gap: var(--tile-gap, 22px);
}
#homeShortcuts { margin-top: var(--tile-gap, 22px); }
.desktop-grid:not(:has(> :not([hidden]))) + #homeShortcuts { margin-top: 0; }
.launcher-tile { position: relative; min-width: 0; }
.tile-launch {
  --card-paint: color-mix(in srgb, #000 var(--card-shade, 0%), var(--card-color, #fff));
  --card-contrast: #16273d;
  --card-contrast: oklch(from var(--card-paint) clamp(.18, calc((.59 - l) * 22), .98) 0 0);
  color: var(--card-ink, var(--card-contrast)); cursor: pointer; text-decoration: none;
  background: color-mix(in srgb, var(--card-paint) var(--card-opacity, 90%), transparent);
  border: 1px solid var(--glass-line);
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: var(--card-height, 86px);
  padding: 9px; border-radius: var(--card-radius, 16px); text-align: left;
}
.launcher-tile .tile-launch { height: 100%; padding-right: 29px; }
.tile-launch:hover { border-color: var(--theme-accent); }
.tile-copy { display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; min-width: 0; gap: 4px; }
.tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-description {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere; font-size: 12px; line-height: 1.45; opacity: .8;
}
.tile-launch .tool-icon {
  width: var(--tile-size); height: var(--tile-size); flex: 0 0 var(--tile-size);
  border-radius: var(--tile-radius); opacity: var(--tile-opacity);
  font-size: calc(var(--tile-size) * .29); box-shadow: 0 8px 18px #09142545; transition: transform .18s ease;
}
.tile-launch .tool-icon img { width: 59%; height: 59%; }
.tile-launch .logo-fallback { background: linear-gradient(145deg, var(--accent), #1a2446); }
.tile-launch:hover .tool-icon { transform: translateY(-3px); }
.tile-name { display: block; font-size: var(--tile-labelSize, 13px); font-weight: 700; line-height: 1.4; }
.hide-tile-names .tile-name { display: none; }
.tile-detail {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  display: grid; place-items: center; width: 22px; height: 26px; padding: 0;
  border: 0; border-radius: 7px; background: #e8eef7; color: #273953;
  cursor: pointer; font-size: 13px;
}
.tile-detail:hover { background: #cfddef; }
.tile-add .tool-icon { background: var(--glass); border: 1px dashed var(--glass-line); color: inherit; font-size: 26px; }
.home-news { margin-top: 48px; scroll-margin-top: 20px; }
.home-news .launcher-heading h2 { font-size: 22px; }
.news-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.home-news .news-filters { margin: 0 0 14px; }
.news-filters button {
  padding: 5px 10px; border: 1px solid var(--glass-line); border-radius: 999px;
  background: var(--glass); color: inherit; font-size: 12px; cursor: pointer;
}
.news-filters button[aria-pressed="true"] { background: #dceafb; color: #173a68; border-color: transparent; }
.news-status { margin: 0 0 12px; font-size: 13px; }
.news-status:empty { display: none; }
.news-featured { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.news-featured article, .news-list {
  min-width: 0; border: 1px solid var(--glass-line); border-radius: 16px; background: var(--glass);
}
.news-featured article { padding: 15px 17px; }
.news-featured article:first-child {
  grid-column: 1 / -1; padding: clamp(18px, 3vw, 34px);
  background: linear-gradient(122deg, #14284c, #274f68 68%, #236e6b); color: #fff;
}
.news-featured h3 { margin: 8px 0 0; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.news-featured article:first-child h3 { font-size: clamp(19px, 3vw, 28px); }
.news-stories a { color: inherit; text-decoration: none; }
.news-stories a:hover { text-decoration: underline; }
.news-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; opacity: .88; }
.news-meta time { white-space: nowrap; }
.news-list { margin: 14px 0 0; padding: 4px 16px 4px 40px; }
.news-list li { padding: 10px 0; font-size: 14px; overflow-wrap: anywhere; }
.news-list li + li { border-top: 1px solid var(--glass-line); }
.news-list li::marker { font-size: 11px; }
.news-list li .news-meta { margin-top: 4px; }
body[data-theme] .library .toolbar-row, body[data-theme] .library .content-wrap { padding-inline: 0; }
body[data-theme] .library :is(.content-heading h2, .content-heading p, .sort-box label) { color: var(--wall-ink); }
body[data-theme] .library .content-heading p { font-size: 13px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.library .empty-state { color: #22324b; background: #f2f7ff; padding: 24px; border-radius: 16px; }
.theme-dialog {
  inset: 10px 10px 10px auto; margin: 0; width: min(450px, calc(100% - 20px));
  height: calc(100% - 20px); max-height: none; background: #f8fafc;
}
.appearance-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.appearance-tabs button {
  border: 1px solid #dce5f2; background: white; color: #2e415c; border-radius: 9px;
  padding: 7px 9px; cursor: pointer;
}
.appearance-tabs button[aria-pressed="true"] { background: #e5f0ff; color: #1b54a4; border-color: #bfd7fb; }
.appearance-panel { min-width: 0; display: grid; gap: 10px; margin: 8px 0 0; padding: 12px; border: 1px solid #dce5f2; border-radius: 12px; }
.appearance-panel legend { font-weight: 700; }
.appearance-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.appearance-toggle { display: flex; align-items: center; gap: 6px; }
.appearance-range { display: grid; grid-template-columns: minmax(98px, auto) minmax(55px, 1fr) 49px; align-items: center; gap: 8px; }
.appearance-range input { width: 100%; min-width: 0; margin: 0; }
.appearance-range output { font-size: 11px; text-align: right; }


@media (max-width: 700px) {
  body[data-theme] .app-shell { grid-template-columns: 49px minmax(0, 1fr); }
  body[data-theme] .sidebar { position: sticky; padding: 12px 3px 8px; gap: 12px; }
  .rail-brand { width: 36px; height: 36px; }
  .rail-panel { left: calc(100% + 6px); width: min(275px, calc(100vw - 64px)); }
  body[data-theme] .topbar { padding: 10px 13px; align-items: flex-start; }
  .topbar h1 { font-size: 14px; padding-top: 6px; }
  body[data-theme] .topbar .top-btn { font-size: 10px; padding: 5px 7px; }
  .launcher, .library { width: calc(100% - 24px); }
  .launcher { padding-top: 28px; }
  .clock-line time { font-size: clamp(41px, 10vw, 66px); }
  body[data-theme] .launcher .search-box { height: 45px; padding-inline: 10px; }
  body[data-theme] .launcher .search-box input { font-size: 14px; }

  .home-news { margin-top: 32px; }
  .news-featured { grid-template-columns: minmax(0, 1fr); }
}
@media (max-height: 410px) {
  body[data-theme] .sidebar { gap: 4px; padding-block: 4px; }
  .rail-button { min-height: 34px; }
  .rail-button > span { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .tile-launch .tool-icon, .tile-detail { transition: none; } }

/* Desktop widgets and grouped launcher */
body[data-theme="ocean"] {
  --wall: radial-gradient(ellipse at 11% 91%, #966041 0, transparent 39%),
    radial-gradient(ellipse at 86% 17%, #386c72 0, transparent 48%),
    radial-gradient(ellipse at 36% 6%, #495988 0, transparent 49%), #101724;
}
body[data-palette="light"]:not([data-theme="custom"], [data-theme="photo"]) {
  --wall: radial-gradient(ellipse at 82% 7%, #d7eaff, transparent 62%), #f4f4f9;
  --wall-ink: #1b2b42; --glass: #fff9; --glass-line: #253d6333;
}
body[data-palette="dark"]:not([data-theme="custom"], [data-theme="photo"]) {
  --wall: radial-gradient(ellipse at 82% 7%, #324b67, transparent 64%), #111a2a;
  --wall-ink: #f3f8ff; --glass: #09152765; --glass-line: #f3f8ff36;
}
body.with-wallpaper[data-theme] {
  --wall-ink: #fff;
  --glass: #09152775;
  --glass-line: #f3f8ff44;
}
body.with-wallpaper[data-theme] .app-shell {
  position: relative;
  background: color-mix(in srgb, #0d1626 var(--desk-wall-shade), transparent);
}
body.with-wallpaper .home-clock { text-shadow: 0 1px 5px #08101eeb; }
body[data-theme] .app-shell { grid-template-columns: var(--desk-rail-width, 66px) minmax(0, 1fr); }
body[data-rail-side="right"] .app-shell { grid-template-columns: minmax(0, 1fr) var(--desk-rail-width, 66px); }
body[data-rail-side="right"] .sidebar { grid-column: 2; grid-row: 1; border-left: 1px solid var(--glass-line); border-right: 0; }
body[data-rail-side="right"] .main-area { grid-column: 1; grid-row: 1; }
body[data-rail-side="right"] .rail-panel { left: auto; right: calc(100% + 8px); }
body[data-theme]:not([data-theme="custom"]) .sidebar {
  background: color-mix(in srgb, var(--glass) var(--desk-rail-opacity, 56%), transparent);
}
@media (hover: hover) and (min-width: 701px) {
  body.rail-auto[data-theme] .sidebar { transition: transform .16s ease; }
  body.rail-auto[data-theme] .sidebar:not(:hover,:focus-within,:has(details[open])) { transform: translateX(calc(-100% + 11px)); }
  body.rail-auto[data-rail-side="right"] .sidebar:not(:hover,:focus-within,:has(details[open])) { transform: translateX(calc(100% - 11px)); clip-path: inset(0 0 0 0); }
  body.rail-auto[data-rail-side="right"] .app-shell { overflow-x: clip; }
}
.rail-groups { min-height: 0; overflow: auto; overscroll-behavior-y: contain; display: grid; gap: 4px; }
.rail-button .rail-group-icon { max-width: 100%; overflow: hidden; font-size: clamp(14px, calc(var(--desk-rail-width, 66px) / 3.2), 23px); }
@media (max-width: 700px) { .rail-button .rail-group-icon { font-size: 16px; } }
.group-disclosure-icon { flex: none; width: 24px; overflow: hidden; white-space: nowrap; text-align: center; }
.rail-button .rail-group-icon.compact-nav-icon { font-size: 12px; }
:is(.group-disclosure-icon, .category-icon).compact-nav-icon { font-size: 8px; line-height: 1; }
.rail-button .rail-caption { font-size: 11px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#newsJump { text-decoration: none; }
body[data-theme] .launcher .search-box {
  height: var(--desk-search-height); border-radius: var(--desk-search-radius);
  background: color-mix(in srgb, #f7fbff var(--desk-search-opacity), transparent);
  backdrop-filter: blur(16px);
}
.clock-line { margin: auto; border: 0; padding: 0 4px; background: none; color: var(--desk-clock); cursor: pointer; }
.clock-line time {
  font: var(--desk-clock-weight) min(var(--desk-clock-size), 13vw) / 1 var(--desk-clock-font);
  letter-spacing: -.07em;
}
.home-clock { margin-bottom: 25px; }
.home-clock p { margin-top: 10px; }
.home-widgets { padding-top: 32px; container-type: inline-size; }
.desktop-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.desktop-grid {
  --desktop-cell: calc(var(--tile-size) + 11px);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--desktop-cell)), 1fr));
  gap: 13px min(var(--tile-gap), 20px); grid-auto-flow: dense;
  grid-auto-rows: minmax(calc(var(--tile-size) + 26px), auto);
  align-items: start;
}

.desktop-widget {
  grid-column: span 2; grid-row: span 2; min-width: 0; height: 100%; min-height: 154px;
  display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 17px;
  border: 1px solid #ffffff34; box-shadow: 0 9px 22px #07142528; color: #172941;
}
.desktop-widget header { font-size: 13px; font-weight: 650; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.desktop-widget small { font-size: 11px; line-height: 1.45; }
.desktop-grid .home-weather { width: auto; max-width: none; margin: 0; align-items: stretch; background: linear-gradient(145deg,#214777,#3675b1); color: #fff; }
.home-weather a, .toolbox-widget a { color: inherit; }
.home-weather header a { font-size: 11px; }
.weather-reading { display: flex; align-items: center; justify-content: space-between; flex: 1; gap: 3px; }
.weather-reading #weatherTemp { font-size: clamp(24px, 4vw, 42px); }
.calendar-widget { text-align: center; align-items: center; background: #fff8ef; cursor: pointer; }
#calendarMonth { background: #de5262; color: white; margin: -14px -14px 0; width: calc(100% + 28px); padding: 8px 2px; border-radius: 16px 16px 0 0; font-weight: 650; }
#calendarDay { font-size: clamp(30px, 5vw, 56px); line-height: 1.08; flex: 1; }
#calendarLunar { font-size: 11px; }
.toolbox-widget { background: #f3f7fe; }
.toolbox-widget > div { display: grid; gap: 7px; margin: auto 0; }
.toolbox-widget a { padding: 7px 8px; background: #e0ecfe; color: #17467f; border-radius: 8px; font-size: 12px; text-decoration: none; }
.toolbox-widget a:hover { text-decoration: underline; }
.desktop-grid .work-widget { grid-column: span 4; }
.wallpaper-widget {
  position: relative; isolation: isolate; overflow: hidden; justify-content: space-between;
  text-align: left; color: white; cursor: pointer;
  background: radial-gradient(ellipse at 86% 10%, #9d81cf, transparent 65%), linear-gradient(155deg, #28366c, #24495d);
}
.wallpaper-widget img, .wallpaper-widget::before { position: absolute; inset: 0; width: 100%; height: 100%; }
.wallpaper-widget img { object-fit: cover; z-index: -2; }
.wallpaper-widget::before { content: ""; background: linear-gradient(#121f3955, #0e1c38a6); z-index: -1; }
.wallpaper-widget-title { font-weight: 700; font-size: 13px; }
.wallpaper-widget-action {
  align-self: flex-start; border: 1px solid #ffffff68; border-radius: 8px; padding: 5px 7px;
  background: #111d3c99; color: white; font-size: 11px;
}
.wallpaper-widget:hover .wallpaper-widget-action { background: #344f7b; }
.news-widget { grid-column: span 4; min-height: 154px; color: white; background: #172537e0; backdrop-filter: blur(16px); }
.news-widget a { color: inherit; }
.news-widget header a { font-size: 11px; }
.news-widget .news-filters button { padding: 3px 7px; font-size: 11px; }
.news-widget ol {
  margin: 0; padding: 0 5px 0 19px; min-width: 0; max-height: 7em; line-height: 1.75;
  font-size: 12px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.news-widget li { min-width: 0; }
.news-widget li::marker { color: #b4caec; }
.news-widget li a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.news-widget li a:hover { text-decoration: underline; }
#desktopNewsStatus:empty { display: none; }
.work-widget { background: var(--work-background, #f7f8fa); color: var(--work-ink, #202631); }
#homeWork { cursor: pointer; container-type: inline-size; }
.work-card-body { display: flex; gap: 8px; align-items: center; flex: 1; }
.work-card-reading { flex: 1; min-width: 0; }
.work-card-reading .work-stats { margin-top: 7px; }
.work-cat {
  display: grid; place-items: center; flex: 0 0 clamp(48px, 22%, 94px); min-width: 0;
  min-height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer;
}
.work-cat img { width: 100%; height: auto; max-height: 112px; object-fit: contain; transition: transform .18s ease; }
.work-cat:hover img, .work-cat:focus-visible img { transform: rotate(-5deg) translateY(-2px); }
.work-cat:active img { transform: scale(.9); }
.work-cat-message { font-size: 11px; min-height: 1.45em; }
@container (max-width: 245px) {
  .work-card-body { position: relative; display: block; }
  .work-card-reading #workTime { padding-right: 51px; }
  .work-cat { position: absolute; top: -8px; right: 0; width: 45px; }
  .work-cat img { max-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .work-cat img { transition: none; }
}
#workSettings { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 12px; padding: 3px 5px; }
#workSettings:hover { text-decoration: underline; }
.work-stats { display: flex; flex-wrap: wrap; gap: 5px; }
.work-stats > div {
  display: flex; flex: 1 1 49px; flex-direction: column; gap: 3px; min-width: 0;
  padding: 6px 5px; border-radius: 7px; background: color-mix(in srgb, currentColor 8%, transparent);
  text-align: center; overflow-wrap: anywhere;
}
.work-stats span { font-size: 11px; }
.work-stats strong { font-size: 13px; font-variant-numeric: tabular-nums; }
#workTime, [data-work-time] {
  font-size: clamp(24px, 3.5vw, 39px); letter-spacing: -.04em; line-height: 1.1;
  font-variant-numeric: tabular-nums; margin: auto 0;
}
.work-preview {
  display: grid; gap: 8px; padding: 13px;
  border-radius: 14px; border: 1px solid #dae4ef;
}
.work-preview-label { font-weight: 650; font-size: 13px; }
.work-section { min-width: 0; margin: 0; padding: 10px; border: 1px solid #dbe5f2; border-radius: 10px; }
.work-section legend { padding: 0 5px; font-size: 13px; font-weight: 650; }
.work-days { display: flex; flex-wrap: wrap; gap: 7px 10px; margin-bottom: 8px; font-size: 12px; }
.work-days label { display: flex; align-items: center; gap: 3px; }
.work-mascot-settings { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 10px; }
.work-mascot-settings img { width: 72px; height: 82px; object-fit: contain; }
.work-gif-controls { display: grid; gap: 5px; min-width: 0; font-size: 13px; }
.work-gif-controls input { min-width: 0; max-width: 100%; }
.work-gif-controls button { justify-self: start; }
#workGifStatus:empty { display: none; }
.work-break { margin: 8px 0; font-size: 12px; }
.work-break summary { cursor: pointer; }
.work-break .work-inputs { margin-top: 7px; }
.rail-brand, .profile-preview { overflow: hidden; border-radius: 50%; }
:is(.rail-brand, .profile-preview):has(> img:not([hidden])) { background: transparent; border: 0; }
.rail-brand img, .profile-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.category-group-admin { margin-bottom: 18px; }
.category-group-admin h3 { margin: 0 0 10px; font-size: 16px; }
.group-order-actions { display: flex; gap: 5px; }
.group-admin-row .category-icon { background: #eef3ff; color: #376bd2; overflow: hidden; white-space: nowrap; }
.navigation-icon-dialog { width: min(420px, calc(100% - 24px)); }
.navigation-icon-dialog h2 { overflow-wrap: anywhere; }
.navigation-icon-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.navigation-icon-choices button { min-width: 40px; min-height: 38px; }
#navigationIconNote { color: #a12626; }
#navigationIconNote:empty { display: none; }
.category-admin-row { flex-wrap: wrap; }
.category-admin-row strong { overflow-wrap: anywhere; }
.category-admin-row button:disabled { opacity: .52; cursor: default; }
.category-move { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.category-move select { width: auto; max-width: min(26vw, 170px); }
.category-add select { flex: 1; min-width: min(100%, 170px); }
.profile-dialog { width: min(380px, calc(100% - 24px)); }
.profile-preview { display: grid; place-items: center; width: 78px; height: 78px; margin: 2px auto 6px; background: #e53847; color: white; font-size: 25px; font-weight: 800; }
#profileHint { color: #405976; overflow-wrap: anywhere; }
#profileHint:empty { display: none; }
.tile-launch .tool-icon, .folder-preview { border-radius: var(--desk-radius, var(--tile-radius)); }
.tile-name { color: var(--desk-label, inherit); }
.folder-preview {
  width: var(--tile-size); height: var(--tile-size); flex: none; padding: 6px;
  display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);
  gap: 3px; place-items: center; background: #f4f9ff50; border: 1px solid #ffffff55;
}
.folder-tile .folder-preview .tool-icon { width: 100%; height: 100%; border-radius: 5px; font-size: 8px; box-shadow: none; }
.desktop-dialog {
  color: #1a2c46; background: #f8fafc; width: min(540px, calc(100% - 24px)); padding: 18px;
  border: 1px solid #dbe5f2; border-radius: 20px; max-height: 88dvh;

}
.desktop-dialog::backdrop { background: #09162691; backdrop-filter: blur(5px); }
.desktop-dialog header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.desktop-dialog h2 { margin: 0; font-size: 19px; }
.desktop-dialog header button { font-size: 21px; border: 0; background: transparent; cursor: pointer; }
.desktop-dialog form { display: grid; gap: 9px; }
.desktop-dialog p { margin: 3px 0; font-size: 12px; line-height: 1.5; }
#folderTiles { padding: 16px 0; --wall-ink: #1a2c46; }
.folder-empty { grid-column: 1 / -1; }
#folderChoices { max-height: min(40vh, 290px); overflow: auto; background: white; border: 1px solid #d9e4f2; border-radius: 10px; padding: 4px 8px; }
#folderChoices label { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 3px; border-bottom: 1px solid #edf2f8; font-size: 13px; }
#folderChoices small { color: #526780; text-align: right; }
.calendar-controls { display: flex; justify-content: space-between; margin: 12px 0; }
.calendar-controls button { border: 1px solid #dbe5f2; border-radius: 8px; background: white; color: inherit; padding: 5px 10px; cursor: pointer; }
#calendarGrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
#calendarGrid span { padding: 7px 0; border-radius: 7px; }
.calendar-weekday { color: #596d88; font-size: 12px; }
.calendar-cell[aria-current="date"] { background: #1759a8; color: white; font-weight: 700; }
.desktop-dialog.work-dialog { padding: 0; overflow: hidden; max-height: min(760px, calc(100dvh - 24px)); }
#workForm { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 0; max-height: inherit; }
#workForm > header { padding: 14px 16px 8px; }
.work-dialog-content {
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 10px;
  min-height: 0; overflow-y: auto; padding: 4px 16px 12px;
}
.work-dialog-actions { display: grid; gap: 6px; padding: 10px 16px; border-top: 1px solid #dbe5f2; background: inherit; }
.work-dialog-actions button { min-width: 88px; }
.work-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.work-inputs label { display: grid; align-content: start; justify-items: start; gap: 4px; font-size: 13px; }
.work-inputs .form-input { min-width: 0; }
#workError { color: #a32030; }
#workError:empty { display: none; }
@media (max-width: 360px) { .work-inputs { grid-template-columns: minmax(0, 1fr); } }

.theme-dialog { width: min(520px, calc(100% - 20px)); padding: 18px; }
.theme-dialog::backdrop { background: transparent; backdrop-filter: none; }
.appearance-card-options { display: grid; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid #dce5f2; }
@media (min-width: 900px) {
  body { --appearance-width: min(520px, 46vw); }
  .theme-dialog { width: var(--appearance-width); }
  body:has(.theme-dialog[open]) #navApp { margin-right: calc(var(--appearance-width) + 10px); }
}
@media (max-width: 899px) {
  .theme-dialog { inset: auto 10px 10px; width: auto; height: min(63dvh, 580px); }
  body:has(.theme-dialog[open] #iconAppearance:not([hidden])) :is(.home-clock, #globalSearch, .desktop-grid, .home-news, .library .toolbar-row) { display: none; }
  body:has(.theme-dialog[open] #iconAppearance:not([hidden])) .launcher { padding-top: 0; }
}
.theme-dialog form { grid-template-columns: 128px minmax(0, 1fr); align-content: start; gap: 12px; }
.theme-dialog :is(h2, .appearance-footer) { grid-column: 1 / -1; }
.appearance-footer {
  position: sticky; z-index: 1; bottom: -18px; display: grid; gap: 6px;
  margin: 0 -18px -18px; padding: 10px 18px 14px; background: #f8fafc;
  border-top: 1px solid #dce5f2;
}
.appearance-footer #themeHint:empty { display: none; }
body[data-palette="dark"] .appearance-footer { background: #192334; border-color: #45546b; }
.theme-dialog .appearance-tabs { display: flex; flex-direction: column; align-items: stretch; }
.appearance-tabs button { text-align: left; }
.appearance-body { min-width: 0; }
.appearance-panel { margin-top: 0; background: #fff; }
.appearance-panel label:has(select) { display: grid; gap: 4px; }
.appearance-color { display: flex; justify-content: space-between; align-items: center; }
.appearance-color input { width: 40px; height: 28px; padding: 2px; }
.key-list { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 9px; font-size: 13px; }
.key-list dd { margin: 0; }
body[data-palette="dark"] .theme-dialog { background: #192334; color: #eef5ff; border-color: #45546b; }
body[data-palette="dark"] .appearance-panel { background: #222e42; border-color: #45546b; }
body[data-palette="dark"] .theme-dialog p { color: #c7d3e4; }
@media(max-width:700px) {
  body[data-theme] .app-shell { grid-template-columns: min(var(--desk-rail-width, 66px), 56px) minmax(0, 1fr); }
  body[data-rail-side="right"] .app-shell { grid-template-columns: minmax(0, 1fr) min(var(--desk-rail-width, 66px), 56px); }
  .desktop-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--desktop-cell)), 1fr)); column-gap: 8px; }
  .desktop-widget { grid-row: auto; min-height: 126px; }
  .topbar h1 { max-width: 92px; }
}
@media (max-width: 560px), (min-width: 900px) and (max-width: 1080px) {
  .theme-dialog form { grid-template-columns: minmax(0, 1fr); }
  .theme-dialog .appearance-tabs { flex-direction: row; }
}
@media(max-width:480px) {
  .theme-dialog { padding: 12px; }
  .appearance-footer { bottom: -12px; margin: 0 -12px -12px; padding: 8px 12px 12px; }
}
@media(max-width:380px) {
  .desktop-widget { grid-column: 1 / -1; }
}

.wallpaper-settings {
  min-width: 0; display: grid; gap: 9px; margin: 5px 0 0; padding: 10px;
  border: 1px solid #dbe5f2; border-radius: 12px;
}
.wallpaper-preview {
  position: relative; min-height: 98px; aspect-ratio: 2.3; display: grid; place-items: center;
  overflow: hidden; border-radius: 10px; background: #e6edf7; color: #354d6c;
}
.wallpaper-preview:has(img:not([hidden]))::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; background: #0d1626; opacity: var(--preview-shade, 0);
}
.wallpaper-preview img {
  position: absolute; width: 100%; height: 100%; object-fit: cover;
  filter: blur(var(--preview-blur, 0)); transform: scale(1.06);
}
.wallpaper-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wallpaper-picker { padding: 7px 10px; border-radius: 8px; background: #e5f0ff; color: #174a89; cursor: pointer; }
.wallpaper-actions:focus-within .wallpaper-picker { outline: 2px solid #2861ac; outline-offset: 2px; }
#themePhoto { position: absolute; width: 1px; height: 1px; opacity: 0; }
#themeBlurValue { font-size: 11px; text-align: right; }
#themeHint { overflow-wrap: anywhere; }
@container (min-width: 700px) {
  .desktop-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@container (min-width: 1060px) {
  .desktop-grid { grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 13px min(var(--tile-gap), 12px); }
}
@container (max-width: 699px) {
  .desktop-grid :is(.work-widget, .news-widget) { grid-column: 1 / -1; }
}