/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --toolbar-w: 62px;
  --accent: #f2a33c;
  --accent-grad: linear-gradient(225deg, #f7bf2d 0%, #ea8a3d 100%);
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.72);
  --glass: rgba(0, 0, 0, 0.18);
  --glass-strong: rgba(0, 0, 0, 0.3);
  --line: rgba(255, 255, 255, 0.14);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 26px calc(var(--toolbar-w) + 28px) 18px 38px;
  position: relative;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }

/* ============ 壁纸 ============ */
.wallpaper {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #1b2233;
}
.wallpaper.wp-changing { animation: wpFade 0.7s ease; }
@keyframes wpFade { from { opacity: 0.35; } to { opacity: 1; } }

.wallpaper-mask {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0,0,0,.32) 0%, rgba(0,0,0,.10) 38%, rgba(0,0,0,.30) 100%);
}

/* ============ 顶部：时钟 + 搜索 ============ */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.clock-block { width: 250px; flex-shrink: 0; padding-top: 4px; }
.clock {
  font-size: 60px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 2px;
  text-shadow: 0 2px 14px rgba(0,0,0,.25);
  font-variant-numeric: tabular-nums;
}
.date-line {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255,255,255,.92);
  display: flex;
  gap: 12px;
  text-shadow: 0 1px 6px rgba(0,0,0,.25);
}

.search-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
}
.search-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(0,0,0,.3);
}
.search-brand img { width: 26px; height: 26px; border-radius: 6px; }

.search-box {
  width: 100%;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.96);
  border-radius: 24px;
  padding: 4px 5px 4px 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: #222;
  height: 38px;
}
.search-btn {
  flex-shrink: 0;
  height: 38px;
  padding: 0 22px;
  border-radius: 20px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: filter .15s, transform .15s;
}
.search-btn:hover { filter: brightness(1.06); }
.search-btn:active { transform: scale(.97); }

.topbar-spacer { width: 250px; flex-shrink: 0; }

/* ============ 中部内容 ============ */
.main {
  position: relative;
  z-index: 10;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 18px 0;
}

/* 常用网站 */
.quick-links {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
}
.quick-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 12px;
  font-size: 15px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
  transition: background .15s, transform .15s;
  max-width: 170px;
}
.quick-item:hover { background: rgba(255,255,255,.18); transform: translateY(-1px); }
.quick-item img {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,.85);
}
.quick-item .qi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 热搜 */
.hot-panel {
  width: 100%;
  max-width: 820px;
}
.hot-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  padding-left: 4px;
}
.hot-title img { width: 16px; height: 16px; }
.hot-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 26px;
  row-gap: 2px;
}
.hot-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 14px;
  color: rgba(255,255,255,.88);
  min-width: 0;
  text-shadow: 0 1px 4px rgba(0,0,0,.3);
  transition: background .15s;
}
.hot-item:hover { background: rgba(255,255,255,.15); color: #fff; }
.hot-item img { width: 13px; height: 13px; flex-shrink: 0; }
.hot-item .hot-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 底部工具卡 ============ */
.tools-panel {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  transition: opacity .25s, height .25s;
}
.tools-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 960px;
}
.tool-card {
  width: 78px;
  height: 60px;
  border-radius: 14px;
  background: rgba(0,0,0,.24);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .15s, transform .15s, border-color .15s;
}
.tool-card:hover {
  background: rgba(0,0,0,.4);
  border-color: rgba(255,255,255,.28);
  transform: translateY(-2px);
}
.tool-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent-grad);
  overflow: hidden;
}
.tool-icon img { width: 100%; height: 100%; object-fit: cover; }
.tool-name {
  font-size: 12px;
  color: rgba(255,255,255,.92);
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.tools-hidden .tools-panel { display: none; }

.toggle-tools {
  position: fixed;
  right: calc(var(--toolbar-w) + 14px);
  bottom: 12px;
  z-index: 20;
  font-size: 13px;
  color: rgba(255,255,255,.85);
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(8px);
  padding: 5px 14px;
  border-radius: 14px;
  transition: background .15s;
}
.toggle-tools:hover { background: rgba(0,0,0,.45); }

/* ============ 右侧工具栏 ============ */
.side-toolbar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--toolbar-w);
  z-index: 40;
  background: rgba(0,0,0,.16);
  backdrop-filter: blur(16px);
  border-left: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
}
.tool-group { display: flex; flex-direction: column; align-items: center; }
.tool-group-top { padding-top: 16px; gap: 12px; }

