:root,
html[data-theme="dark"] {
  --text: #1c2430;
  --text-dim: rgba(28, 36, 48, 0.62);
  --accent: #5b93c9;
  --danger: #e07a8a;
  --radius: 20px;
  --radius-sm: 12px;
  --on-art: #f4f6f8;
  --on-art-dim: rgba(244, 246, 248, 0.72);
  --glass: rgba(255, 255, 255, 0.28);
  --glass-border: rgba(255, 255, 255, 0.38);
  --glass-focus: rgba(255, 255, 255, 0.42);
  --glass-focus-border: rgba(255, 255, 255, 0.72);
  --card: rgba(10, 12, 16, 0.22);
  --card-border: rgba(255, 255, 255, 0.12);
  --card-hover: rgba(10, 12, 16, 0.34);
  --card-row: rgba(255, 255, 255, 0.07);
  --card-fg: #f4f6f8;
  --card-fg-dim: rgba(244, 246, 248, 0.7);
  --chip: rgba(8, 10, 14, 0.32);
  --chip-on: rgba(255, 255, 255, 0.92);
  --chip-on-text: #1c2430;
  --icon-bg: rgba(8, 10, 14, 0.28);
  --icon-bg-hover: rgba(8, 10, 14, 0.46);
  --check-line: rgba(244, 246, 248, 0.5);
  --months: rgba(244, 246, 248, 0.58);
  --todo-add: rgba(255, 255, 255, 0.1);
  --clock-shadow: 0 1px 1px rgba(0, 0, 0, 0.35), 0 10px 32px rgba(0, 0, 0, 0.22);
  --soft-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --scrim: linear-gradient(180deg, rgba(0, 0, 0, 0.26) 0%, rgba(0, 0, 0, 0.06) 26%, transparent 46%, transparent 70%, rgba(0, 0, 0, 0.3) 100%);
  --backdrop: rgba(6, 8, 12, 0.46);
  --wallpaper-fallback: #1a1e24;
  --panel: rgba(16, 18, 22, 0.78);
  --panel-text: #eef1f5;
  --panel-dim: rgba(238, 241, 245, 0.58);
  --panel-fill: rgba(255, 255, 255, 0.07);
  --panel-line: rgba(255, 255, 255, 0.1);
  --pick-on: rgba(255, 255, 255, 0.1);
  --placeholder: rgba(238, 241, 245, 0.42);
  --panel-hover: rgba(255, 255, 255, 0.12);
  --heat-size: 9px;
  --heat-gap: 2px;
  --heat-0: #161b22;
  --heat-1: #0e4429;
  --heat-2: #006d32;
  --heat-3: #26a641;
  --heat-4: #39d353;
  color-scheme: dark;
}

html[data-theme="light"] {
  --card: rgba(255, 255, 255, 0.28);
  --card-border: rgba(255, 255, 255, 0.4);
  --card-hover: rgba(255, 255, 255, 0.4);
  --card-row: rgba(28, 36, 48, 0.06);
  --card-fg: #1c2430;
  --card-fg-dim: rgba(28, 36, 48, 0.62);
  --check-line: rgba(28, 36, 48, 0.38);
  --months: rgba(28, 36, 48, 0.5);
  --todo-add: rgba(28, 36, 48, 0.08);
  --panel: rgba(248, 250, 252, 0.86);
  --panel-text: #1c2430;
  --panel-dim: rgba(28, 36, 48, 0.55);
  --panel-fill: rgba(28, 36, 48, 0.05);
  --panel-line: rgba(28, 36, 48, 0.12);
  --pick-on: #fff;
  --placeholder: rgba(28, 36, 48, 0.48);
  --panel-hover: rgba(28, 36, 48, 0.08);
  --heat-0: #ebedf0;
  --heat-1: #9be9a8;
  --heat-2: #40c463;
  --heat-3: #30a14e;
  --heat-4: #216e39;
  color-scheme: light;
}

:root {
  --page-pad-x: 48px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--wallpaper-fallback);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", "Segoe UI", sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font: inherit;
}

#wallpaper,
#scrim {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#wallpaper {
  overflow: hidden;
  background-color: var(--wallpaper-fallback);
}

#wallpaper img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#wallpaper-blur {
  display: none;
  object-fit: cover;
  filter: blur(32px) saturate(1.08);
  transform: scale(1.12);
}

#wallpaper-fg {
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.28s ease;
}

#wallpaper-fg.is-ready {
  opacity: 1;
}

#wallpaper.is-gradient img {
  display: none;
}

@media (min-aspect-ratio: 5/4) {
  #wallpaper-blur {
    display: block;
  }

  #wallpaper-fg {
    object-fit: contain;
  }

  #wallpaper.is-landscape #wallpaper-blur {
    display: none;
  }

  #wallpaper.is-landscape #wallpaper-fg {
    object-fit: cover;
  }
}

#scrim {
  background: var(--scrim);
}

main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 100dvh;
  padding: 9vh 22px 48px;
}

.mast,
.dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.center {
  display: contents;
}

.rail {
  width: min(440px, 100%);
}

