/**
 * style.css — 精简后的首页外观
 *
 * 顶部：时钟 | 网上搜索 | 换背景
 * 下面：日历、休息时间、工具按钮
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: #1f1f1f;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: #140e0c;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

button,
input {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid #2f7bff;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.bg-tulip {
  background-image:
    radial-gradient(ellipse 46% 58% at 74% 82%, rgba(226, 92, 18, 0.95), transparent 64%),
    radial-gradient(ellipse 26% 34% at 60% 92%, rgba(255, 186, 92, 0.85), transparent 62%),
    radial-gradient(ellipse 34% 42% at 18% 100%, rgba(110, 24, 58, 0.72), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.12) 34%, rgba(0, 0, 0, 0.38)),
    linear-gradient(165deg, #3a2a22 0%, #1c1410 42%, #120c0a 100%);
}

.bg-night {
  background-image:
    radial-gradient(ellipse 40% 50% at 80% 20%, rgba(59, 130, 246, 0.45), transparent 60%),
    radial-gradient(ellipse 50% 40% at 20% 80%, rgba(30, 41, 120, 0.8), transparent 62%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.45)),
    linear-gradient(160deg, #0b1020, #151a33 50%, #070b16);
}

.bg-sea {
  background-image:
    radial-gradient(ellipse 42% 48% at 70% 78%, rgba(20, 184, 166, 0.55), transparent 62%),
    radial-gradient(ellipse 30% 40% at 20% 20%, rgba(14, 116, 144, 0.45), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.25)),
    linear-gradient(165deg, #042f2e, #0f172a 55%, #082f49);
}

.bg-forest {
  background-image:
    radial-gradient(ellipse 40% 50% at 75% 80%, rgba(34, 197, 94, 0.4), transparent 62%),
    radial-gradient(ellipse 36% 40% at 15% 90%, rgba(21, 128, 61, 0.55), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.3)),
    linear-gradient(165deg, #14532d, #052e16 50%, #022c22);
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.42) 100%);
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 620px) 1fr;
  align-items: start;
  gap: 12px;
  margin-bottom: 22px;
  position: relative;
  z-index: 5;
}

.time {
  font-size: 56px;
  line-height: 1;
  font-weight: 500;
  color: #fff;
  letter-spacing: 1px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  font-variant-numeric: tabular-nums;
}

.date-line {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 14px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.search-block {
  width: 100%;
  justify-self: center;
}

.search-bar {
  display: flex;
  align-items: stretch;
  height: 46px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.search-bar:focus-within {
  box-shadow: 0 0 0 3px rgba(47, 123, 255, 0.35), 0 10px 28px rgba(0, 0, 0, 0.28);
}

.search-bar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  padding: 0 16px;
  font-size: 15px;
  border-radius: 12px 0 0 12px;
}

.search-bar input::placeholder {
  color: #b0b6bf;
}

.engine-btn,
.search-submit {
  height: 46px;
  border: 0;
  cursor: pointer;
}

.engine-btn {
  background: transparent;
  color: #555;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

.search-submit {
  background: #2f7bff;
  color: #fff;
  padding: 0 20px;
  font-size: 15px;
  border-radius: 0 12px 12px 0;
}

.search-submit:hover {
  background: #1f6cf0;
}

.tools {
  justify-self: end;
  display: flex;
  gap: 4px;
  padding-top: 6px;
}

.ghost-btn {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.ghost-btn:hover,
.engine-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: #fff;
  color: #222;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  z-index: 20;
}

.engine-menu {
  top: calc(100% + 10px);
  min-width: 120px;
}

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

.menu button:hover,
.menu button[aria-current="true"] {
  background: #f3f6fb;
}

.menu-title {
  margin: 2px 8px 8px;
  font-size: 12px;
  color: #888;
}

.bg-menu {
  width: 220px;
}

.swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.swatch {
  height: 36px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(180px, 240px) 1fr;
  grid-template-areas:
    "countdown calendar icons";
  gap: 14px 18px;
  align-items: start;
  flex: 1 1 auto;
}

.area-countdown { grid-area: countdown; }
.area-calendar { grid-area: calendar; }
.area-icons {
  grid-area: icons;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.card {
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.caption {
  margin: 8px 0 4px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.cal-card {
  height: 236px;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.cal-head {
  background: linear-gradient(180deg, #ffb15a, #ff9a3c);
  color: #fff;
  text-align: center;
  padding: 8px 6px;
  font-size: 14px;
}

.cal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.cal-day {
  font-size: 64px;
  line-height: 0.9;
  color: #2b2b2b;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.cal-sub {
  color: #8d8d8d;
  font-size: 12px;
}

.countdown-card {
  position: relative;
  height: 236px;
  background: rgba(255, 255, 255, 0.97);
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.countdown-card h2 {
  margin: 0;
  position: relative;
  z-index: 1;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 700;
}

.cat-wrap {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 118px;
  text-align: center;
}

.bubble {
  display: inline-block;
  background: #fff7ea;
  color: #333;
  border-radius: 12px;
  padding: 5px 8px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  margin-bottom: 2px;
}

.cat {
  width: 108px;
  height: 112px;
  display: block;
  margin: 0 auto;
}

.stats {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.stats.two {
  grid-template-columns: repeat(2, 1fr);
}

.stat {
  text-align: center;
  padding: 0 4px;
}

.stat + .stat {
  border-left: 1px solid #eee;
}

.stat-label {
  font-size: 13px;
  color: #666;
}

.stat-value {
  margin-top: 2px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
}

.stat-num {
  font-size: 26px;
  font-weight: 650;
  color: #222;
  font-variant-numeric: tabular-nums;
}

.stat-num-sm {
  font-size: 16px;
}

.stat-unit {
  font-size: 12px;
  color: #888;
}

/* 大图标：和日历卡片同高 236px */
.icons-large {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: start;
}

