/* =========================================================================
   Home page + pin button + per-tool home additions
   Loaded last so it wins.
   ========================================================================= */

/* ---------- Pin button ---------- */
.pin-btn {
  width: 26px; height: 26px;
  border: 0; background: transparent; cursor: pointer;
  border-radius: 6px;
  color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 120ms, color 120ms, background 120ms;
}
.pin-btn:hover { background: rgba(var(--primary-rgb, 127,13,242), 0.12); color: var(--color-primary); }
.pin-btn .material-symbols-outlined {
  font-size: 16px;
  font-variation-settings: "FILL" 0, "wght" 400;
  transform: rotate(45deg);
}
.pin-btn.is-pinned {
  opacity: 1; color: var(--color-primary);
}
.pin-btn.is-pinned .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 600;
}
.todo-row:hover .pin-btn,
.note-row:hover .pin-btn,
.json-row:hover .pin-btn,
.bm-card:hover .pin-btn,
.pwd-vault-row:hover .pin-btn,
.fc-coll-card:hover .pin-btn {
  opacity: 1;
}

/* Slot the pin into each row */
.todo-row .row-pin {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
}
.todo-row { position: relative; }

.note-row { position: relative; }
.note-row .row-pin {
  position: absolute; right: 6px; top: 6px;
}

.json-row { position: relative; }
.json-row .row-pin {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
}

.bm-card { position: relative; }
.bm-card-pin {
  position: absolute; right: 8px; bottom: 8px;
}

.pwd-vault-pin {
  margin-left: auto;
}
.pwd-vault-meta { display: flex; align-items: center; gap: 8px; }

/* ---------- Home tool ---------- */
.home-tool {
  height: 100%;
  overflow-y: auto;
  padding: 28px 36px 60px;
}
.home-loading { background: var(--color-bg); }

.home-hero { margin-bottom: 28px; }
.home-hero-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  flex-wrap: wrap;
}
.home-greeting {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--color-primary);
  margin-bottom: 6px;
}
.home-title {
  margin: 0;
  font-size: 32px; font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-hi);
}
.home-title span { color: var(--color-primary); }
.home-subtitle {
  margin: 6px 0 0;
  font-size: 14px; color: var(--text-lo);
  max-width: 520px;
}