.mast {
  order: 0;
  align-items: flex-start;
}

.search-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  order: 1;
  margin-top: 22px;
}

.search-stack.has-suggest {
  z-index: 5;
}

.search-box {
  position: relative;
  width: 100%;
}

.rail-left {
  order: 2;
}

.dock {
  order: 3;
}

.rail-right {
  order: 4;
}

#clock,
#date,
#greet,
.heatmap,
.todos,
.notes,
.agenda,
.blog-card,
.blog-link,
.groups,
.tiles,
#settings-btn,
.engine-btn {
  user-select: none;
  -webkit-user-select: none;
}

.todos input,
.todo-text,
.notes textarea,
.note-text,
.editor input,
.editor textarea {
  user-select: text;
  -webkit-user-select: text;
}

#clock {
  --clock-size: clamp(64px, 16vw, 104px);
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  height: auto;
  font-family: "Segoe UI Variable Display", "SF Pro Display", "Avenir Next",
    "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: var(--clock-size);
  font-weight: 200;
  letter-spacing: -0.04em;
  line-height: 0.92;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--on-art);
  text-shadow: var(--clock-shadow);
}

#clock.is-wide {
  font-size: clamp(52px, 13vw, 88px);
}

html[data-layout="classic"] main {
  align-items: center;
  padding: 12vh 20px 56px;
}

html[data-layout="classic"] .mast {
  align-items: center;
}

html[data-layout="classic"] .mast-meta {
  justify-content: center;
  margin-top: 10px;
  padding-left: 0;
}

html[data-layout="classic"] #clock {
  --clock-size: clamp(56px, 9.5vw, 84px);
  justify-content: center;
}

html[data-layout="classic"] #clock.is-wide {
  font-size: clamp(44px, 8vw, 72px);
}

html[data-layout="classic"] .search-stack {
  align-items: center;
  width: min(440px, 100%);
  margin-top: 20px;
}

.clock-sep {
  margin: 0 0.01em;
  font-weight: 200;
  opacity: 0.34;
}

.clock-period,
.clock-misc {
  margin-right: 0.28em;
  font-size: 0.22em;
  font-weight: 500;
  letter-spacing: 0.14em;
  opacity: 0.7;
}

.clock-s,
.clock-sep-s {
  font-size: 0.32em;
  font-weight: 300;
  letter-spacing: 0;
  opacity: 0.5;
}

.clock-s {
  margin-left: 0.04em;
}

.clock-sep-s {
  margin-left: 0.1em;
  opacity: 0.36;
}

.mast-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0;
  margin: 18px 0 0;
  padding-left: 8px;
  color: var(--on-art-dim);
  text-shadow: var(--soft-shadow);
}

#date {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.date-week {
  margin-left: 0.65em;
  opacity: 0.72;
}

#greet {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
}

#greet:not([hidden]) {
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

#greet[hidden] {
  display: none;
}

/* web frosted-glass approximation, not Apple Liquid Glass */
#search-form {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  width: 100%;
  height: 52px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.12)),
    rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1),
    0 14px 40px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(26px) saturate(1.55);
  -webkit-backdrop-filter: blur(26px) saturate(1.55);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#search-form::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 16% -10%, rgba(255, 255, 255, 0.55), transparent 42%);
  pointer-events: none;
}

#search-form:focus-within {
  border-color: var(--glass-focus-border);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.16)),
    rgba(255, 255, 255, 0.3);
}

.engine-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 100%;
  padding: 0 10px 0 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
}

.search-field {
  position: relative;
  z-index: 1;
  flex: 1;
  height: 100%;
  display: grid;
}

.search-ghost,
#search-input {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 18px 0 2px;
  border: 0;
  font: inherit;
  letter-spacing: inherit;
  line-height: 50px;
  background: transparent;
  color: var(--text);
}

.search-ghost {
  z-index: 0;
  overflow: hidden;
  white-space: pre;
  pointer-events: none;
}

.search-ghost-typed {
  color: transparent;
}

.search-ghost-rest {
  color: var(--text-dim);
}

.engine-btn:hover {
  opacity: 0.72;
}

.engine-btn[hidden] {
  display: none;
}

#search-form.no-engine .search-ghost,
#search-form.no-engine #search-input {
  padding-left: 18px;
}

#search-input {
  z-index: 1;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

#search-input::-webkit-search-cancel-button,
#search-input::-webkit-search-decoration {
  -webkit-appearance: none;
}

#search-input::placeholder {
  color: var(--text-dim);
}

.search-trans {
  max-width: 100%;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--on-art-dim);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  text-align: center;
  text-shadow: var(--soft-shadow);
  cursor: default;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  user-select: text;
  -webkit-user-select: text;
}

.search-trans[hidden] {
  display: none;
}

.search-trans.is-action {
  cursor: pointer;
}

.search-trans.is-copied {
  opacity: 0.62;
}

.search-suggest {
  position: absolute;
  z-index: 4;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 280px;
  margin: 0;
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--panel-text);
  backdrop-filter: blur(28px) saturate(1.3);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.search-suggest button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.search-suggest button[aria-selected="true"],
