  :root {
    --text: #f0f0f0;
    --text-secondary: rgba(240,240,240,0.65);
    --text-shadow: 0 1px 3px rgba(0,0,0,0.35);
  }

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

  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 1.2s ease;
    overflow: hidden;
  }

  /* ===== 动态天气背景 ===== */
  body.sunny  { background: linear-gradient(160deg, #1a1a2e 0%, #1b3a4b 30%, #2d6a8a 60%, #e8a850 100%); }
  body.cloudy { background: linear-gradient(160deg, #1a1a2e 0%, #2d3a4a 40%, #5a6a7a 70%, #8a9aaa 100%); }
  body.rainy  { background: linear-gradient(160deg, #0d1117 0%, #1a2332 30%, #2d3f4f 60%, #4a5a6a 100%); }
  body.snowy  { background: linear-gradient(160deg, #1a1a2e 0%, #1e2d3d 30%, #c8d8e8 60%, #e8f0f8 100%); }
  body.stormy { background: linear-gradient(160deg, #0a0a14 0%, #141428 30%, #1e1e3c 60%, #282850 100%); }
  body.foggy  { background: linear-gradient(160deg, #1a1a2e 0%, #2a2a3e 30%, #4a4a5a 60%, #6a6a7a 100%); }

  /* ===== 雨滴画布 ===== */
  #rainCanvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
  }

  /* ===== 卡片 ===== */
  .card {
    position: relative; z-index: 1;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 32px;
    padding: 44px 40px;
    width: 400px;
    text-align: center;
    box-shadow:
      0 8px 32px rgba(0,0,0,0.18),
      0 2px 8px rgba(0,0,0,0.08),
      0 0 0 1px rgba(255,255,255,0.06),
      inset 0 1px 0 rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
    animation: cardIn 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
    transition: transform 0.3s ease;
  }
  @keyframes cardIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  /* ===== 加载动画 ===== */
  .loader { display: none; margin: 40px auto; }
  .spinner {
    width: 36px; height: 36px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: rgba(255,255,255,0.8);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ===== 位置 ===== */
  .location-row {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-bottom: 2px;
  }
  .loc-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.5);
    flex-shrink: 0;
  }
  .loc-dot.ip { background: #facc15; box-shadow: 0 0 8px rgba(250,204,21,0.5); }
  .location { font-size: 24px; font-weight: 600; color: var(--text); letter-spacing: 0.5px; text-shadow: var(--text-shadow); }
  .location-sub { font-size: 12px; opacity: 0.5; margin-bottom: 8px; letter-spacing: 0.3px; color: var(--text-secondary); }

  /* ===== 天气主体 ===== */
  .weather-icon {
    font-size: 80px;
    margin: 12px 0 4px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.15));
  }
  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
  }

  .temperature {
    font-size: 80px;
    font-weight: 200;
    letter-spacing: -3px;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
    text-shadow: var(--text-shadow);
  }
  .temp-unit { font-size: 28px; font-weight: 300; opacity: 0.6; vertical-align: super; }

  .description {
    font-size: 17px;
    font-weight: 400;
    opacity: 0.75;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    color: var(--text);
    text-shadow: var(--text-shadow);
  }

  /* ===== 详情行 ===== */
  .details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 28px 0 0;
    padding: 28px 0 0;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .detail-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 4px 0;
  }
  .detail-icon { font-size: 20px; opacity: 0.7; }
  .detail-value { font-size: 15px; font-weight: 600; color: var(--text); text-shadow: var(--text-shadow); }
  .detail-label { font-size: 11px; opacity: 0.45; letter-spacing: 0.8px; color: var(--text-secondary); }

  /* ===== 刷新按钮 ===== */
  .btn {
    margin-top: 28px;
    padding: 10px 28px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50px;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
  }
  .btn:hover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
    transform: translateY(-1px);
  }
  .btn:active { transform: scale(0.97); }

  /* ===== 设置按钮 ===== */
  .settings-btn {
    position: absolute; top: 14px; right: 14px;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.55);
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
    z-index: 2;
  }
  .settings-btn:hover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
    transform: rotate(90deg);
  }

  /* ===== 设置面板 ===== */
  .settings-panel { display: none; animation: fadeIn 0.3s ease; }
  .settings-panel.show { display: block; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

  .settings-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .settings-back {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
  }
  .settings-back:hover { background: rgba(255,255,255,0.16); color: #fff; }
  .settings-title { font-size: 18px; font-weight: 600; color: var(--text); }

  .setting-group { margin-bottom: 20px; }
  .setting-group-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
    color: rgba(255,255,255,0.35); margin-bottom: 8px;
    text-align: left;
  }

  .setting-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0; gap: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 52px;
  }
  .setting-row:last-child { border-bottom: none; }
  .setting-row > div:first-child {
    display: flex; flex-direction: column; justify-content: center;
    flex: 1; min-width: 0;
  }
  .setting-label { font-size: 14px; color: var(--text); text-shadow: var(--text-shadow); line-height: 1.3; text-align: left; }
  .setting-hint { font-size: 11px; color: rgba(255,255,255,0.35); margin-top: 3px; line-height: 1.3; text-align: left; }

  /* Toggle switch */
  .toggle {
    position: relative; width: 44px; height: 26px; flex-shrink: 0;
  }
  .toggle input { opacity: 0; width: 0; height: 0; }
  .toggle-slider {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.3s ease;
  }
  .toggle-slider::before {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px;
    background: #fff; border-radius: 50%;
    transition: transform 0.3s ease;
  }
  .toggle input:checked + .toggle-slider { background: #4ade80; }
  .toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

  /* Segmented control */
  .segmented {
    display: flex; background: rgba(255,255,255,0.1); border-radius: 10px;
    overflow: hidden; flex-shrink: 0;
  }
  .segmented button {
    padding: 6px 14px; font-size: 13px;
    background: none; border: none; color: rgba(255,255,255,0.55);
    cursor: pointer; transition: all 0.2s ease;
  }
  .segmented button.active { background: rgba(255,255,255,0.2); color: #fff; font-weight: 600; }

  /* Select / time control */
  .setting-control {
    width: 96px; padding: 8px 24px 8px 10px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px; color: #f0f0f0; font-size: 14px;
    text-align: center; flex-shrink: 0;
    font-family: inherit; box-sizing: border-box;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='rgba(255,255,255,0.35)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer; outline: none;
    transition: all 0.25s ease;
  }
  .setting-control:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
  }
  .setting-control:focus {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.35);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
  }
  select.setting-control option { background: #1a1a2e; color: #f0f0f0; }

  /* Custom time display button */
  .time-display {
    padding: 8px 14px; min-width: 70px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px; color: #f0f0f0; font-size: 15px; font-weight: 500;
    font-family: inherit; cursor: pointer; text-align: center;
    transition: all 0.25s ease; flex-shrink: 0;
    letter-spacing: 1px;
  }
  .time-display:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.3);
  }
  .time-display.off {
    color: rgba(255,255,255,0.3); pointer-events: none;
  }
  .alert-row {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  }

  /* Time picker overlay */
  .tp-overlay {
    display: none; position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    justify-content: center; align-items: flex-end; padding-bottom: 20px;
  }
  .tp-overlay.show { display: flex; }
  .tp-panel {
    width: 320px; max-height: 420px;
    background: rgba(22,22,40,0.95);
    backdrop-filter: blur(30px);
    border-radius: 20px; padding: 20px 16px 16px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
    animation: tpUp 0.25s ease;
  }
  @keyframes tpUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
  .tp-title {
    text-align: center; font-size: 15px; font-weight: 600;
    color: rgba(255,255,255,0.7); margin-bottom: 16px;
  }
  .tp-columns {
    display: flex; justify-content: center; align-items: flex-start; gap: 8px;
    height: 260px; overflow: hidden;
  }
  .tp-col {
    flex: 1; max-width: 100px; height: 100%;
    overflow-y: auto; scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tp-col::-webkit-scrollbar { display: none; }
  .tp-col-item {
    height: 44px; display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: rgba(255,255,255,0.3); cursor: pointer;
    scroll-snap-align: start; border-radius: 10px;
    transition: all 0.15s ease; font-variant-numeric: tabular-nums;
  }
  .tp-col-item.active {
    color: #fff; font-weight: 600; font-size: 26px;
    background: rgba(255,255,255,0.1);
  }
  .tp-col.freq-single { max-width: 180px; }
  .tp-col-item.freq-item { font-size: 18px; white-space: nowrap; }
  .tp-col-item.freq-item.active { font-size: 22px; }
  .tp-colon {
    font-size: 26px; color: rgba(255,255,255,0.4);
    display: flex; align-items: center; height: 260px;
  }
  .tp-done {
    display: block; width: 100%; margin-top: 14px; padding: 12px;
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px; color: #fff; font-size: 15px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: all 0.2s ease;
  }
  .tp-done:hover { background: rgba(255,255,255,0.2); }

  /* About */
  .about-text { font-size: 12px; color: rgba(255,255,255,0.4); line-height: 1.8; text-align: left; }
  .about-text a { color: rgba(255,255,255,0.6); }

  /* ===== 缓存时间 ===== */
  .cache-age {
    font-size: 11px; color: rgba(255,255,255,0.3); margin-top: 8px;
    min-height: 16px; text-align: center;
  }

  /* ===== 错误 ===== */
  .error {
    color: #f87171;
    display: none;
    font-size: 13px;
    margin-top: 16px;
    padding: 8px 16px;
    background: rgba(248,113,113,0.1);
    border-radius: 10px;
    border: 1px solid rgba(248,113,113,0.15);
  }
