:root {
  --bg: #090b13;
  --glass-edge: rgba(255, 255, 255, 0.36);
  --text: #eff6ff;
  --muted: #b7c5da;
  --accent: #9fd7ff;
  --good: #88f0bc;
  --warn: #ffd26d;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  font-family: "Inter", system-ui, sans-serif;
  background: radial-gradient(circle at 0% 0%, #11182a 0%, var(--bg) 52%, #06070b 100%);
  color: var(--text);
  overflow-x: hidden;
}

body {
  position: relative;
  padding: 1.2rem 1.2rem 4.8rem;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.45;
  z-index: 0;
  animation: drift 14s ease-in-out infinite alternate;
}

.ambient-1 {
  width: 340px;
  height: 340px;
  background: linear-gradient(120deg, #3bb2ff, #7f96ff);
  left: -80px;
  top: -50px;
}

.ambient-2 {
  width: 300px;
  height: 300px;
  background: linear-gradient(120deg, #23d8af, #31c5ff);
  right: -90px;
  bottom: 20%;
  animation-delay: 4s;
}

.ambient-3 {
  width: 260px;
  height: 260px;
  background: linear-gradient(120deg, #9f7cff, #4ec8ff);
  right: 25%;
  top: 35%;
  animation-delay: 2s;
}

.dashboard {
  position: relative;
  z-index: 1;
  max-width: 1300px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.tile {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08)) border-box,
    rgba(20, 24, 36, 0.4) padding-box;
  border: 1px solid transparent;
  border-top-color: var(--glass-edge);
  border-left-color: rgba(255, 255, 255, 0.28);
  border-radius: 1.4rem;
  padding: 1rem;
  backdrop-filter: blur(20px) saturate(120%);
  box-shadow: var(--shadow);
}

.tile-time,
.tile-weather,
.tile-focus,
.tile-system { grid-column: span 3; min-height: 210px; }

.tile-news { grid-column: span 6; min-height: 295px; }
.tile-links,
.tile-todo { grid-column: span 3; }
.tile-notes { grid-column: span 12; }

.tile-label {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 600;
}

#clock { margin: 0.5rem 0 0.2rem; font-size: clamp(2rem, 4.5vw, 3.2rem); }
#greeting { color: var(--good); margin-top: 0.5rem; }

#date,
#weatherDetail,
#weatherExtra,
#activity,
#connectionState,
#batteryState,
#streak,
#visibilityState {
  margin: 0.45rem 0 0;
  color: #d8e5ff;
}

.tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.toolbar { display: inline-flex; gap: 0.3rem; }

.icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 0.7rem;
  min-width: 2rem;
  height: 2rem;
  cursor: pointer;
  padding: 0 0.55rem;
}

.active-chip { border-color: rgba(159, 215, 255, 0.8); color: var(--accent); }
.icon-btn:hover { background: rgba(255, 255, 255, 0.18); }

.news-list {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.7rem;
}

.news-list a { color: var(--accent); text-decoration: none; }
.news-list a:hover { text-decoration: underline; }

.link-grid {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.link-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  text-decoration: none;
  color: var(--text);
  padding: 0.65rem 0.75rem;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.link-chip:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.14); }
.kill-link { opacity: 0.75; }
#focusQuote { margin: 0.6rem 0; font-weight: 500; line-height: 1.35; }

.todo-form { display: flex; gap: 0.45rem; margin: 0.55rem 0; }

#todoInput,
.command-form input {
  flex: 1;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 0.6rem;
  color: var(--text);
  background: rgba(8, 14, 28, 0.45);
}

.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.todo-list li { display: flex; gap: 0.45rem; align-items: center; font-size: 0.93rem; }
.todo-list li.done span { text-decoration: line-through; opacity: 0.6; }

#notes {
  margin-top: 0.6rem;
  width: 100%;
  min-height: 125px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  padding: 0.8rem;
  font: inherit;
  color: var(--text);
  background: rgba(8, 14, 28, 0.45);
}

.bottom-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  pointer-events: none;
}