.tool-text-btn {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,.92);
  padding: 4px 6px;
  border-radius: 8px;
  transition: background .15s;
  white-space: nowrap;
}
.tool-text-btn:hover { background: rgba(255,255,255,.16); }

.category-nav {
  margin-top: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex: 1;
}
.cat-item {
  width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.72);
  padding: 7px 0;
  border-radius: 13px;
  transition: background .15s, color .15s;
}
.cat-item img { width: 19px; height: 19px; }
.cat-item:hover { color: #fff; }
.cat-item.active {
  color: #fff;
  background: rgba(255,255,255,.18);
}

.tool-group-bottom {
  padding-bottom: 16px;
  gap: 14px;
}
.tool-icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255,255,255,.75);
  padding: 2px 0;
}
.tool-icon-btn:hover { color: #fff; }
.tool-icon-btn svg { fill: currentColor; }

/* ============ 分类内容面板 ============ */
.category-panel {
  position: fixed;
  z-index: 30;
  inset: 0 var(--toolbar-w) 0 0;
  background: rgba(0,0,0,.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.category-panel.open { opacity: 1; pointer-events: auto; }
.category-panel-card {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 88%);
  background: rgba(18, 20, 26, .72);
  backdrop-filter: blur(22px);
  border-left: 1px solid rgba(255,255,255,.12);
  padding: 26px 30px 34px;
  overflow-y: auto;
  transform: translateX(102%);
  transition: transform .28s cubic-bezier(.22,.8,.36,1);
}
.category-panel.open .category-panel-card { transform: translateX(0); }

.cp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  position: sticky;
  top: -26px;
  padding: 18px 0 14px;
  background: linear-gradient(180deg, rgba(18,20,26,.9), rgba(18,20,26,.65) 80%, transparent);
  z-index: 2;
}
.cp-title { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; }
.cp-title img { width: 24px; height: 24px; }
.cp-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  color: rgba(255,255,255,.7);
  transition: background .15s, color .15s;
}
.cp-close:hover { background: rgba(255,255,255,.14); color: #fff; }

.cp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.app-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.08);
  transition: background .15s, transform .15s, border-color .15s;
}
.app-card:hover {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.2);
  transform: translateY(-2px);
}
.app-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  background: rgba(255,255,255,.14);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-body { min-width: 0; flex: 1; }
.app-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-desc {
  font-size: 12px;
  color: rgba(255,255,255,.55);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-empty { text-align: center; color: rgba(255,255,255,.5); padding: 60px 0; font-size: 14px; }

/* ============ 弹窗 / 提示 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  width: 360px;
  background: rgba(24,26,32,.94);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; }
.modal input, .modal textarea {
  width: 100%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  margin-bottom: 10px;
  resize: vertical;
}
.modal input::placeholder, .modal textarea::placeholder { color: rgba(255,255,255,.4); }
.modal input:focus, .modal textarea:focus { border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.btn-ghost {
  padding: 8px 18px; border-radius: 10px;
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.2);
}
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-primary {
  padding: 8px 18px; border-radius: 10px;
  background: var(--accent-grad);
  color: #fff; font-weight: 500;
}
.btn-primary:hover { filter: brightness(1.07); }

.toast {
  position: fixed;
  top: 34px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: rgba(20,22,28,.92);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}

/* ============ 极简模式 ============ */
body.minimal .main,
body.minimal .tools-panel,
body.minimal .toggle-tools,
body.minimal .category-nav { display: none; }
body.minimal { justify-content: center; }
body.minimal .topbar {
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
body.minimal .clock-block,
body.minimal .topbar-spacer { width: auto; text-align: center; }
body.minimal .date-line { justify-content: center; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  body { padding-left: 22px; padding-right: calc(var(--toolbar-w) + 16px); }
  .clock-block, .topbar-spacer { width: 150px; }
  .clock { font-size: 46px; }
  .hot-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-height: 680px) {
  body { overflow-y: auto; }
  .clock { font-size: 44px; }
  .main { flex: 0 0 auto; justify-content: flex-start; padding: 14px 0; gap: 16px; }
  .tools-panel { flex: 0 0 auto; }
  .side-toolbar { overflow-y: auto; }
  .tool-group-top { padding-top: 10px; gap: 8px; }
  .category-nav { margin-top: 14px; gap: 8px; }
  .cat-item { padding: 4px 0; gap: 3px; }
  .tool-group-bottom { padding-bottom: 10px; gap: 8px; }
}
