:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #30291d;
  background: #fff9e8;
  --muted: #665a43;
  --line: #6a501e24;
  --accent: #805a13;
  --surface: #fffdf6;
  --surface-tint: #faf0d6;
  --highlight: #f9e9b5;
  --page-inset: clamp(22px, 4vw, 120px);
  --header-padding: clamp(18px, 3dvh, 46px);
  --brand-size: 42px;
  --clock-size: clamp(3.4rem, 7.6dvh, 5rem);
  --dock-reserve: calc(clamp(84px, 10dvh, 128px) + env(safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  isolation: isolate;
  min-height: 100dvh;
  margin: 0;
  padding-bottom: var(--dock-reserve);
  background-image:
    radial-gradient(circle, #9d7b3647 1px, transparent 1.2px),
    radial-gradient(ellipse at 8% 18%, #ffdc7a66, transparent 48%),
    radial-gradient(ellipse at 91% 61%, #f4d68059, transparent 48%);
  background-size: 20px 20px, auto, auto;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.symbols, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.page-width { width: calc(100% - 2 * var(--page-inset)); margin-inline: auto; }
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding-block: var(--header-padding);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: var(--brand-size); height: var(--brand-size); object-fit: contain; flex: none; }
.brand h1 { margin: 0; font-size: 1rem; font-weight: 690; letter-spacing: .045em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: .75rem; }
.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-self: end;
  min-width: min(240px, 22vw);
  padding: 8px 10px 8px 13px;
  color: var(--muted);
  font-size: .82rem;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: #fffdf6e8;
}
.search-trigger svg { width: 17px; height: 17px; }
kbd { margin-left: auto; border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; font: inherit; font-size: .72rem; }

.today {
  grid-column: 2;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  color: #3c2b1a;
}
.clock {
  padding: 0 5px 7px 0;
  border-bottom: 1px solid #9c63288a;
  font-family: Baskerville, "Palatino Linotype", Georgia, serif;
  font-size: var(--clock-size);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.052em;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}
.today-date {
  display: grid;
  gap: 4px;
  padding-left: 11px;
  border-left: 1px solid #9c632875;
  white-space: nowrap;
}
.date { font-family: "Songti SC", SimSun, serif; font-size: 1.08rem; font-weight: 540; }
.weekday { color: #995921; font-size: .72rem; font-weight: 540; letter-spacing: .14em; }

.canvas {
  display: grid;
  align-items: center;
  min-height: calc(100dvh - var(--dock-reserve) - 2 * var(--header-padding) - var(--clock-size) - 10px);
  padding-block: 25px 30px;
}

.pond {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.pond-ripples, .fish-track { position: absolute; inset: 0; }
.pond-ripples { width: 100%; height: 100%; }
.fish-track {
  --swim-time: 32s;
  --swim-delay: -7s;
  --route: ellipse(45% 40% at 50% 50%);
}
.fish-track-second {
  --swim-time: 37s;
  --swim-delay: -8s;
  --route: ellipse(39% 42% at 53% 51%);
}
.fish-swim {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(78px, 9vw, 144px);
  offset-path: var(--route);
  animation: pond-swim var(--swim-time) var(--swim-delay) linear infinite;
}
.fish-track-second .fish-swim {
  offset-rotate: auto 180deg;
  animation-direction: reverse;
}
.fish {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 1.9;
  opacity: .91;
  transform-origin: 89% 50%;
}
.fish-body, .fish-tail, .fish-nose { position: absolute; }
.fish-body { inset: 0; width: 100%; height: 100%; }
.fish-tail {
  inset: 0 auto 0 0;
  width: 30.833%;
  height: 100%;
  transform-origin: 88% 50%;
  animation: pond-tail .62s ease-in-out infinite alternate;
}
.fish-track-second .fish-tail { animation-delay: -.35s; }
.fish-nose { top: 50%; left: 94%; }

@keyframes pond-swim {
  to { offset-distance: 100%; }
}
@keyframes pond-tail {
  from { transform: rotate(-13deg) scaleX(.91); }
  to { transform: rotate(13deg); }
}
.favorites {
  --gap: clamp(12px, 2.1vw, 34px);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: center;
  gap: var(--gap);
  width: min(100%, 1200px);
  margin-inline: auto;
  isolation: isolate;
}
.favorites[data-count="1"] { width: min(100%, 550px); }
.favorites[data-count="2"] { width: min(100%, 930px); }
.favorites[data-count="4"] { width: min(100%, clamp(440px, 104dvh, 790px)); }
.favorites:is([data-count="5"], [data-count="6"]) { width: min(100%, clamp(620px, 155dvh, 1150px)); }
.favorites:is([data-count="7"], [data-count="8"]) {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  width: min(100%, clamp(1200px, 170dvh, 1460px));
}

.favorites > li {
  --photo-radius: clamp(9px, 1.2vw, 17px);
  --tilt: -3deg;
  --shift: 0px;
  --drift: -7px;
  position: relative;
  grid-column: span 2;
  transform: translateY(var(--shift)) rotate(var(--tilt));
  animation: photo-float 10s ease-in-out infinite;
  transition: translate .22s ease, scale .22s ease;
}
.favorites > li:nth-child(2n) { --tilt: 3deg; --drift: 6px; animation-delay: -3.3s; animation-duration: 12s; }
.favorites > li:nth-child(3n) { --tilt: 1.8deg; animation-delay: -6.1s; animation-duration: 11s; }
.favorites > li:nth-child(4n) { --tilt: -1.6deg; }
.favorites > li:nth-child(5n) { --tilt: 2.4deg; }
.favorites > li:nth-child(6n) { --tilt: -.8deg; }
.favorites[data-count="1"] > li { grid-column: 1 / -1; --tilt: -2deg; }
.favorites:is([data-count="2"], [data-count="4"]) > li { grid-column: span 3; }
.favorites[data-count="2"] > li:nth-child(2) { --shift: 14px; }
.favorites[data-count="3"] > li:nth-child(2) { --tilt: -1deg; --shift: -16px; z-index: 1; }
.favorites[data-count="3"] > li:nth-child(3) { --tilt: 3deg; --shift: 10px; }
.favorites[data-count="5"] > li:nth-child(4) { grid-column: 2 / span 2; }
.favorites[data-count="5"] > li:nth-child(5) { grid-column: 4 / span 2; }
.favorites[data-count="7"] > li:nth-child(5) { grid-column: 2 / span 2; }
.favorites > li:is(:hover, :focus-within) { z-index: 3; animation-play-state: paused; }
.favorites > li:has(> .photo:is(:hover, :focus-visible)) {
  translate: 0 -3px;
  scale: 1.025;
}
.favorites > li::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 5px 3px 1px;
  border: 1px solid #dfcda0;
  border-radius: var(--photo-radius);
  background: #f2e5c2;
  transform: translate(2px, 4px) rotate(1.5deg);
  pointer-events: none;
}

@keyframes photo-float {
  0%, 100% { transform: translateY(var(--shift)) rotate(var(--tilt)); }
  50% { transform: translateY(calc(var(--shift) + var(--drift))) rotate(calc(var(--tilt) + 1.35deg)); }
}

.photo {
  position: relative;
  display: block;
  padding: clamp(5px, .75vw, 11px);
  border: 1px solid #fff;
  border-radius: var(--photo-radius);
  background: linear-gradient(150deg, #fff, #fcf3dd);
  box-shadow: 0 1px 3px #6147161c, 0 12px 24px #64481420, 0 22px 38px -21px #62471559;
  transition: box-shadow .22s ease;
}
.photo:is(:hover, :focus-visible) {
  box-shadow: 0 14px 32px #64481438, 0 24px 42px -19px #62471559;
}
.photo-image {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: clamp(5px, .8vw, 11px);
  background: #f3e4bd;
}
.photo-art { position: relative; display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-caption {
  display: flex;
  align-items: center;
  gap: clamp(5px, .65vw, 10px);
  min-height: 38px;
  padding: 6px 3px 0;
}
.photo-caption .system-logo { width: clamp(21px, 2vw, 32px); height: auto; aspect-ratio: 1; border-radius: 7px; }
.photo-caption .system-name { font-size: clamp(.78rem, 1.1vw, 1rem); font-weight: 650; }
.photo-caption svg { width: 16px; height: 16px; margin-left: auto; color: var(--accent); }

.shortcut {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 11px;
  min-width: 0;
}
.shortcut:is(:hover, :focus-visible, [data-active]) { background: var(--highlight); }
.shortcut:is(:hover, :focus-visible, [data-active])::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 auto;
  width: min(40%, 230px);
  border-radius: inherit;
  background: var(--shortcut-art, none) var(--shortcut-art-position, center) / cover no-repeat;
  mask-image: linear-gradient(to right, transparent, #000 85%);
  pointer-events: none;
}
.system-logo { width: 42px; height: 42px; flex: none; padding: 3px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: var(--logo-surface, #fff); }
.system-logo-full { padding: 0; border: 0; clip-path: inset(0 round 25%); }
.system-name { font-size: .75rem; font-weight: 570; overflow-wrap: anywhere; line-height: 1.3; }

.close { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.close svg { width: 17px; height: 17px; }

.dock {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: calc(100% - 16px);
  padding: 6px;
  border: 1px solid #ffffffd9;
  border-radius: 24px;
  background: #fff8e2ed;
  backdrop-filter: blur(20px);
  box-shadow: 0 13px 35px #60461426, 0 2px 9px #65491216;
}
.dock button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 11px; border: 0; border-radius: 16px; background: transparent; white-space: nowrap; font-size: .84rem; line-height: 1; }
.dock svg { width: 18px; height: 18px; }
.dock button:hover, .search-trigger:hover, .close:hover { background: var(--highlight); }

dialog {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: inherit;
  background: var(--surface);
  box-shadow: 0 24px 72px #47331333;
}
dialog::backdrop { background: #33271440; backdrop-filter: blur(3px); }
.launcher { margin: min(18dvh, 145px) auto auto; }
.launcher-bar { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.launcher input { flex: 1; min-width: 0; padding: 8px 4px; border: 0; border-radius: 8px; background: transparent; }
.launcher input:focus-visible { outline-color: #b88a20; }
.results { max-height: min(46dvh, 360px); padding: 8px; overflow-y: auto; }
.results .shortcut { gap: 11px; padding: 6px 10px; }
.results .system-logo { width: 34px; height: 34px; border-radius: 9px; }
.results .system-name { font-size: .91rem; }
.empty-results { margin: 0; padding: 20px; color: var(--muted); }
.launcher-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .73rem;
}
.launcher-hints span { display: inline-flex; align-items: center; gap: 5px; }
.launcher-hints kbd, .dock kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin: 0;
  padding: 0 5px;
  border-bottom-width: 2px;
  background: var(--surface-tint);
  color: var(--muted);
  line-height: 1;
}
.library { width: min(890px, calc(100% - 28px)); overflow: hidden; }
.library[open] { display: flex; flex-direction: column; }
.dialog-heading { display: flex; flex: none; align-items: center; justify-content: space-between; padding: 14px 17px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; font-size: 1rem; }
.library-content { min-height: 0; margin-top: 8px; overflow-y: auto; overscroll-behavior-y: contain; scroll-padding-block: 8px; }
.library-section { padding: 14px; }
.library-section:first-child { padding-top: 6px; }
.library-section + .library-section { padding-top: 0; }
.library-section + .library-section::before {
  content: "";
  display: block;
  height: 1px;
  margin-bottom: 13px;
  background: linear-gradient(90deg, var(--line) 70%, transparent);
}
.library-section h3 { margin: 0 0 10px; color: var(--muted); font-size: .89rem; }
.library-count { margin-left: 4px; color: var(--accent); font-size: .8rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.library-grid li { position: relative; min-width: 0; }
.sort-handle {
  position: absolute;
  top: 8px;
  left: 8px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #fffb;
  border-radius: 10px;
  background: #fff7e1f5;
  color: var(--accent);
  cursor: grab;
  touch-action: none;
}
.sort-handle:active { cursor: grabbing; }
.sort-handle svg { width: 18px; height: 18px; }
.library-grid .sort-source { opacity: .28; }
.library-grid .sort-target { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 13px; }
.sort-preview {
  position: fixed;
  z-index: 2;
  pointer-events: none;
  border-radius: 13px;
  box-shadow: 0 14px 32px #33271459, 0 3px 8px #33271433;
  transform: rotate(-2deg);
  transform-origin: 25px 25px;
}
.poster-link {
  position: relative;
  display: block;
  height: 124px;
  overflow: hidden;
  border-radius: 13px;
  background: #f3e4bd;
}
.poster-link:focus-visible { outline-offset: -3px; }
.poster-link .photo-image { height: 100%; aspect-ratio: auto; border-radius: 0; }
.poster-link .photo-art { transition: transform .25s ease; }
.poster-link:hover .photo-art { transform: scale(1.04); }
.poster-link .photo-caption {
  position: absolute;
  inset: auto 0 0;
  gap: 8px;
  padding: 22px 12px 10px;
  color: #fff;
  background: linear-gradient(transparent, #231b13ed);
}
.poster-link .photo-caption .system-logo { width: 30px; height: 30px; border-radius: 8px; }
.poster-link .photo-caption .system-name { font-size: .82rem; }
.poster-link .photo-caption svg { color: inherit; }
.poster-action.text-button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 29px;
  border-color: #fffb;
  border-radius: 18px;
  background: #ffedac;
  color: #69470d;
  font-weight: 630;
}
.poster-action-sign { display: flex; flex: none; }
.poster-action-sign svg { width: 13px; height: 13px; stroke-width: 2.75; }
.poster-action.text-button.poster-action-remove { background: #ffe2df; color: #8b3029; }
.poster-action.text-button[aria-disabled="false"]:hover { background: #ffe18a; }
.poster-action.text-button.poster-action-remove[aria-disabled="false"]:hover { background: #ffc9c3; }
.poster-action.text-button[aria-disabled="true"] {
  opacity: 1;
  color: #626262;
  background: #dedede;
}
.poster-action.text-button.poster-action-remove[aria-disabled="true"] { color: #7c5752; background: #f6eae8; }

.text-button {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--accent);
  font-size: .75rem;
  white-space: nowrap;
}
.text-button:enabled:not([aria-disabled="true"]):hover { background: var(--highlight); }
.text-button:is(:disabled, [aria-disabled="true"]) { opacity: .46; cursor: default; }

@media (max-width: 760px) {
  :root { --page-inset: clamp(16px, 4.5vw, 30px); --header-padding: 17px; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 15px 8px; }
  .today { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .search-trigger { grid-column: 2; grid-row: 1; min-width: 0; padding: 9px; }
  .search-trigger span, .search-trigger kbd { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .canvas { min-height: calc(100dvh - var(--dock-reserve) - 160px); padding-block: 14px 25px; }
  .favorites { grid-template-columns: repeat(4, minmax(0, 1fr)); width: min(100%, 560px); }
  .favorites[data-count] { max-width: 560px; }
  .favorites[data-count="1"] { max-width: 420px; }
  .favorites:is([data-count="2"], [data-count="4"]) > li { grid-column: span 2; }
  .favorites[data-count="3"] > li:nth-child(2) { --shift: 6px; --tilt: 2deg; }
  .favorites[data-count="3"] > li:nth-child(3) { grid-column: 2 / span 2; --shift: 0px; }
  .favorites[data-count="5"] > li:nth-child(4) { grid-column: span 2; }
  .favorites[data-count="5"] > li:nth-child(5) { grid-column: 2 / span 2; }
  .favorites:is([data-count="7"], [data-count="8"]) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .favorites[data-count="7"] > li:nth-child(5) { grid-column: span 2; }
  .favorites[data-count="7"] > li:last-child { grid-column: 2 / span 2; }
  .dock button { padding-inline: 7px; font-size: .77rem; }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .poster-link { height: 106px; }
  .poster-link .photo-caption { gap: 5px; padding-inline: 7px; }
  .poster-link .photo-caption .system-name { font-size: .72rem; }
  .poster-link .photo-caption .system-logo { width: 24px; height: 24px; }
}

@media (max-width: 360px) {
  .sort-handle { left: 5px; }
  .poster-action.text-button { right: 5px; gap: 3px; padding-inline: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .pond { display: none; }
  .favorites > li { animation: none; transition: none; }
  .photo, .poster-link .photo-art { transition: none; }
  .sort-preview { transform: none; }
}
