:root {
  --bg1: #0d1117;
  --bg2: #141a24;
  --card: rgba(255, 255, 255, 0.04);
  --card-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #6f9eff;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] {
  --bg1: #f4f6fb;
  --bg2: #ffffff;
  --card: rgba(0, 0, 0, 0.025);
  --card-hover: rgba(0, 0, 0, 0.05);
  --border: rgba(0, 0, 0, 0.08);
  --text: #1a1f2b;
  --text-dim: #6b7280;
  --accent: #3b6cf6;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(800px 500px at 15% -10%, rgba(111, 158, 255, 0.12), transparent 60%),
    radial-gradient(700px 500px at 90% 110%, rgba(160, 120, 255, 0.10), transparent 60%);
  z-index: 0;
}

.topbar {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.greeting { font-size: 14px; color: var(--text-dim); margin-bottom: 4px; }
.time { font-size: 34px; font-weight: 700; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.date { font-size: 14px; color: var(--text-dim); margin-left: 10px; }

.right { display: flex; align-items: center; gap: 14px; }
.weather { font-size: 14px; color: var(--text-dim); }
.theme-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
.theme-btn:hover { background: var(--card-hover); transform: rotate(20deg); }
html[data-theme="light"] .icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }

.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 12px 24px 60px; }

.search { margin: 22px 0 30px; }
.search-box {
  display: flex; gap: 8px; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 8px; box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111, 158, 255, 0.2); }
.search-box select {
  background: transparent; border: none; color: var(--text-dim);
  font-size: 14px; padding: 8px 6px 8px 12px; outline: none; cursor: pointer;
}
.search-box select option { color: #000; }
.search-box input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 16px; padding: 8px 6px;
}
.search-box input::placeholder { color: var(--text-dim); opacity: 0.7; }
.search-box button {
  background: linear-gradient(135deg, #4f7cff, #7c5cff); color: #fff;
  border: none; border-radius: 11px; padding: 9px 20px; font-size: 15px;
  cursor: pointer; transition: opacity 0.2s, transform 0.1s;
}
.search-box button:hover { opacity: 0.9; }
.search-box button:active { transform: scale(0.97); }

section h2 {
  font-size: 13px; color: var(--text-dim); font-weight: 600;
  letter-spacing: 2px; margin: 22px 0 12px;
}
.pinned h2 { margin-top: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }

.card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; text-decoration: none;
  color: var(--text); transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.card:hover { background: var(--card-hover); border-color: var(--accent); transform: translateY(-3px); }

.logo {
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; color: #fff;
}
.card .nm { font-size: 15px; font-weight: 600; }
.card .ds { font-size: 12px; color: var(--text-dim); }

.pinned .grid { grid-template-columns: repeat(5, 1fr); gap: 16px; }
.pinned .card { padding: 22px 18px; gap: 10px; }
.pinned .logo { width: 52px; height: 52px; border-radius: 14px; font-size: 24px; }
.pinned .nm { font-size: 16px; }

.footer {
  position: relative; z-index: 1; text-align: center;
  padding: 24px 20px 40px; font-size: 13px; color: var(--text-dim);
}
.footer a { color: var(--text-dim); text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer .dot { margin: 0 8px; opacity: 0.5; }

@media (max-width: 900px) {
  .pinned .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 600px) {
  .time { font-size: 26px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
