:root{
  --bg1: #0f172a;
  --bg2: #071019;
  --glass: rgba(255,255,255,0.06);
  --glass-2: rgba(255,255,255,0.04);
  --accent: #7dd3fc;
  --muted: rgba(255,255,255,0.6);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: radial-gradient(1000px 600px at 10% 10%, rgba(125,211,252,0.06), transparent),
              radial-gradient(800px 500px at 90% 90%, rgba(124,58,237,0.04), transparent),
              linear-gradient(180deg,var(--bg1),var(--bg2));
  color:#e6eef8;
  -webkit-font-smoothing:antialiased;
}
.shell{
  min-height:100vh;
  display:block;
  padding:24px;
  position:relative;
}
.hero{
  position:relative;
  min-height:calc(100vh - 48px);
  border-radius:14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  box-shadow: 0 10px 40px rgba(2,6,23,0.6);
  border:1px solid rgba(255,255,255,0.04);
  overflow:hidden;
}
.corner{position:absolute;z-index:6}
.corner.tl{top:18px;left:18px}
.corner.tr{top:18px;right:18px}
/* weather widget in top-right */
.weather-widget{display:flex;align-items:center;gap:10px;padding:8px 12px;border-radius:12px;background:rgba(255,255,255,0.03);backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,0.03);box-shadow:0 6px 18px rgba(2,6,23,0.35);color:var(--muted)}
.weather-widget .weather-main{display:flex;flex-direction:column;align-items:flex-end;line-height:1}
.weather-widget .weather-city{font-size:13px;color:var(--muted)}
.weather-widget .weather-temp{font-size:18px;font-weight:700;color:var(--accent);}
.weather-widget .weather-desc{font-size:12px;color:rgba(230,238,248,0.6)}
.weather-widget .weather-icon{width:44px;height:44px;border-radius:8px;object-fit:cover}
.weather-refresh{background:transparent;border:0;color:var(--muted);cursor:pointer;padding:6px;border-radius:8px}
.weather-refresh:hover{color:white;transform:translateY(-2px)}
.weather-settings-btn{background:transparent;border:0;color:var(--muted);cursor:pointer;padding:6px;border-radius:8px}
.weather-settings-btn:hover{color:white;transform:translateY(-2px)}
.weather-settings-panel{position:absolute;right:0;top:110%;background:rgba(6,10,20,0.96);padding:10px;border-radius:10px;border:1px solid rgba(255,255,255,0.04);display:none;min-width:220px;z-index:30}
.weather-settings-panel[aria-hidden="false"]{display:block}
.weather-settings-panel label{display:flex;flex-direction:column;color:var(--muted);font-size:13px;margin-bottom:8px}
.weather-settings-panel input{margin-top:6px;padding:8px;border-radius:8px;border:1px solid rgba(255,255,255,0.04);background:rgba(255,255,255,0.02);color:inherit}
.weather-settings-panel .settings-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:8px}
.weather-settings-panel .btn{padding:8px 10px;border-radius:8px;background:linear-gradient(90deg,var(--accent),#a78bfa);border:0;color:#06202a;cursor:pointer}
.weather-settings-panel .btn.alt{background:transparent;border:1px solid rgba(255,255,255,0.04);color:var(--muted)}

/* Hover & micro-interaction animations */
/* weather widget lift */
.weather-widget{transition:transform .22s cubic-bezier(.2,.9,.2,1), box-shadow .22s ease, filter .22s;}
.weather-widget:hover{transform: translateY(-6px) scale(1.02); box-shadow:0 20px 50px rgba(2,6,23,0.6); filter:saturate(120%);}

/* search plate subtle lift on hover when not focused */
.search:not(.focused):hover{transform: translateY(-4px) scale(1.01);}

/* engine button and go button micro-interactions */
.search .engine-select button{transition: transform .18s ease, color .16s ease, box-shadow .18s;}
.search .engine-select button:hover{transform: translateY(-2px) scale(1.02); color: #f8feff}
.search button.go{transition: transform .22s cubic-bezier(.2,.9,.2,1), box-shadow .22s, filter .18s;}
.search button.go:hover{transform: translateY(-6px) scale(1.03); box-shadow: 0 14px 40px rgba(10,120,160,0.22)}
.search input[type=search]{transition: box-shadow .18s ease, transform .18s, background .18s}
.search input[type=search]:hover{box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02)}

/* suggestion items smoother hover and slight slide */
.suggestions li{transition: background .12s ease, transform .12s cubic-bezier(.2,.9,.2,1), color .12s}
.suggestions li:hover, .suggestions li[aria-selected="true"]{transform: translateX(6px); background:rgba(255,255,255,0.03); color:white}

/* quick-links / links grid: smoother pop */
.quick-links a, .links-grid a{transition: transform .18s ease, box-shadow .18s ease, background .18s}
.quick-links a:hover, .links-grid a:hover{transform:translateY(-6px); box-shadow:0 12px 30px rgba(2,6,23,0.3)}

/* subtle icon hover */
.weather-icon{transition: transform .22s ease, opacity .18s}
.weather-icon:hover{transform: translateY(-4px) scale(1.04)}
.corner.bl{bottom:18px;left:18px}
.corner.br{bottom:18px;right:18px}

/* 页面设置按钮样式 */
.page-settings-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-settings-btn:hover {
  color: white;
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.05);
}

/* 页面设置面板样式 */
.page-settings-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(6, 10, 20, 0.96);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 -10px 30px rgba(2, 6, 23, 0.5);
  display: none;
  z-index: 40;
  max-height: 80vh;
  overflow-y: auto;
}