.search-suggest button:hover {
  background: var(--panel-hover);
}

.search-suggest-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-suggest-text mark {
  background: none;
  color: inherit;
  font-weight: 600;
}

.search-suggest-kind {
  flex: none;
  color: var(--panel-dim);
  font-size: 11px;
}

.menu {
  position: fixed;
  z-index: 3;
  width: min(220px, calc(100% - 40px));
  margin: 8px 0 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--panel-text);
  backdrop-filter: blur(28px) saturate(1.3);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.menu button[aria-selected="true"],
.menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.heatmap {
  position: relative;
  z-index: 2;
  width: min(440px, 100%);
  margin-top: 32px;
  padding: 0;
}

.heatmap-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 8px;
  padding: 0 2px;
  color: var(--on-art-dim);
  font-size: 11px;
  text-shadow: var(--soft-shadow);
}

.heatmap-link {
  color: var(--on-art);
  font-weight: 500;
  text-decoration: none;
}

.heatmap-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  font-size: 11px;
}

.heatmap-scroll {
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.heatmap-months,
.heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--heat-gap);
  width: 100%;
}

.heatmap-months {
  height: 14px;
  margin-bottom: 4px;
  color: var(--months);
  font-size: 10px;
  line-height: 14px;
}

.heatmap-months span {
  white-space: nowrap;
}

.heatmap-grid {
  grid-template-rows: repeat(7, 1fr);
  height: 62px;
}

.heat {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border-radius: 2.5px;
  background: var(--heat-0);
}

.heatmap-legend .heat {
  width: var(--heat-size);
  height: var(--heat-size);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.heat.l1 {
  background: var(--heat-1);
}

.heat.l2 {
  background: var(--heat-2);
}

.heat.l3 {
  background: var(--heat-3);
}

.heat.l4 {
  background: var(--heat-4);
}

.heat.is-empty {
  background: transparent;
}

.heat:not(.is-empty):hover {
  outline: 1px solid rgba(255, 255, 255, 0.85);
  outline-offset: 0;
}

.heatmap-tip {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, calc(-100% - 8px));
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(20, 24, 30, 0.9);
  color: #f3f4f6;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.today-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  width: min(440px, 100%);
  margin-top: 28px;
}

.todos,
.agenda {
  width: 100%;
  margin-top: 0;
}

.todos-card {
  padding: 14px 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
}

.todos-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 8px 10px;
  color: var(--card-fg-dim);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.todo-fold {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--card-fg);
  font: inherit;
  font-weight: 500;
  line-height: 1;
  letter-spacing: inherit;
  cursor: pointer;
}

.todo-count {
  color: var(--card-fg-dim);
  font-weight: 400;
}

.todo-fold-mark {
  display: block;
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  opacity: 0.5;
  transform-origin: 50% 50%;
}

.todo-fold:hover .todo-fold-mark {
  opacity: 0.9;
}

.todos-card.is-collapsed {
  padding: 14px 14px 10px;
  width: max-content;
  max-width: 100%;
}

.todos-card.is-collapsed .todos-head {
  padding-bottom: 2px;
}

.todos-card.is-collapsed .todo-fold-mark {
  transform: rotate(-90deg);
}