.drawer-toggle {
  pointer-events: auto;
  display: block;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-bottom: none;
  border-radius: 0.9rem 0.9rem 0 0;
  padding: 0.4rem 0.9rem;
  color: var(--text);
  background: rgba(12, 18, 30, 0.8);
  cursor: pointer;
}

.drawer-panel {
  pointer-events: auto;
  transform: translateY(calc(100% - 42px));
  transition: transform 250ms ease;
  background: rgba(8, 14, 24, 0.75);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  padding: 0.8rem 1rem 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.bottom-drawer.open .drawer-panel { transform: translateY(0%); }
.bottom-drawer.open .drawer-toggle { color: var(--accent); }

.drawer-card {
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.17);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.7rem;
  min-height: 130px;
}

.drawer-big {
  margin: 0.45rem 0;
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
}

.drawer-controls {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.compact-list {
  margin: 0.5rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.25rem;
}

.command-form { display: flex; gap: 0.35rem; margin-top: 0.5rem; }
.muted { color: var(--muted); margin-top: 0.5rem; }

.habit-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.3rem;
  margin-top: 0.55rem;
}

.habit-cell {
  border: 1px solid rgba(255, 255, 255, 0.2);
  height: 28px;
  border-radius: 0.45rem;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  cursor: pointer;
}

.habit-cell.done {
  background: rgba(136, 240, 188, 0.27);
  border-color: rgba(136, 240, 188, 0.6);
}


#featureSearch {
  width: 100%;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 0.6rem;
  color: var(--text);
  background: rgba(8, 14, 28, 0.45);
  margin-top: 0.55rem;
}

.drawer-card-wide {
  grid-column: span 4;
}

.feature-deck {
  margin-top: 0.55rem;
  max-height: 210px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
  padding-right: 0.3rem;
}

.feature-pill {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.55rem;
  padding: 0.3rem 0.4rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.72rem;
  cursor: pointer;
}

.feature-pill.active {
  border-color: rgba(136, 240, 188, 0.7);
  background: rgba(136, 240, 188, 0.2);
}
.screensaver {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 350ms ease;
}

.screensaver.active { opacity: 1; pointer-events: auto; }

.screensaver-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(58, 125, 255, 0.55), transparent 30%),
    radial-gradient(circle at 80% 80%, rgba(12, 200, 168, 0.45), transparent 27%),
    linear-gradient(125deg, #04060a 0%, #0c1022 52%, #0b1f2f 100%);
  animation: driftHue 16s linear infinite;
}

.stars { position: absolute; inset: 0; overflow: hidden; }

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.85;
  animation: twinkle 2.5s ease-in-out infinite alternate;
}

.screensaver-content {
  position: relative;
  max-width: 760px;
  margin: 1rem;
  text-align: center;
  padding: 2.2rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(5, 8, 20, 0.45);
  backdrop-filter: blur(12px);
}

#screensaverQuote { margin: 0.8rem 0; font-size: clamp(1.5rem, 4vw, 2.3rem); }
#screensaverClock { font-size: clamp(1.8rem, 6vw, 3.8rem); margin: 0.5rem 0; }

@keyframes drift { from { transform: translateY(-12px) translateX(-8px); } to { transform: translateY(14px) translateX(9px); } }
@keyframes driftHue { from { filter: hue-rotate(0deg) brightness(100%); } to { filter: hue-rotate(360deg) brightness(110%); } }
@keyframes twinkle { from { opacity: 0.25; transform: scale(1); } to { opacity: 0.9; transform: scale(1.8); } }

@media (max-width: 1180px) {
  .tile-time,
  .tile-weather,
  .tile-focus,
  .tile-system,
  .tile-links,
  .tile-todo { grid-column: span 6; }

  .tile-news,
  .tile-notes { grid-column: span 12; }

  .drawer-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-card-wide { grid-column: span 2; }
}

@media (max-width: 680px) {
  .dashboard { grid-template-columns: repeat(6, 1fr); }
  .tile { grid-column: span 6 !important; }
  body { padding: 0.8rem 0.8rem 5rem; }
  .drawer-panel { grid-template-columns: 1fr; }
  .drawer-card-wide { grid-column: span 1; }
  .feature-deck { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
