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

body {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  height: 100vh;
  overflow: hidden;
  color: #fff;
  /* wallpaper */
  background: #1e3c72 url("background.png") center / cover no-repeat;
}

/* top bar */
#top {
  position: absolute;
  top: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  backdrop-filter: blur(10px);
  background-color: rgba(0, 0, 0, 0.25);
  color: #fff;
  z-index: 9999;
  font-size: 14px;
}

#top .brand { font-weight: 600; }

#top .menu {
  display: flex;
  gap: 18px;
}

#top .menu span {
  cursor: pointer;
  opacity: 0.9;
}

#top .menu span:hover { opacity: 1; text-decoration: underline; }

/* desktop app icons — absolutely positioned so they can be dragged around */
#desktopApps {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.appicon {
  position: absolute;
  text-align: center;
  padding: 12px;
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.6));
  width: 88px;
  cursor: grab;
  border-radius: 12px;
  user-select: none;
}

.appicon.dragging {
  cursor: grabbing;
  opacity: 0.85;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7));
}

.appicon .glyph {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  margin: 0 auto;
  overflow: hidden;
}

.appicon .glyph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* icon tiles that bring their own gradient artwork */
.appicon .glyph.tile {
  background: none;
  border: none;
}

.appicon p {
  margin: 6px 0 0;
  color: #fff;
  font-size: 13px;
}

.appicon.selected {
  background: rgba(255, 255, 255, 0.22);
  outline: 1px solid rgba(255, 255, 255, 0.5);
}

/* windows */
.window {
  border: solid 1px rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  position: absolute;
  backdrop-filter: blur(8px);
  background-color: rgba(20, 30, 55, 0.55);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  min-width: 240px;
}

.windowheader {
  width: 100%;
  display: flex;
  align-items: center;
  cursor: grab;
  justify-content: space-between;
  padding: 8px 10px;
  user-select: none;
}

.headertext {
  margin: 0;
  color: #fff;
  font-weight: 500;
}

.closebutton {
  width: 14px;
  height: 14px;
  cursor: pointer;
  background-color: #ec6b5e;
  border-radius: 16px;
  border: solid 1px rgba(0, 0, 0, 0.25);
}

.spacer { width: 14px; height: 14px; }

/* welcome window body */
.welcomebody {
  padding: 8px 24px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 380px;
}

#clock {
  font-size: 64px;
  font-weight: 200;
  letter-spacing: -2px;
}

#date {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 12px;
}

.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name { font-size: 22px; font-weight: 600; }

.tagline {
  font-size: 15px;
  opacity: 0.9;
  line-height: 1.5;
}

.links { margin-top: 4px; font-size: 15px; }
.links a { color: #fff; text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* notes app */
.appbody {
  display: flex;
  flex-direction: row;
  background-color: #fff;
  color: #1a1a1a;
  margin: 6px;
  border-radius: 12px;
  width: 560px;
  height: 420px;
  overflow: hidden;
}

#sidebar {
  width: 180px;
  border-right: 1px solid #e4e4e4;
  overflow-y: auto;
  background: #f6f7f9;
}

#sidebar .addnote {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid #ececec;
  font-weight: 600;
  font-size: 14px;
  color: #2a5298;
  background: #eef1f5;
}

#sidebar .addnote:hover { background: #e2e8f2; }

#sidebar .entry {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid #ececec;
}

#sidebar .entry:hover { background: #eef1f5; }
#sidebar .entry.active { background: #e2e8f2; }

#sidebar .entrytitle { margin: 0; font-weight: 600; font-size: 14px; }
#sidebar .entrydate { font-size: 12px; margin: 2px 0 0; color: #888; }

#notecontent {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.note-title {
  border: none;
  outline: none;
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 10px;
  width: 100%;
}

.note-body {
  border: none;
  outline: none;
  resize: none;
  flex: 1;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a1a;
  width: 100%;
}

.note-delete {
  align-self: flex-start;
  margin-top: 12px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #e0b4af;
  border-radius: 8px;
  background: #fdecea;
  color: #c0392b;
}