.todo-later {
  margin-left: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.todo-later.is-on {
  color: var(--card-fg);
}

.todo-later[hidden] + .todo-clear {
  margin-left: auto;
}

.todo-clear {
  margin-left: 4px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  line-height: 1;
  font: inherit;
  cursor: pointer;
}

.todo-clear:hover,
.todo-later:hover {
  color: var(--card-fg);
}

.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(42vh, 420px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.todo-list .agenda-empty {
  padding: 6px 6px 8px;
  color: var(--card-fg-dim);
  font-size: 13px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 4px 0 6px;
  border-radius: 8px;
}

.todo-item:hover {
  background: var(--card-row);
}

.todo-check {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  border: 1.5px solid var(--check-line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.todo-check:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px rgba(12, 16, 22, 0.55);
}

.todo-text {
  flex: 1;
  min-width: 0;
  color: var(--card-fg);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-item.is-done .todo-text {
  color: var(--card-fg-dim);
  text-decoration: line-through;
}

.todo-item.is-overdue .todo-text,
.todo-item.is-overdue .todo-due-label {
  color: var(--danger);
}

.todo-text[contenteditable="true"] {
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  outline: none;
}

.next-class {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  padding: 0 8px;
  color: var(--on-art-dim);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-shadow: var(--soft-shadow);
}

.next-class-time {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.next-class-name {
  color: var(--on-art);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-class-place {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-due-label {
  flex-shrink: 0;
  color: var(--card-fg-dim);
  font-size: 11px;
}

.todo-del {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--card-fg-dim);
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
}

.todo-item:hover .todo-del,
.todo-item:focus-within .todo-del {
  opacity: 1;
}

.todo-log {
  padding: 0 4px 8px;
}

.todo-log-nav {
  display: grid;
  grid-template-columns: 22px auto 22px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--card-fg);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.todo-log-shift {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--card-fg-dim);
  cursor: pointer;
}

.todo-log-shift:hover,
.todo-log-shift:focus-visible {
  color: var(--card-fg);
  background: var(--card-row);
}

.todo-log-shift:disabled {
  opacity: 0;
  pointer-events: none;
}

.todo-log-week,
.todo-log-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.todo-log-week {
  margin-bottom: 4px;
  color: var(--card-fg-dim);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-align: center;
}

.todo-log-pad {
  aspect-ratio: 1;
}

.todo-log-day {
  aspect-ratio: 1;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--card-fg-dim);
  font: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.todo-log-day.is-heat-1 {
  background: rgba(91, 147, 201, 0.34);
  color: var(--card-fg);
}

.todo-log-day.is-heat-2 {
  background: rgba(91, 147, 201, 0.52);
  color: var(--card-fg);
}

.todo-log-day.is-heat-3 {
  background: rgba(91, 147, 201, 0.72);
  color: var(--card-fg);
}

.todo-log-day.is-today {
  box-shadow: inset 0 0 0 1px var(--card-fg-dim);
}

.todo-log-day.is-on {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  color: var(--card-fg);
}

.todo-log-day:disabled {
  opacity: 0.32;
  cursor: default;
}

.todo-item.is-log .todo-text {
  color: var(--card-fg);
}

.todo-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 0 4px 2px 6px;
}

#todo-input,
#todo-due {
  font: inherit;
  border: 0;
  background: transparent;
  outline: none;
}

#todo-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0;
  color: var(--card-fg);
}

#todo-input::placeholder {
  color: var(--card-fg-dim);
}

#todo-due {
  width: 118px;
  height: 32px;
  padding: 0;
  color: var(--card-fg-dim);
  font-size: 12px;
  color-scheme: inherit;
}

.todo-add {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--todo-add);
  color: var(--card-fg);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.todo-add:active {
  transform: scale(0.96);
}

.todo-add:hover,
.todo-add:focus-visible {
  background: var(--card-row);
}

.notes {
  width: min(440px, 100%);
  margin-top: 16px;
}

.notes-card {
  padding: 14px 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
}

.notes-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 8px 10px;
  color: var(--card-fg-dim);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.note-fold {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--card-fg);
  font: inherit;
  font-weight: 500;
  line-height: 1;
  letter-spacing: inherit;
  cursor: pointer;
}

.note-count {
  color: var(--card-fg-dim);
  font-weight: 400;
}

.note-fold-mark {
  display: block;
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  opacity: 0.5;
  transform-origin: 50% 50%;
}

.note-fold:hover .note-fold-mark {
  opacity: 0.9;
}

.notes-card.is-collapsed {
  padding: 14px 14px 10px;
  width: max-content;
  max-width: 100%;
}

.notes-card.is-collapsed .notes-head {
  padding-bottom: 2px;
}

.notes-card.is-collapsed .note-fold-mark {
  transform: rotate(-90deg);
}

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(28vh, 240px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.note-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 34px;
  padding: 4px 4px 4px 6px;
  border-radius: 8px;
}

.note-item:hover {
  background: var(--card-row);
}

.note-text {
  flex: 1;
  min-width: 0;
  color: var(--card-fg);
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-text[contenteditable="true"] {
  outline: none;
}

.note-del {
  width: 22px;
  height: 22px;
  margin-top: 4px;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--card-fg-dim);
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
}

.note-item:hover .note-del,
.note-item:focus-within .note-del {
  opacity: 1;
}

.note-form {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin-top: 4px;
  padding: 0 4px 2px 6px;
}

#note-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  max-height: 96px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  outline: none;
  resize: none;
  overflow: hidden;
  color: var(--card-fg);
  font-size: 13px;
  line-height: 20px;
}

#note-input::placeholder {
  color: var(--card-fg-dim);
}

.note-add {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--todo-add);
  color: var(--card-fg);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.note-add:active {
  transform: scale(0.96);
}

.note-add:hover,
.note-add:focus-visible {
  background: var(--card-row);
}

.blog-card {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: min(440px, 100%);
  margin-top: 28px;
}

.blog-link,
.blog-write {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--card-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
}

.blog-link {
  flex: 1;
  min-width: 0;
  text-decoration: none;
}

.blog-write {
  flex-shrink: 0;
  font-size: 13px;
  cursor: pointer;
}

.blog-card:not(:has(#blog-link:not([hidden]))) .blog-write {
  flex: 1;
  justify-content: center;
}

.blog-link:hover,
.blog-write:hover,
.blog-write:focus-visible {
  background: var(--card-hover);
}

#blog-link-title {
  font-size: 13px;
  font-weight: 500;
}

#blog-link-host {
  margin-left: auto;
  color: var(--card-fg-dim);
  font-size: 11px;
}

.blog-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.groups {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  width: auto;
  max-width: 100%;
  margin: 8px 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.groups::-webkit-scrollbar,
.tiles-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 6px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--chip);
  color: var(--on-art);
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), background 0.16s ease;
}