.icons-large:empty {
  display: none;
}

.icons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 96px);
  align-content: start;
  justify-content: start;
  gap: 18px;
}

.empty-hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.shortcut {
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.shortcut-large {
  width: 200px;
}

.tile {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease;
  overflow: hidden;
}

.tile-large {
  width: 200px;
  height: 236px;
  border-radius: 18px;
}

.shortcut:hover .tile {
  transform: translateY(-3px);
}

.tile-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
  border-radius: 12px;
}

.tile-large .tile-icon {
  width: 120px;
  height: 120px;
  border-radius: 22px;
}

.glyph {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 20px;
}

.tile-large .glyph {
  width: 120px;
  height: 120px;
  border-radius: 22px;
  font-size: 48px;
}

.shortcut-name {
  width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: #fff;
  font-size: 13px;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.shortcut-large .shortcut-name {
  width: 200px;
  font-size: 14px;
}

.site-footer {
  margin-top: auto;
  flex-shrink: 0;
  padding: 32px 0 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(520px, calc(100% - 32px));
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
}

.noscript {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  background: #fff;
  color: #222;
  padding: 12px 14px;
  border-radius: 10px;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .tools {
    justify-self: start;
  }

  .dashboard {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .widget,
  .cal-card,
  .countdown-card {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 16px;
  }

  .time {
    font-size: 42px;
  }

  .search-submit {
    padding: 0 12px;
    font-size: 14px;
  }

  .countdown-card h2 {
    padding-right: 0;
    font-size: 18px;
  }

  .cat-wrap {
    position: static;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  .cat {
    width: 84px;
    height: 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile {
    transition: none;
  }
}

/* —— 右上角用户区 —— */
.user-wrap {
  margin-left: 4px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
  max-width: 160px;
}

.user-chip:hover {
  background: rgba(255, 255, 255, 0.22);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex: 0 0 auto;
}

.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.user-menu {
  right: 0;
  min-width: 160px;
  padding: 6px;
}

.user-menu .menu-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #1f2937;
}

.user-menu .menu-item:hover {
  background: #f1f5f9;
}

.ghost-btn.tiny {
  font-size: 12px;
  padding: 4px 8px;
}

.user-sites {
  margin-top: 8px;
}

.user-sites-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.user-sites-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-sites-title {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.ghost-btn.tiny.is-active {
  background: rgba(255, 255, 255, 0.22);
}

/* 跟随鼠标的加号提示（平时隐藏） */
.add-float-tip {
  position: fixed;
  z-index: 70;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: translate(12px, 14px);
}

.shortcut.add-tile {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.tile-add {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 2px dashed rgba(255, 255, 255, 0.55);
  box-shadow: none;
  font-size: 36px;
  font-weight: 300;
  line-height: 1;
}

.shortcut.add-tile:hover .tile-add {
  background: rgba(255, 255, 255, 0.28);
  border-color: #fff;
  transform: translateY(-3px);
}

/* 编辑模式：三点菜单 */
.shortcut.has-menu {
  position: relative;
}

.shortcut.is-edit-mode {
  cursor: default;
}

.icon-more {
  position: absolute;
  top: -6px;
  right: 2px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 1px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  z-index: 3;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.icon-more:hover,
.icon-more[aria-expanded="true"] {
  background: #2563eb;
}

.icon-menu {
  position: absolute;
  top: 22px;
  right: 0;
  min-width: 132px;
  padding: 6px;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  z-index: 12;
}

.icon-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #1f2937;
}

.icon-menu button:hover {
  background: #f1f5f9;
}

.icon-menu button.danger {
  color: #b91c1c;
}

.icon-menu button.danger:hover {
  background: #fef2f2;
}

/* —— 弹窗 —— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-card {
  position: relative;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  color: #0f172a;
}

.modal-card-auth {
  padding-top: 0;
  /* 拖动时改为 fixed，由脚本写入 left/top */
}

.modal-card-auth.is-dragging {
  z-index: 90;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  user-select: none;
}

.modal-drag-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -22px 12px;
  padding: 12px 14px 10px 18px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid #e2e8f0;
  cursor: move;
  touch-action: none;
}

.modal-drag-hint {
  font-size: 12px;
  color: #94a3b8;
  user-select: none;
}

.modal-card h2 {
  margin: 0 8px 6px 0;
  font-size: 20px;
}

.modal-lead {
  margin: 0 0 14px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  z-index: 2;
}

.modal-drag-bar .modal-close {
  position: static;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex: 0 0 auto;
  cursor: pointer;
}

.modal-drag-bar .modal-close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.auth-tab {
  flex: 1;
  border: 0;
  background: #f1f5f9;
  color: #475569;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.auth-tab.active {
  background: #2563eb;
  color: #fff;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #334155;
}

.auth-form input,
.auth-form select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
}

.auth-form button[type="submit"] {
  border: 0;
  background: #2563eb;
  color: #fff;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 15px;
  cursor: pointer;
}

.auth-form button[type="submit"]:disabled {
  opacity: 0.65;
  cursor: wait;
}

.auth-form .error {
  margin: 0;
  color: #b91c1c;
  font-size: 13px;
  min-height: 18px;
}