.home-section { margin-top: 28px; }
.home-section-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.home-section-head h2 {
  margin: 0; font-size: 14px; font-weight: 700;
  color: var(--text-hi); letter-spacing: -0.005em;
}
.home-section-head > .material-symbols-outlined {
  font-size: 18px; color: var(--color-primary);
  font-variation-settings: "FILL" 1, "wght" 500;
}
.home-section-count {
  background: rgba(var(--primary-rgb, 127,13,242), 0.12);
  color: var(--color-primary);
  padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.home-section-hint { font-size: 11px; color: var(--text-muted); }

/* Pinned grid */
.home-pinned-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.pinned-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  cursor: pointer; position: relative;
  transition: border-color 120ms, transform 120ms, box-shadow 120ms;
}
.pinned-card:hover {
  border-color: rgba(var(--primary-rgb, 127,13,242), 0.4);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.pinned-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(var(--primary-rgb, 127,13,242), 0.1);
  color: var(--color-primary);
  flex-shrink: 0;
}
.pinned-card-icon[data-type="todo"]      { background: rgba(96, 165, 250, 0.12); color: #60a5fa; }
.pinned-card-icon[data-type="note"]      { background: rgba(52, 211, 153, 0.12); color: #34d399; }
.pinned-card-icon[data-type="json"]      { background: rgba(251, 191, 36, 0.14); color: #f59e0b; }
.pinned-card-icon[data-type="bookmark"]  { background: rgba(244, 63, 94, 0.12); color: #f43f5e; }
.pinned-card-icon[data-type="password"]  { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.pinned-card-icon .material-symbols-outlined { font-size: 20px; }
.pinned-card-body { flex: 1; min-width: 0; }
.pinned-card-type {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); margin-bottom: 2px;
}
.pinned-card-title {
  font-size: 14px; font-weight: 600; color: var(--text-hi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pinned-card-sub {
  font-size: 12px; color: var(--text-lo);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pinned-card-unpin {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px;
  border: 0; background: transparent; cursor: pointer;
  border-radius: 6px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 120ms, background 120ms;
}
.pinned-card:hover .pinned-card-unpin { opacity: 1; }
.pinned-card-unpin:hover { background: rgba(0,0,0,0.1); color: var(--text-hi); }
.pinned-card-unpin .material-symbols-outlined { font-size: 14px; }

.home-empty-pin {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px;
  background: var(--color-surface);
  border: 1.5px dashed var(--color-border);
  border-radius: 12px;
}
.home-empty-pin > .material-symbols-outlined {
  font-size: 28px; color: var(--text-faint);
  transform: rotate(45deg);
}
.home-empty-pin .title { font-size: 13px; font-weight: 600; color: var(--text-hi); }
.home-empty-pin .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; max-width: 540px; line-height: 1.5; }

/* Widget grid */
.home-widget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1100px) { .home-widget-grid { grid-template-columns: 1fr; } }
.home-widget {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 200px;
}
.home-widget.size-wide { grid-column: 1 / -1; }
.home-widget-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
}
.home-widget-head h3 {
  margin: 0; font-size: 13px; font-weight: 700;
  color: var(--text-hi); letter-spacing: -0.005em;
}
.home-widget-head > .material-symbols-outlined {
  font-size: 16px; color: var(--color-primary);
}
.home-widget-body { flex: 1; padding: 14px; overflow-y: auto; }

.home-empty-widgets {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  background: var(--color-surface);
  border: 1.5px dashed var(--color-border);
  border-radius: 14px;
  color: var(--text-lo);
}
.home-empty-widgets .material-symbols-outlined {
  font-size: 32px; color: var(--text-faint); margin-bottom: 8px;
}
.home-empty-widgets .title { font-size: 14px; font-weight: 600; color: var(--text-hi); }
.home-empty-widgets .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Widget picker */
.home-widget-picker {
  margin-bottom: 14px;
  padding: 14px;
  background: rgba(var(--primary-rgb, 127,13,242), 0.05);
  border: 1px solid rgba(var(--primary-rgb, 127,13,242), 0.2);
  border-radius: 12px;
}
.home-widget-picker-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-lo);
  margin-bottom: 10px;
}
.home-widget-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.home-widget-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  cursor: pointer; text-align: left;
  font-family: inherit; color: var(--text-md);
  transition: all 120ms;
}
.home-widget-chip:hover {
  border-color: rgba(var(--primary-rgb, 127,13,242), 0.4);
}
.home-widget-chip.is-on {
  border-color: var(--color-primary);
  background: rgba(var(--primary-rgb, 127,13,242), 0.06);
}
.home-widget-chip > .material-symbols-outlined {
  font-size: 18px; color: var(--color-primary);
}
.home-widget-chip-body { flex: 1; min-width: 0; }
.home-widget-chip-label { font-size: 12px; font-weight: 600; color: var(--text-hi); }
.home-widget-chip-desc { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.home-widget-chip-flag { font-size: 18px; color: var(--text-faint); }
.home-widget-chip.is-on .home-widget-chip-flag { color: var(--color-primary); }

/* ---------- Widget bodies ---------- */

/* Stats */
.w-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
@media (max-width: 900px) { .w-stats { grid-template-columns: repeat(2, 1fr); } }
.w-stat {
  padding: 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  text-align: left;
  cursor: pointer; font-family: inherit;
  transition: all 120ms;
}
.w-stat:hover {
  border-color: rgba(var(--primary-rgb, 127,13,242), 0.4);
  background: rgba(var(--primary-rgb, 127,13,242), 0.04);
}
.w-stat-value {
  font-size: 26px; font-weight: 800;
  color: var(--text-hi);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.w-stat-label { font-size: 12px; font-weight: 600; color: var(--text-md); margin-top: 4px; }
.w-stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* Quick capture */
.w-qc { display: flex; flex-direction: column; gap: 10px; }
.w-qc-tabs { display: flex; gap: 4px; }
.w-qc-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--text-lo);
  border-radius: 8px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.w-qc-tab:hover { color: var(--text-hi); }
.w-qc-tab.is-active {
  background: rgba(var(--primary-rgb, 127,13,242), 0.1);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.w-qc-tab .material-symbols-outlined { font-size: 14px; }
.w-qc-input { display: flex; gap: 8px; align-items: stretch; }
.w-qc-input .lh-input { flex: 1; }
.w-qc-input textarea.lh-input { resize: vertical; }
.w-qc-input .lh-btn { align-self: flex-end; flex-shrink: 0; }

/* Lists */
.w-list { display: flex; flex-direction: column; gap: 4px; }
.w-list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 0; border-radius: 8px;
  cursor: pointer; font-family: inherit;
  text-align: left; color: var(--text-md);
  transition: background 120ms;
}
.w-list-row:hover { background: rgba(var(--primary-rgb, 127,13,242), 0.06); }
.w-list-row > .material-symbols-outlined { font-size: 16px; color: var(--text-lo); flex-shrink: 0; }
.w-list-row .todo-prio {
  width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0;
}
.w-list-row .prio-low { background: #60a5fa; }
.w-list-row .prio-med { background: #fbbf24; }
.w-list-row .prio-high { background: #f87171; }
.w-list-row-body { flex: 1; min-width: 0; }
.w-list-row-title {
  font-size: 13px; font-weight: 500; color: var(--text-hi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.w-list-row-meta {
  font-size: 11px; color: var(--text-muted);
  display: flex; gap: 4px;
  margin-top: 1px;
}

/* Bookmark grid widget */
.w-bm-wrap { display: flex; flex-direction: column; gap: 10px; }
.w-bm-toolbar {
  display: inline-flex;
  align-self: flex-end;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 7px;
  padding: 2px;
}
.w-bm-layout-btn {
  width: 24px; height: 22px;
  border: 0; background: transparent;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-lo); cursor: pointer;
}
.w-bm-layout-btn:hover { color: var(--text-hi); }
.w-bm-layout-btn.is-active { background: var(--color-primary); color: #fff; }
.w-bm-layout-btn .material-symbols-outlined { font-size: 14px; }

.w-bm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}
.w-bm {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px;
  border-radius: 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  text-decoration: none;
  transition: all 120ms;
}
.w-bm:hover {
  border-color: rgba(var(--primary-rgb, 127,13,242), 0.4);
  transform: translateY(-2px);
}
.w-bm img { width: 28px; height: 28px; border-radius: 6px; }
.w-bm-title {
  font-size: 11px; color: var(--text-md);
  text-align: center;
  width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* List layout */
.w-bm-list { display: flex; flex-direction: column; gap: 4px; }
.w-bm-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-decoration: none; color: inherit;
  transition: all 120ms;
}
.w-bm-row:hover {
  border-color: rgba(var(--primary-rgb, 127,13,242), 0.4);
  background: rgba(var(--primary-rgb, 127,13,242), 0.04);
}
.w-bm-row img {
  width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0;
}
.w-bm-row-body { flex: 1; min-width: 0; }
.w-bm-row-title {
  font-size: 12.5px; font-weight: 600; color: var(--text-hi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.w-bm-row-url {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}

/* Compact layout (single dense lines) */
.w-bm-compact { display: flex; flex-direction: column; }
.w-bm-compact-row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  text-decoration: none; color: inherit;
  transition: background 120ms;
}
.w-bm-compact-row:hover { background: rgba(var(--primary-rgb, 127,13,242), 0.06); }
.w-bm-compact-row img { width: 16px; height: 16px; border-radius: 3px; }
.w-bm-compact-title {
  font-size: 12px; font-weight: 500; color: var(--text-hi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.w-bm-compact-url {
  font-size: 10.5px; color: var(--text-muted);
  font-family: ui-monospace, Menlo, monospace;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden; text-overflow: ellipsis;
}

/* Password widget */
.w-pw { display: flex; flex-direction: column; gap: 10px; }
.w-pw-out {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 14px; font-weight: 600;
  padding: 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  word-break: break-all;
  color: var(--color-primary);
  letter-spacing: 0.02em;
  text-align: center;
}
.w-pw-actions { display: flex; gap: 8px; }
.w-pw-actions .lh-btn { flex: 1; justify-content: center; }

/* Mini empty state */
.w-empty {
  padding: 24px; text-align: center; color: var(--text-muted);
}
.w-empty .material-symbols-outlined {
  font-size: 28px; color: var(--text-faint);
  margin-bottom: 6px;
}
.w-empty .title { font-size: 13px; font-weight: 600; color: var(--text-hi); }
.w-empty .sub { font-size: 11px; margin-top: 2px; }


/* =========================================================================
   Home widgets — Pomodoro, Habits, Mood, Reading, World clock, Ambient
   ========================================================================= */

/* ----- Pomodoro widget (v2 — full-control surface) ----- */
.w-pomo-v2 {
  display: flex; flex-direction: column;
  gap: 14px;
  height: 100%;
}
.w-pomo-header {
  display: flex; align-items: center; gap: 10px;
  min-height: 24px;
}
.w-pomo-phase-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.w-pomo-phase-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  flex-shrink: 0;
  animation: wPomoPulse 1.6s ease-in-out infinite;
}
.w-pomo-v2.status-idle .w-pomo-phase-dot,
.w-pomo-v2.status-paused .w-pomo-phase-dot { animation: none; }
@keyframes wPomoPulse { 50% { opacity: 0.45; } }
.w-pomo-task-line {
  flex: 1; min-width: 0;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-style: italic;
}

/* Stage: ring + time stacked centered */
.w-pomo-stage {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 130px;
  gap: 2px;
}
.w-pomo-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.w-pomo-ring-track {
  fill: none;
  stroke: var(--color-bg);
  stroke-width: 5;
}
html.dark .w-pomo-ring-track { stroke: rgba(255, 255, 255, 0.06); }
.w-pomo-ring-fill {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 800ms linear;
}
.w-pomo-clock-v2 {
  position: relative;
  z-index: 1;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  line-height: 1.05;
}
.w-pomo-of {
  position: relative;
  z-index: 1;
  font-size: 10.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Controls — bottom row */
.w-pomo-controls {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.w-pomo-controls .lh-btn { padding: 8px 14px; font-size: 12.5px; }
.w-pomo-controls .lh-btn.primary { flex: 1; justify-content: center; min-width: 100px; }
.w-pomo-controls .lh-btn.ghost { padding: 8px 10px; }
.w-pomo-task-input {
  flex: 1;
  min-width: 120px;
  padding: 8px 12px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-hi);
  outline: none;
  transition: border-color 120ms;
}
.w-pomo-task-input:focus { border-color: var(--color-primary); }
.w-pomo-task-input::placeholder { color: var(--text-faint); }
.w-pomo-task-input:disabled { opacity: 0.55; background: transparent; }

/* ----- Habits widget ----- */
.w-habits {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.w-habit-chip {
  --habit-color: var(--color-primary);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 9px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer; font-family: inherit;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-md);
  transition: all 120ms;
}
.w-habit-chip:hover { border-color: var(--habit-color); color: var(--text-hi); }
.w-habit-chip .material-symbols-outlined { font-size: 14px; color: var(--habit-color); }
.w-habit-chip.is-done {
  background: var(--habit-color);
  border-color: var(--habit-color);
  color: #fff;
}
.w-habit-chip.is-done .material-symbols-outlined {
  color: #fff;
  font-variation-settings: "FILL" 1;
}

/* ----- Mood widget ----- */
.w-mood {
  display: flex; flex-direction: column;
  gap: 12px;
  height: 100%;
  justify-content: center;
}
.w-mood-prompt {
  font-size: 13px;
  color: var(--text-md);
  text-align: center;
}
.w-mood-prompt strong { font-weight: 700; }
.w-mood-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.w-mood-btn {
  --mood-c: var(--text-muted);
  font-family: inherit;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  cursor: pointer;
  padding: 8px 4px;
  font-size: 22px;
  line-height: 1;
  transition: all 120ms;
}
.w-mood-btn:hover { transform: translateY(-2px); border-color: var(--text-muted); }
.w-mood-btn.is-active {
  border-color: var(--mood-c);
  background: color-mix(in oklab, var(--mood-c) 14%, var(--color-surface));
  transform: translateY(-2px);
}
.w-mood-open {
  align-self: center;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--text-muted);
}
.w-mood-open:hover { color: var(--text-hi); }
.w-mood-open .material-symbols-outlined { font-size: 13px; }

/* ----- World clock widget (v2 — selectable + analog) ----- */
.w-clocks-v2 {
  display: flex; flex-direction: column;
  gap: 10px;
}
.w-clocks-toolbar {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.w-clocks-caption { flex: 1; }
.w-clocks-caption strong {
  color: var(--text-hi);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.w-clocks-tool-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  display: inline-flex;
  transition: all 120ms;
}
.w-clocks-tool-btn:hover { color: var(--text-hi); border-color: var(--color-primary); }
.w-clocks-tool-btn.is-active {
  background: rgba(var(--primary-rgb, 127,13,242), 0.12);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.w-clocks-tool-btn .material-symbols-outlined { font-size: 14px; }

/* Picker drawer */
.w-clocks-picker {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  animation: wClockPickIn 180ms ease-out;
}
@keyframes wClockPickIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.w-clocks-picker-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer; font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-muted);
  transition: all 120ms;
}
.w-clocks-picker-chip:hover { color: var(--text-hi); border-color: var(--text-muted); }
.w-clocks-picker-chip.is-on {
  background: rgba(var(--primary-rgb, 127,13,242), 0.10);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.w-clocks-picker-chip .material-symbols-outlined { font-size: 14px; }
.w-clocks-empty {
  padding: 16px; text-align: center;
  font-size: 12px; color: var(--text-faint);
  border: 1px dashed var(--color-border);
  border-radius: 10px;
}

/* Tile grid */
.w-clocks-grid {
  display: grid;
  gap: 8px;
}
.w-clocks-grid.count-1 { grid-template-columns: 1fr; }
.w-clocks-grid.count-2 { grid-template-columns: repeat(2, 1fr); }
.w-clocks-grid.count-3 { grid-template-columns: repeat(3, 1fr); }
.w-clocks-grid.count-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
@media (max-width: 720px) {
  .w-clocks-grid.count-3, .w-clocks-grid.count-2 { grid-template-columns: 1fr; }
}

.w-clock-tile {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: border-color 120ms, transform 120ms;
  position: relative;
  overflow: hidden;
}
.w-clock-tile::before {
  content: '';
  position: absolute; inset: 0;
  opacity: 0.55;
  pointer-events: none;
}
.w-clock-tile.is-day::before {
  background: radial-gradient(ellipse 90% 60% at 80% -10%, hsla(46, 90%, 60%, 0.10), transparent 60%);
}
.w-clock-tile.is-night::before {
  background: radial-gradient(ellipse 90% 60% at 80% -10%, hsla(228, 60%, 60%, 0.10), transparent 60%);
}
.w-clock-tile:hover { border-color: var(--color-primary); }
.w-clock-tile > * { position: relative; }

/* Analog face */
.w-clock-svg { flex-shrink: 0; display: block; }
.w-clock-svg-ring {
  fill: var(--color-surface);
  stroke: var(--color-border);
  stroke-width: 0.6;
}
.w-clock-tile.is-day .w-clock-svg-ring  { fill: hsla(46, 70%, 92%, 0.9); }
.w-clock-tile.is-night .w-clock-svg-ring { fill: hsla(228, 30%, 14%, 0.85); }
html.light .w-clock-tile.is-night .w-clock-svg-ring { fill: hsla(228, 30%, 22%, 0.9); }
.w-clock-svg-tick {
  stroke: var(--text-muted);
  stroke-width: 1;
}
.w-clock-tile.is-day .w-clock-svg-tick { stroke: hsla(30, 30%, 30%, 0.7); }
.w-clock-tile.is-night .w-clock-svg-tick { stroke: hsla(228, 30%, 90%, 0.9); }
.w-clock-svg-hand {
  stroke-linecap: round;
  transition: transform 600ms cubic-bezier(0.4, 1.4, 0.5, 1);
  transform-origin: 20px 20px;
}
.w-clock-tile.is-day .w-clock-svg-hand { stroke: hsla(30, 50%, 20%, 0.95); }
.w-clock-tile.is-night .w-clock-svg-hand { stroke: hsla(228, 30%, 95%, 0.95); }
.w-clock-svg-hour { stroke-width: 2; }
.w-clock-svg-minute { stroke-width: 1.4; }
.w-clock-svg-cap {
  fill: var(--color-primary);
  stroke: none;
}

.w-clock-tile-meta { min-width: 0; }
.w-clock-tile-city {
  font-size: 13px; font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text-hi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.w-clock-tile-day {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.w-clock-tile-time {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  color: var(--text-hi);
  text-align: right;
  line-height: 1;
}
.w-clock-tile-time em {
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 3px;
  text-transform: uppercase;
}

/* ----- Ambient widget ----- */
.w-ambient {
  display: flex; flex-direction: column;
  gap: 10px;
  height: 100%;
  justify-content: center;
}
.w-ambient-prompt {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.w-ambient-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.w-ambient-btn {
  --amb-c: var(--color-primary);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 4px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  cursor: pointer; font-family: inherit;
  font-size: 10px;
  color: var(--text-lo);
  transition: all 120ms;
}
.w-ambient-btn:hover {
  border-color: var(--amb-c);
  color: var(--amb-c);
  transform: translateY(-1px);
}
.w-ambient-btn .material-symbols-outlined {
  font-size: 18px;
  color: var(--amb-c);
}