.chip:active {
  transform: scale(0.98);
}

.chip[aria-selected="true"] {
  background: var(--chip-on);
  color: var(--chip-on-text);
}

.chip.dragging {
  opacity: 0.45;
}

.chip.is-dim {
  opacity: 0.45;
}

.dock-bar {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  width: auto;
  max-width: 100%;
  min-width: 0;
  margin-top: 8px;
}

.tiles-pane {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.dock-shift {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin-top: 19px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(12, 16, 22, 0.58);
  color: #f4f6f8;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.dock-shift:hover,
.dock-shift:focus-visible {
  background: rgba(12, 16, 22, 0.78);
}

.tiles-scroll {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scroll-padding-inline: 24px;
}

.groups.has-left {
  mask-image: linear-gradient(90deg, transparent, #000 28px, #000);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000);
}

.groups.has-right {
  mask-image: linear-gradient(90deg, #000, #000 calc(100% - 28px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000, #000 calc(100% - 28px), transparent);
}

.groups.has-left.has-right {
  mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
}

.tiles {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 16px 12px;
  width: max-content;
  margin-top: 0;
}

.tiles-scroll.is-overflow .tiles,
.groups.is-overflow {
  justify-content: flex-start;
}

.tiles.is-icons {
  gap: 12px 8px;
}

.tiles.is-icons .tile-wrap {
  width: 58px;
}

.tiles.is-icons .tile-name {
  display: none;
}

.tiles.is-icons .tile {
  gap: 0;
}

.tiles.is-filter .tile-wrap {
  cursor: pointer;
}

.filter-empty {
  margin: 8px 12px 0;
  color: var(--on-art-dim);
  font-size: 13px;
  text-align: center;
  text-shadow: var(--soft-shadow);
  white-space: nowrap;
}

.tile-wrap {
  position: relative;
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  width: 76px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: 16px;
  padding: 4px;
  cursor: pointer;
}

.tile:focus-visible,
.icon-btn:focus-visible,
.engine-btn:focus-visible,
.chip:focus-visible,
.blog-link:focus-visible,
.todo-check:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus-visible {
  outline: none;
}

.todo-check:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tile-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 8px 20px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.tile:hover .tile-icon,
.tile:focus-visible .tile-icon {
  transform: translateY(-2px);
}

.tile:active .tile-icon {
  transform: scale(0.96);
}

.tile-icon img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  object-position: center;
}

.tile-icon img.is-pad {
  transform: scale(1.22);
}

.tile-letter {
  font-size: 22px;
  font-weight: 500;
  color: var(--accent);
}

.tile-name {
  max-width: 100%;
  color: var(--on-art);
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.01em;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: var(--soft-shadow);
}

.tile-add {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 58px;
  height: 58px;
  margin-top: 4px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--on-art);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), background 0.16s ease;
}

.tile-add:hover,
.tile-add:focus-visible {
  transform: translateY(-2px);
}

.tile-add:active {
  transform: scale(0.96);
}

.tile-edit {
  position: absolute;
  top: 2px;
  right: 8px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 24, 30, 0.7);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
}

.tile-wrap:hover .tile-edit,
.tile-wrap:focus-within .tile-edit {
  opacity: 1;
}

.icon-btn {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: var(--icon-bg);
  color: var(--on-art);
  cursor: pointer;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.icon-btn:hover {
  background: var(--icon-bg-hover);
}

#settings-btn {
  position: fixed;
  top: 18px;
  right: 18px;
}

body.is-panel-open #settings-btn {
  visibility: hidden;
  pointer-events: none;
}

dialog {
  color-scheme: inherit;
  border: 1px solid var(--panel-line);
  border-radius: 22px;
  background: var(--panel);
  color: var(--panel-text);
  padding: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 28px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
}

dialog::backdrop {
  background: var(--backdrop);
}

#shortcut-dialog,
#open-rest-dialog {
  width: min(300px, calc(100% - 48px));
  border-radius: 16px;
}

#open-rest-dialog {
  width: min(360px, calc(100% - 48px));
  padding: 16px 16px 14px;
}

#open-rest-dialog h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.open-rest-hint {
  margin: 0 0 12px;
  color: var(--panel-dim);
  font-size: 12px;
  line-height: 1.45;
}

.open-rest-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  max-height: min(40vh, 280px);
  overflow: auto;
}

.open-rest-list a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--panel-text);
  text-decoration: none;
  font-size: 13px;
}

.open-rest-list a:hover {
  background: var(--panel-hover);
}

#shortcut-dialog form,
.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 22px 28px;
}

#shortcut-dialog form {
  padding: 16px 16px 14px;
  gap: 10px;
}

#shortcut-dialog h2,
.drawer-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

#shortcut-dialog h2 {
  font-size: 15px;
}

#shortcut-dialog label {
  gap: 4px;
  font-size: 11px;
}

.theme-picks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: var(--panel-fill);
}