.page-settings-panel[aria-hidden="false"] {
  display: block;
}

.page-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.page-settings-header h3 {
  margin: 0;
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
}

.page-settings-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-settings-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.setting-group {
  margin-bottom: 24px;
}

.setting-group h4 {
  margin: 0 0 12px 0;
  color: #e6eef8;
  font-size: 15px;
  font-weight: 600;
}

.links-settings {
  margin-bottom: 12px;
}

.link-setting-item {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  align-items: center;
}

.link-setting-item input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font-size: 14px;
}

.link-setting-item input::placeholder {
  color: rgba(230, 238, 248, 0.5);
}

.link-icon {
  flex: 0 0 80px !important;
  text-align: center;
}

.remove-link-btn {
  background: rgba(255, 100, 100, 0.2);
  border: 1px solid rgba(255, 100, 100, 0.3);
  color: #ff6666;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-link-btn:hover {
  background: rgba(255, 100, 100, 0.3);
}

.add-link-btn {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  width: 100%;
  text-align: center;
}

.add-link-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: white;
  border-style: solid;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.background-settings {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.background-option {
  margin-bottom: 12px;
}

.background-option:last-child {
  margin-bottom: 0;
}

.background-option label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.background-option input[type="radio"] {
  margin: 0;
}

.color-picker {
  width: 40px;
  height: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  margin-left: 25px;
}

.gradient-controls {
  display: flex;
  gap: 10px;
  margin-left: 25px;
}

.image-url-input {
  width: calc(100% - 30px);
  margin-left: 25px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font-size: 14px;
}

.image-url-input::placeholder {
  color: rgba(230, 238, 248, 0.5);
}

.settings-actions .btn {
  padding: 8px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border: 0;
  color: #06202a;
  cursor: pointer;
}

.settings-actions .btn.alt {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.center-area{position:absolute;left:0;right:0;top:18vh;display:flex;flex-direction:column;align-items:center;justify-content:flex-start}

/* scrim used to dim/blur the outside when search is focused */
.scrim{
  position:fixed;
  inset:0;
  background: rgba(3,6,12,0.45);
  backdrop-filter: blur(6px) saturate(80%);
  -webkit-backdrop-filter: blur(6px) saturate(80%);
  opacity:0;
  pointer-events:none;
  transition:opacity .22s ease;
  z-index:7;
}

/* when scrim visible, allow it to receive clicks */
.scrim.visible{opacity:1;pointer-events:auto}

/* search sits on a single frosted-glass plate (with transitions) */
.search{
  display:flex;
  align-items:center;
  z-index:8;
  gap:0;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border-radius:20px;
  padding:8px;
  border:1px solid rgba(255,255,255,0.04);
  box-shadow: 0 6px 20px rgba(2,6,23,0.40);
  max-width:640px;
  width:min(86vw,640px);
  transition: transform .22s cubic-bezier(.2,.9,.2,1), box-shadow .22s ease, filter .22s ease;
  will-change: transform, box-shadow;
}

/* focused state: show scrim and slightly scale up the search plate with extra effects */
.search.focused{
  transform: scale(1.06) translateZ(0);
  box-shadow: 0 18px 60px rgba(2,6,23,0.65);
  filter: saturate(120%);
}

.search > *{position:relative}
.search .engine-select{display:flex;align-items:center}
.search .engine-select button{min-width:96px;background:transparent;border:0;color:var(--muted);padding:10px 12px;border-radius:16px;font-size:14px;transition:transform .26s cubic-bezier(.2,.9,.2,1), color .18s}
.search input[type=search]{flex:1;min-width:160px;padding:12px 14px;border-radius:14px;background:transparent;border:0;font-size:15px;transition: box-shadow .22s ease, transform .18s}
.search button.go{padding:10px 14px;border-radius:18px;border:0;background:linear-gradient(90deg,var(--accent),#a78bfa);color:#06202a;font-weight:600;cursor:pointer;font-size:14px;transition: transform .22s cubic-bezier(.2,.9,.2,1), box-shadow .2s}

/* subtle separators: place on the right edge of engine-select and input so they sit between items */
.search .engine-select::after,
.search input[type=search]::after{
  content: '';
  position: absolute;
  right: 6px; /* inside the element */
  top: 12%;
  bottom: 12%;
  width: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border-radius:1px;
  pointer-events: none;
  z-index:2;
  opacity:0;
  transform: translateY(0);
  transition: opacity .26s ease, transform .28s cubic-bezier(.2,.9,.2,1);
}

/* reserve space so separator sits clear of the next element */
.search .engine-select, .search input[type=search]{padding-right:10px}

/* give the button a larger left margin and higher z-index so it doesn't overlap the separator */
.search button.go{margin-left:10px;z-index:5}

.search.focused .engine-select button{transform: translateY(-3px); color: #eafcff}
.search.focused input[type=search]{transform: translateY(-1px)}
.search.focused button.go{transform: translateY(-4px); box-shadow: 0 8px 28px rgba(10,120,160,0.18)}

/* input wrap and suggestion list */
.input-wrap{position:relative;display:flex;flex-direction:column;flex:1}
.suggestions{position:absolute;left:0;right:0;top:calc(100% + 8px);margin:0;padding:8px;border-radius:14px;background:rgba(6,10,20,0.95);list-style:none;max-height:220px;overflow:auto;border:1px solid rgba(255,255,255,0.04);box-shadow: 0 10px 30px rgba(2,6,23,0.6);z-index:20;display:none}
.suggestions.show{display:block}
.suggestions li{padding:10px 12px;border-radius:10px;color:var(--muted);cursor:pointer}
.suggestions li:hover, .suggestions li[aria-selected="true"]{background:rgba(255,255,255,0.02);color:white}

/* reduce visual weight of individual elements (no own borders) */
.search .engine-select button:focus, .search input[type=search]:focus, .search button.go:focus{outline:none;box-shadow:none}
.search .engine-select button:focus-visible, .search input[type=search]:focus-visible, .search button.go:focus-visible{outline:3px solid rgba(125,211,252,0.12);outline-offset:3px}

/* separators fade/slide in when focused */
.search.focused .engine-select::after,
.search.focused input[type=search]::after{
  opacity:1;
  transform: translateY(-1px);
}

.quick-links a{margin-left:10px;text-decoration:none;color:var(--muted);display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--glass-2);backdrop-filter: blur(6px);border:1px solid rgba(255,255,255,0.02);transition:all .18s}

.quick-links a:hover{transform:translateY(-3px);color:white}

.center-clock-wrap{display:flex;justify-content:center;align-items:center;margin-bottom:18px}
.clock{font-weight:800;color:var(--accent);font-size:56px;padding:0;margin:0;background:transparent;border:0;line-height:1}
/* glow + subtle pulse */
.clock{
  text-shadow: 0 8px 30px rgba(125,211,252,0.12), 0 2px 8px rgba(0,0,0,0.6);
  filter: drop-shadow(0 12px 40px rgba(125,211,252,0.06));
}

.links-grid{display:grid;grid-auto-flow:column;gap:10px;align-items:center}

.links-grid a{display:inline-block;padding:8px 10px;border-radius:10px;background:rgba(255,255,255,0.02);color:var(--muted);text-decoration:none;border:1px solid rgba(255,255,255,0.02);transition:transform .15s}

.links-grid a:hover{transform:translateY(-4px);color:white}

.hint{background:var(--glass);padding:8px 12px;border-radius:10px;color:rgba(230,238,248,0.64);font-size:13px;border:1px solid rgba(255,255,255,0.03)}

.engine-select{position:relative}
.engine-select button{display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:16px;background:var(--glass);border:1px solid rgba(255,255,255,0.04);color:var(--muted);cursor:pointer}
.engine-select .caret{width:14px;height:14px;fill:var(--muted);opacity:0.9}
.engine-select ul{position:absolute;left:0;top:110%;min-width:180px;background:rgba(6,10,20,0.92);border-radius:10px;padding:8px 6px;border:1px solid rgba(255,255,255,0.04);list-style:none;margin:6px 0 0 0;display:none;z-index:12}
.engine-select ul.show{display:block}
.engine-select li{padding:8px 10px;border-radius:8px;color:var(--muted);cursor:pointer}
.engine-select li:hover{background:rgba(255,255,255,0.02);color:white}
/* fallback generic input/button styles (overridden above in .search) */
input[type=search]{flex:1;padding:12px 14px;border-radius:14px;background:transparent;border:1px solid rgba(255,255,255,0.06);color:inherit;font-size:16px;outline:none}
input[type=search]::placeholder{color:rgba(230,238,248,0.6)}
button.go{padding:10px 14px;border-radius:12px;border:0;background:linear-gradient(90deg,var(--accent),#a78bfa);color:#06202a;font-weight:600;cursor:pointer}
.hero{padding:24px}

@media (max-width:880px){
  .quick-links a{width:36px;height:36px}
  input[type=search]{min-width:220px}
}

@media (max-width:768px){
  .shell {
    padding: 16px;
  }
  
  .hero {
    min-height: calc(100vh - 32px);
  }
  
  .corner.tl, .corner.tr, .corner.bl, .corner.br {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    margin: 10px;
    display: flex;
    justify-content: center;
  }
  
  .corner.tl {
    order: 1;
  }
  
  .corner.tr {
    order: 2;
  }
  
  .center-area {
    position: relative;
    top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    padding: 0 10px;
  }
  
  .corner.bl {
    order: 3;
    margin-bottom: 20px;
  }
  
  .hero {
    display: flex;
    flex-direction: column;
  }
  
  .quick-links, .links-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }
  
  .weather-widget {
    margin: 0 auto;
  }
  
  .weather-widget .weather-main .weather-city,
  .weather-widget .weather-main .weather-desc {
    font-size: 12px;
  }
  
  .weather-widget .weather-main .weather-temp {
    font-size: 16px;
  }
  
  .weather-icon {
    width: 36px;
    height: 36px;
  }
}

@media (max-width:640px){
  .center-area{top:12vh}
  .search{width:calc(100% - 32px); margin:0 16px; max-width:unset}
  .search{padding:6px}
  .search .engine-select button{padding:10px;border-radius:14px}
  .search input[type=search]{padding:12px;border-radius:12px;font-size:15px}
  .search button.go{padding:10px 14px;border-radius:14px}
  .suggestions{left:16px;right:16px}
  .suggestions li{padding:12px 14px}
  .weather-widget{padding:6px 8px;gap:8px}
  /* collapse weather text to icon + tooltip */
  .weather-widget .weather-main{display:none}
  .weather-icon{width:40px;height:40px}
  
  /* 在640px以下隐藏除搜索框和时间外的全部按钮 */
  .weather-refresh{display:none}
  .weather-settings-btn{display:none}
  .search .go{display:none}
  .quick-links a{display:none}
  .links-grid a{display:none}
  .engine-select button{display:none}
  
  /* 在640px以下隐藏整个天气组件 */
  .corner.tr{display:none}
}

@media (max-width:520px){
  .center-area{padding:20px}
  input[type=search]{min-width:140px;font-size:14px}
  .engine-select button span#engineName{display:none}
  .quick-links{display:none}
  .clock{font-size:18px}
  /* 在手机端隐藏天气和搜索按钮 */
  .weather-refresh{display:none}
  .weather-settings-btn{display:none}
  .search .go{display:none}
}

/* Enhanced responsive behavior */
@media (max-width:980px){
  .search{width:calc(100% - 48px); max-width:900px; margin:0 24px;}
  .search .engine-select button{min-width:72px;padding:10px;border-radius:12px}
  .search button.go{padding:10px 12px}
  .suggestions{left:24px; right:24px; top: calc(100% + 10px);}
}

@media (max-width:420px){
  /* phone layout: make search take full width and increase touch targets */
  .center-area{top:10vh;padding:12px}
  .search{width:100%; margin:0; border-radius:16px; padding:8px}
  .search .engine-select{margin-right:8px}
  .search input[type=search]{font-size:16px;padding:14px;border-radius:12px}
  .search button.go{padding:12px 16px;font-size:15px}
  .suggestions{left:8px;right:8px;top:calc(100% + 10px)}
  .clock{font-size:20px}
  /* hide less important corners */
  .corner.tr, .corner.br{display:none}
  .corner.tl{left:12px;top:12px}
  .corner.bl{left:12px;bottom:12px}
}

/* Provide a compact weather tooltip when collapsed */
.weather-widget[aria-expanded="false"] .weather-main{display:none}
.weather-widget[aria-expanded="true"] .weather-main{display:flex}

/* small focus styles */
:focus{outline:3px solid rgba(125,211,252,0.14);outline-offset:2px}

/* Additional responsive improvements for better mobile experience */
@media (max-height: 700px) and (max-width: 768px) {
  .clock {
    font-size: 36px;
  }
  
  .center-area {
    margin: 10px 0;
  }
  
  .corner {
    margin: 5px;
  }
}

@media (max-height: 500px) and (max-width: 768px) {
  .clock {
    font-size: 24px;
  }
  
  .links-grid {
    display: none;
  }
}