.note-delete:hover { background: #fbdbd7; }

/* projects app */
.projectsbody {
  display: flex;
  flex-direction: row;
  margin: 6px;
  border-radius: 12px;
  width: 640px;
  height: 440px;
  overflow: hidden;
  background: rgba(10, 16, 30, 0.6);
}

.projects-list {
  width: 260px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
}

.filters {
  display: flex;
  gap: 6px;
  padding: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.filter-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: #dfe6f2;
}

.filter-pill:hover { background: rgba(255, 255, 255, 0.18); }
.filter-pill.active { background: #fff; color: #14203a; font-weight: 600; }

#projectGrid { overflow-y: auto; flex: 1; padding: 8px; }

.project-card {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  border-left: 3px solid #6dd5ed;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.project-card:hover { background: rgba(255, 255, 255, 0.12); }
.project-card.active { background: rgba(255, 255, 255, 0.18); }

.project-name { margin: 0; font-weight: 600; font-size: 14px; color: #fff; }
.project-tag { margin: 3px 0 0; font-size: 12px; color: #b9c4d6; line-height: 1.35; }

.projects-detail {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  color: #eaf0fa;
}

.project-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #14203a;
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.projects-detail h2 { margin: 0 0 6px; font-size: 24px; color: #fff; }
.detail-tag { font-size: 15px; color: #cdd8ea; font-style: italic; margin: 0 0 16px; }
.detail-body { font-size: 15px; line-height: 1.65; color: #dbe3f0; }

/* calculator app */
.calcbody {
  margin: 6px;
  border-radius: 12px;
  width: 260px;
  padding: 14px;
  background: #1b1b1f;
}

.calc-display {
  color: #fff;
  font-size: 44px;
  font-weight: 300;
  text-align: right;
  padding: 12px 10px 18px;
  min-height: 64px;
  overflow: hidden;
  word-break: break-all;
}

.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.ckey {
  border: none;
  border-radius: 999px;
  height: 52px;
  font-size: 20px;
  cursor: pointer;
  background: #333338;
  color: #fff;
  transition: filter 0.1s;
}

.ckey:hover { filter: brightness(1.2); }
.ckey:active { filter: brightness(0.85); }
.ckey.fn { background: #a5a5aa; color: #1b1b1f; }
.ckey.op { background: #ff9f0a; color: #fff; font-size: 24px; }
.ckey.op.armed { background: #fff; color: #ff9f0a; }
.ckey.eq { background: #ff9f0a; color: #fff; font-size: 24px; }
.ckey.zero { grid-column: span 2; border-radius: 999px; text-align: left; padding-left: 22px; }

/* weather app */
.weatherbody {
  margin: 6px;
  border-radius: 12px;
  width: 360px;
  padding: 16px;
  background: linear-gradient(160deg, #2b5876, #4e4376);
  color: #fff;
}

.weather-search { display: flex; gap: 8px; margin-bottom: 14px; }

.weather-search input {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

.weather-search button {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  color: #2b5876;
  font-weight: 600;
}

.weather-search button:hover { background: #fff; }
.unit-toggle { min-width: 40px; }
.weather-search .icon-btn { padding: 8px; display: flex; align-items: center; justify-content: center; }

.weather-current {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 0 16px;
  min-height: 96px;
}

.weather-current .wtemp { font-size: 52px; font-weight: 200; line-height: 1; }
.weather-current .wplace { font-size: 16px; font-weight: 600; }
.weather-current .wcond { font-size: 14px; opacity: 0.9; }
.weather-current .wfeels { font-size: 13px; opacity: 0.75; margin-top: 2px; }
.weather-loading, .weather-error { padding: 16px 0; opacity: 0.9; font-size: 14px; }

.weather-forecast {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 14px;
}

.wday {
  flex: 1;
  text-align: center;
  font-size: 12px;
}

.wday .wdname { opacity: 0.85; margin-bottom: 6px; }
.wday svg { display: block; margin: 0 auto 6px; }
.wday .whi { font-weight: 600; }
.wday .wlo { opacity: 0.7; }

/* gallery app */
.gallerybody {
  margin: 6px;
  border-radius: 12px;
  width: 560px;
  height: 420px;
  background: #14203a;
  overflow: hidden;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px;
  height: 100%;
  overflow-y: auto;
}

.gallery-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
}

.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 3px 6px;
}

.gallery-viewer {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  padding: 16px;
}

.gallery-viewer img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  object-fit: contain;
}

.gallery-caption { color: #fff; font-size: 14px; }

#galleryBack {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

#galleryBack:hover { background: rgba(255, 255, 255, 0.28); }

/* web search app */
.searchbody {
  margin: 6px;
  border-radius: 12px;
  width: 400px;
  padding: 20px;
  background: linear-gradient(160deg, #1e2a4a, #2a3f6b);
  color: #fff;
}

.web-search { display: flex; gap: 8px; }

.web-search input {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
}

.web-search button {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  background: #fff;
  color: #2a3f6b;
  font-weight: 600;
}

.web-search button:hover { background: #e9eefc; }

.engines { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.engine-pill {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  color: #dfe6f2;
}

.engine-pill:hover { background: rgba(255, 255, 255, 0.22); }
.engine-pill.active { background: #fff; color: #2a3f6b; font-weight: 600; }

.search-note { margin-top: 14px; font-size: 12px; opacity: 0.7; }

/* settings app */
.settingsbody {
  margin: 6px;
  border-radius: 12px;
  width: 340px;
  max-height: 460px;
  overflow-y: auto;
  padding: 18px;
  background: #f4f5f8;
  color: #1a1a1a;
}

.setting-group { margin-bottom: 20px; }
.setting-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: #888; margin-bottom: 10px; }

.wallpaper-options { display: flex; gap: 10px; flex-wrap: wrap; }

.wallpaper-swatch {
  width: 60px;
  height: 42px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  background-size: cover;
  background-position: center;
}

.wallpaper-swatch.active { border-color: #2a5298; }

.setting-btn {
  border: 1px solid #d0d4dc;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  background: #fff;
  color: #1a1a1a;
  font-size: 14px;
}

.setting-btn:hover { background: #eef1f6; }
.setting-btn.danger { border-color: #e0b4af; background: #fdecea; color: #c0392b; }
.setting-btn.danger:hover { background: #fbdbd7; }

.setting-group.about p { font-size: 14px; margin-bottom: 4px; }
.setting-group.about .muted { color: #888; font-size: 13px; }