.pad-slider {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pad-slider input[type="range"] {
  flex: 1;
  margin: 0;
  accent-color: var(--accent);
}

#page-pad-val {
  flex: 0 0 3ch;
  color: var(--panel-text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.theme-pick {
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  background: transparent;
  color: var(--panel-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.theme-pick[aria-selected="true"] {
  background: var(--pick-on);
  color: var(--panel-text);
  box-shadow: inset 0 0 0 1px var(--panel-line);
}

.drawer-body h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--panel-dim);
}

label,
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: var(--panel-dim);
}

input[type="text"],
input[type="url"],
input[type="search"],
input[type="date"] {
  font: inherit;
}

#shortcut-dialog input,
.inline-form input,
.drawer-body input[type="text"],
.drawer-body input[type="password"],
.drawer-body input[type="url"],
.editor input[type="text"],
.editor input[type="date"],
.editor textarea {
  padding: 11px 12px;
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  background: var(--panel-fill);
  color: var(--panel-text);
  font-size: 14px;
  outline: none;
}

#shortcut-dialog input:focus,
.inline-form input:focus,
.drawer-body input[type="text"]:focus,
.drawer-body input[type="password"]:focus,
.editor input:focus,
.editor textarea:focus {
  border-color: rgba(91, 147, 201, 0.7);
  box-shadow: 0 0 0 3px rgba(91, 147, 201, 0.18);
}

#shortcut-dialog input::placeholder,
.inline-form input::placeholder,
.drawer-body input::placeholder,
.editor input::placeholder,
.editor textarea::placeholder {
  color: var(--placeholder);
}

#shortcut-dialog input {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 10px;
}

#shortcut-dialog .dialog-actions {
  margin-top: 2px;
  gap: 6px;
}

#shortcut-dialog .btn-primary,
#shortcut-dialog .btn-ghost,
#shortcut-dialog .btn-danger {
  padding: 5px 11px;
  font-size: 12px;
}

.dialog-actions,
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spacer {
  flex: 1;
}

.btn-primary,
.btn-ghost,
.btn-danger {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease;
}

.btn-primary {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-primary:disabled,
.btn-ghost:disabled,
.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.btn-ghost {
  border: 1px solid var(--panel-line);
  background: var(--panel-fill);
  color: var(--panel-text);
}

.btn-ghost:hover {
  background: var(--panel-hover);
}

.btn-danger {
  border: 1px solid rgba(224, 122, 138, 0.35);
  background: transparent;
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(224, 122, 138, 0.12);
}

.drawer:not([open]) {
  display: none;
}

.drawer[open] {
  display: flex;
  flex-direction: column;
  inset: 12px 12px 12px auto;
  margin: 0;
  height: auto;
  max-height: none;
  width: min(400px, calc(100vw - 24px));
  border-radius: 22px;
  overflow: hidden;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 16px 14px 8px 22px;
}

.drawer .icon-btn {
  background: transparent;
  color: var(--panel-dim);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.drawer .icon-btn:hover {
  background: var(--panel-hover);
  color: var(--panel-text);
}

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-top: 8px;
  padding-bottom: 36px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.drawer-body section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--panel-line);
}

.drawer-body section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.drawer-body section > .btn-ghost {
  align-self: flex-start;
}

.editor:not([open]) {
  display: none;
}

.editor[open] {
  display: flex;
  flex-direction: column;
  inset: 20px;
  margin: auto;
  width: min(1080px, calc(100vw - 40px));
  height: calc(100dvh - 40px);
  max-height: none;
  border-radius: 22px;
  overflow: hidden;
}

.editor .drawer-head {
  gap: 12px;
}

.editor-status {
  flex: 1;
  margin: 0;
  min-width: 0;
  color: var(--panel-dim);
  font-size: 12px;
}

.editor-status.is-error {
  color: var(--danger);
}

.editor-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: 0;
  flex: 1;
}

.editor-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 8px 12px 20px 18px;
  border-right: 1px solid var(--panel-line);
}

.editor-nav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.editor-nav-actions .btn-ghost {
  padding: 5px 10px;
  font-size: 12px;
}

.editor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.editor-list button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--panel-text);
  text-align: left;
  cursor: pointer;
}

.editor-list button:hover {
  background: var(--panel-hover);
}

.editor-list button[aria-selected="true"] {
  background: var(--pick-on);
  box-shadow: inset 0 0 0 1px var(--panel-line);
}

.editor-list .post-title {
  font-size: 13px;
  line-height: 1.3;
}

.editor-list .post-meta {
  color: var(--panel-dim);
  font-size: 11px;
}

.editor-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 8px 22px 22px;
}

.editor-main > * {
  flex-shrink: 0;
}

.editor-row {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
}

.cover-preview {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: var(--panel-fill);
}

.cover-preview[hidden] {
  display: none;
}

.cover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-body {
  flex: 1 1 auto;
  min-height: 160px;
}

.editor textarea {
  flex: 1;
  min-height: 180px;
  resize: vertical;
  line-height: 1.55;
}

.editor-actions {
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  background: linear-gradient(180deg, transparent, var(--panel) 28%);
}

.swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 228px;
  overflow: auto;
  padding: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.swatch-label {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  color: var(--panel-dim);
  font-size: 12px;
}

.swatch-label:first-child {
  margin-top: 0;
}

.swatch {
  aspect-ratio: 16 / 10;
  height: auto;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.swatch.is-tall {
  aspect-ratio: 3 / 4;
}

.swatch[aria-selected="true"] {
  box-shadow: inset 0 0 0 2px #fff;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.switch-list {
  overflow: hidden;
  border-radius: 14px;
  background: var(--panel-fill);
}

.check {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--panel-text);
  font-size: 14px;
  cursor: pointer;
}

.switch-list .check + .check {
  border-top: 1px solid var(--panel-line);
}

.check input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 40px;
  height: 24px;
  margin: 0;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: background 0.18s ease;
}

.check input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.check input:checked {
  background: var(--accent);
}

.check input:checked::after {
  transform: translateX(16px);
}

.stack-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border-radius: 14px;
  background: var(--panel-fill);
}

.stack-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--panel-line);
}

.stack-list li:last-child {
  border-bottom: 0;
}

.stack-list li > span:first-child {
  flex: 1;
  min-width: 0;
  color: var(--panel-text);
  font-size: 14px;
}

.row-actions {
  display: flex;
  gap: 4px;
}

.stack-list button.linkish {
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--panel-dim);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.stack-list button.linkish:hover {
  background: var(--panel-hover);
  color: var(--panel-text);
}

.stack-list button.linkish:disabled {
  opacity: 0.35;
  cursor: default;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel-fill);
}

.inline-form .btn-ghost,
.drawer-body .btn-danger {
  justify-self: start;
  align-self: flex-start;
}

.hint {
  margin: 0;
  color: var(--panel-dim);
  font-size: 12px;
  line-height: 1.55;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}

.tile-wrap.dragging {
  opacity: 0.4;
}

.place-hint {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(10, 12, 16, 0.55);
  color: var(--on-art);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-shadow: none;
  pointer-events: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  white-space: nowrap;
}

body.is-placing .pin {
  cursor: grab;
  outline: 1px dashed rgba(255, 255, 255, 0.28);
  outline-offset: 6px;
  touch-action: none;
}

body.is-placing .pin.is-dragging {
  cursor: grabbing;
  z-index: 6;
  outline-color: rgba(255, 255, 255, 0.55);
}

body.is-placing .pin a,
body.is-placing .pin button,
body.is-placing .pin input,
body.is-placing .pin textarea {
  pointer-events: none;
}

@media (min-width: 1180px), (min-aspect-ratio: 5/4) {
  main {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(240px, 300px);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    column-gap: 32px;
    row-gap: 8px;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 52px var(--page-pad-x) 32px;
    min-height: 100dvh;
  }

  .mast,
  .dock,
  .rail,
  .search-stack {
    order: unset;
  }

  .center {
    display: flex;
    flex-direction: column;
    align-items: center;
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    min-height: 0;
  }

  .search-stack {
    width: min(460px, 100%);
    align-items: center;
    margin-top: 18px;
  }

  .dock {
    margin-top: auto;
    padding-top: 28px;
  }

  .mast {
    grid-column: 1 / 3;
    grid-row: 1;
    justify-self: start;
    width: auto;
    max-width: 100%;
    align-items: flex-start;
  }

  #clock {
    --clock-size: 118px;
  }

  .rail-left {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    padding-top: 18px;
  }

  .rail-right {
    grid-column: 3;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    align-items: stretch;
    padding-top: 18px;
  }

  .rail-right:not(:has(> :not([hidden]))) {
    display: none;
  }

  .today-stack,
  .todos,
  .agenda,
  .heatmap,
  .notes,
  .blog-card,
  .blog-link {
    width: 100%;
    margin-top: 0;
  }

  .heatmap {
    --heat-size: 10px;
    --heat-gap: 2px;
  }

  .heatmap-scroll {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
  }

  .heatmap-months,
  .heatmap-grid {
    width: max-content;
    max-width: none;
    flex-shrink: 0;
    grid-auto-columns: var(--heat-size);
  }

  .heatmap-grid {
    grid-template-rows: repeat(7, var(--heat-size));
    height: auto;
  }

  .heatmap-grid .heat {
    width: var(--heat-size);
    height: var(--heat-size);
  }

  html[data-layout="classic"] main {
    grid-template-columns: 320px minmax(0, 1fr) 320px;
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: 36px;
    row-gap: 12px;
    max-width: none;
    padding: 56px var(--page-pad-x) 40px;
  }

  html[data-layout="classic"] .center {
    min-height: unset;
  }

  html[data-layout="classic"] .search-stack {
    width: min(440px, 100%);
    margin-top: 0;
  }

  html[data-layout="classic"] .dock {
    margin-top: 0;
    padding-top: 0;
  }

  html[data-layout="classic"] .mast {
    grid-column: 1 / -1;
    justify-self: center;
    align-items: center;
  }

  html[data-layout="classic"] #clock {
    --clock-size: 84px;
  }

  html[data-layout="classic"] .rail-left,
  html[data-layout="classic"] .rail-right {
    padding-top: 0;
  }
}

html[data-free="1"] main {
  display: block;
  max-width: none;
  width: calc(100% - 2 * var(--page-pad-x));
  margin-inline: var(--page-pad-x);
  padding: 24px 0 48px;
  min-height: 100dvh;
}

html[data-fit="1"],
html[data-fit="1"] body {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

html[data-free="1"][data-frame="1"] main {
  position: absolute;
  left: var(--frame-x);
  top: var(--frame-y);
  width: var(--frame-w);
  height: var(--frame-h);
  min-height: var(--frame-h);
  transform: scale(var(--frame-scale));
  transform-origin: 0 0;
}

html[data-free="1"] .center,
html[data-free="1"] .rail-left,
html[data-free="1"] .rail-right {
  display: contents;
}

html[data-free="1"] .pin {
  position: absolute;
  margin: 0;
}

html[data-free="1"] .today-stack {
  display: contents;
}

html[data-free="1"] .mast,
html[data-free="1"] .search-stack,
html[data-free="1"] .dock,
html[data-free="1"] .todos,
html[data-free="1"] .agenda,
html[data-free="1"] .heatmap,
html[data-free="1"] .notes,
html[data-free="1"] .blog-card {
  width: auto;
  max-width: none;
}

html[data-free="1"] #clock {
  --clock-size: 118px;
}

html[data-free="1"][data-layout="classic"] #clock {
  --clock-size: 84px;
}

html[data-free="1"][data-frame="1"] #clock {
  --clock-size: clamp(80px, calc(var(--frame-w) * 0.084), 118px);
}

html[data-free="1"][data-frame="1"][data-layout="classic"] #clock {
  --clock-size: clamp(56px, calc(var(--frame-w) * 0.095), 84px);
}

html[data-free="1"][data-frame="1"] #clock.is-wide {
  font-size: clamp(52px, calc(var(--frame-w) * 0.13), 88px);
}

html[data-free="1"][data-frame="1"][data-layout="classic"] #clock.is-wide {
  font-size: clamp(44px, calc(var(--frame-w) * 0.08), 72px);
}

html[data-free="1"] .heatmap {
  --heat-size: 10px;
  --heat-gap: 2px;
}

html[data-free="1"] .heatmap-scroll {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

html[data-free="1"] .heatmap-months,
html[data-free="1"] .heatmap-grid {
  width: max-content;
  max-width: none;
  flex-shrink: 0;
  grid-auto-columns: var(--heat-size);
}

html[data-free="1"] .heatmap-grid {
  grid-template-rows: repeat(7, var(--heat-size));
  height: auto;
}

html[data-free="1"] .heatmap-grid .heat {
  width: var(--heat-size);
  height: var(--heat-size);
}

@media (max-width: 640px) and (max-aspect-ratio: 5/4) {
  main {
    padding-top: 8vh;
  }

  html[data-layout="classic"] main {
    padding-top: 12vh;
  }

  #clock {
    --clock-size: clamp(60px, 17vw, 86px);
  }

  html[data-layout="classic"] #clock {
    --clock-size: clamp(56px, 9.5vw, 84px);
  }

  #todo-due {
    width: 108px;
  }

  .heatmap-legend {
    margin-left: 0;
  }

  .heatmap-scroll {
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .heatmap-months,
  .heatmap-grid {
    width: max-content;
    min-width: 100%;
    grid-auto-columns: 8px;
  }

  .heatmap-grid {
    grid-template-rows: repeat(7, 8px);
    height: auto;
  }

  .heatmap-grid .heat {
    width: 8px;
    height: 8px;
  }

  .drawer[open] {
    inset: 8px;
    width: auto;
    border-radius: 18px;
  }

  .editor[open] {
    inset: 8px;
    width: auto;
    height: calc(100dvh - 16px);
    border-radius: 18px;
  }

  .editor-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .editor-nav {
    border-right: 0;
    border-bottom: 1px solid var(--panel-line);
    padding: 0 16px 12px;
    max-height: 168px;
  }

  .editor-row {
    grid-template-columns: 1fr;
  }

  .editor-main {
    padding: 12px 16px 18px;
  }

  .editor-actions {
    position: static;
    background: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .mast,
  .search-stack,
  .rail-left,
  .rail-right,
  .dock {
    animation: enter 0.78s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .search-stack {
    animation-delay: 0.07s;
  }

  .rail-left {
    animation-delay: 0.12s;
  }

  .rail-right {
    animation-delay: 0.16s;
  }

  .dock {
    animation-delay: 0.2s;
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  #search-form,
  .menu,
  .search-suggest {
    background: #f3f4f6;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  #search-form::before {
    display: none;
  }

  dialog {
    background: var(--panel);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .heatmap-scroll,
  .todos-card,
  .notes-card,
  .blog-link,
  .blog-write {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .icon-btn {
    background: var(--icon-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .dock-shift {
    background: rgba(12, 16, 22, 0.88);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #wallpaper-fg,
  .tile-icon {
    transition: none;
  }
}
