:root {
  --luna-border: #0831d9;
  --face: #ece9d8;
  --text: #222;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: Tahoma, "Segoe UI", sans-serif;
  color: var(--text);
  user-select: none;
  background: #000;
}
button, input, textarea { font-family: inherit; }
input, textarea, .window-body, .ie-page, .tab-panel { user-select: text; }
code { font-family: "Lucida Console", Consolas, monospace; font-size: 12px; }

/* ---------- Boot ---------- */
#boot, #welcome {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}
#boot {
  background: #000;
  gap: 28px;
  cursor: pointer;
}
.boot-flag {
  width: 84px;
  height: 84px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  transform: rotate(-8deg);
}
.boot-flag span { border-radius: 4px 12px 4px 4px; }
.boot-flag span:nth-child(1) { background: #f33; }
.boot-flag span:nth-child(2) { background: #6c3; }
.boot-flag span:nth-child(3) { background: #3af; }
.boot-flag span:nth-child(4) { background: #fc3; }
.boot-title {
  font-family: "Franklin Gothic Medium", Tahoma, sans-serif;
  font-size: 42px;
  letter-spacing: 1px;
}
.boot-title em { font-style: italic; font-weight: 700; color: #7ec8ff; }
.boot-bar {
  width: 180px;
  height: 16px;
  border: 1px solid #3a6ea5;
  background: #111;
  overflow: hidden;
}
.boot-bar i {
  display: block;
  height: 100%;
  width: 40%;
  background: repeating-linear-gradient(90deg, #245edc 0 10px, #3c8cff 10px 12px);
  animation: load 1.1s linear infinite;
}
@keyframes load {
  from { transform: translateX(-100%); }
  to { transform: translateX(280%); }
}
.boot-skip { margin: 0; font-size: 12px; color: #9ab; }

#welcome {
  background: radial-gradient(circle at 50% 40%, #3a7bd5, #0b3189 55%, #071f55);
}
.welcome-card { width: min(520px, 92vw); text-align: center; }
.welcome-card h1 {
  font-weight: 400;
  font-size: 36px;
  margin: 0 0 8px;
  text-shadow: 0 2px 0 #04205a;
}
.welcome-card p { margin: 0 0 28px; opacity: 0.9; }
.user-tile {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: linear-gradient(#5a9de8, #2b6ec4);
  color: #fff;
  cursor: pointer;
  min-width: 280px;
  text-align: left;
}
.user-tile:hover { border-color: #fff; box-shadow: 0 0 0 1px #9cf; }
.user-tile img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
}
.user-tile strong { display: block; font-size: 18px; }
.user-tile span { font-size: 12px; opacity: 0.85; }
.welcome-foot {
  position: absolute;
  bottom: 20px;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  gap: 12px;
}
.welcome-foot button {
  background: none;
  border: 0;
  color: #fff;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- Desktop ---------- */
#desktop { position: fixed; inset: 0; overflow: hidden; }
.wallpaper {
  position: absolute;
  inset: 0 0 30px 0;
  background: #3a7bd5 url("../assets/bliss.jpg") center / cover no-repeat;
}
.icons {
  position: absolute;
  top: 12px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 2;
}
.icon {
  width: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
  font-size: 11px;
  text-align: center;
  background: transparent;
  border: 1px solid transparent;
  appearance: none;
  padding: 2px;
}
.icon:focus, .icon.selected { outline: none; }
.icon.selected { background: rgba(11, 48, 143, 0.45); border-color: rgba(255,255,255,0.35); }
.icon.selected span { background: #0a246a; }
.glyph {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 26px;
  filter: drop-shadow(1px 1px 0 #0006);
}
.icon span { padding: 1px 4px; border-radius: 2px; }

.rover-pet {
  position: absolute;
  right: 6%;
  bottom: 78px;
  width: 168px;
  z-index: 5;
  cursor: grab;
}
.rover-pet img {
  width: 100%;
  display: block;
  filter: drop-shadow(0 10px 8px #0004);
  animation: float 3.2s ease-in-out infinite;
  pointer-events: none;
}
.rover-pet.talking img { animation: bounce 0.45s ease-in-out 3; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes bounce {
  50% { transform: translateY(-12px); }
}
.balloon {
  position: absolute;
  right: calc(6% + 156px);
  bottom: 210px;
  width: 230px;
  background: #ffffe1;
  border: 1px solid #7a7460;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  z-index: 6;
  box-shadow: 2px 2px 0 #0002;
}
.balloon::after {
  content: "";
  position: absolute;
  right: -10px;
  bottom: 22px;
  border: 8px solid transparent;
  border-left-color: #ffffe1;
}
.balloon strong { display: block; margin-bottom: 4px; color: #35580c; }

/* ---------- Taskbar ---------- */
.taskbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 30px;
  display: flex;
  align-items: stretch;
  background: linear-gradient(#3f7ef0, #245edc 8%, #245edc 92%, #1a4bb8);
  z-index: 80;
  box-shadow: inset 0 1px 0 #7eabf7;
}
.start-btn {
  width: 100px;
  border: 0;
  margin: 2px 0 2px 0;
  color: #fff;
  font: italic 700 17px/1 "Franklin Gothic Medium", Tahoma, sans-serif;
  letter-spacing: 0.4px;
  background: linear-gradient(180deg, #5cbf46 0%, #3c8a2e 55%, #2f6e24 100%);
  border-radius: 0 12px 10px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-shadow: 1px 1px 0 #1d4d16;
  box-shadow: inset 0 1px 0 #9adf78;
}
.start-btn:hover { filter: brightness(1.08); }
.start-btn.active { filter: brightness(0.92); box-shadow: inset 1px 1px 3px #0005; }
.ca-bar {
  margin: 3px 0 3px 6px;
  padding: 0 10px;
  border: 1px solid #163a9c;
  border-radius: 3px;
  background: linear-gradient(#fff6c8, #f0d56a);
  color: #3a2a00;
  font: 700 11px/1 Tahoma, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 1px 1px 0 #fff;
}
.ca-bar:hover { filter: brightness(1.05); }
.ca-bar:active { box-shadow: inset 1px 1px 2px #0004; }
.start-logo {
  width: 18px;
  height: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  transform: rotate(-8deg);
}
.start-logo i { display: block; border-radius: 1px; }
.start-logo i:nth-child(1) { background: #f44; }
.start-logo i:nth-child(2) { background: #6c3; }
.start-logo i:nth-child(3) { background: #3af; }
.start-logo i:nth-child(4) { background: #fc0; }
.tasks {
  flex: 1;
  display: flex;
  gap: 4px;
  padding: 3px 6px;
  overflow: hidden;
}
.task {
  min-width: 120px;
  max-width: 190px;
  border: 1px solid #163a9c;
  background: linear-gradient(#3d7df0, #2b62d0);
  color: #fff;
  font-size: 11px;
  text-align: left;
  padding: 0 8px;
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.task.active {
  background: linear-gradient(#1d4eb8, #163d96);
  box-shadow: inset 1px 1px 2px #0006;
}
.tray {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: linear-gradient(#17a4e8, #0b88c8);
  border-left: 1px solid #0a5f8a;
  color: #fff;
  font-size: 11px;
  min-width: 92px;
  justify-content: flex-end;
}
.tray-dog { width: 16px; height: 16px; object-fit: contain; }

/* ---------- Start menu ---------- */
.start-menu {
  position: absolute;
  left: 0;
  bottom: 30px;
  width: 392px;
  height: 440px;
  display: none;
  grid-template-rows: 54px 1fr 36px;
  z-index: 90;
  border: 2px solid #0831d9;
  box-shadow: 4px 4px 12px #0006;
  background: var(--face);
}
.start-menu.open { display: grid; }
.start-user {
  background: linear-gradient(90deg, #0f3ea8, #3a8ef5);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  font-weight: 700;
  font-size: 15px;
}
.start-user img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border: 2px solid #fff;
  border-radius: 3px;
}
.start-cols { display: grid; grid-template-columns: 1.15fr 0.85fr; min-height: 0; }
.start-left { background: #fff; padding: 6px 0; overflow: auto; }
.start-right {
  background: #d3e5fa;
  padding: 6px 0;
  border-left: 1px solid #95b3d7;
}
.start-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
  border: 0;
  width: 100%;
  background: transparent;
  text-align: left;
}
.start-item:hover { background: #316ac5; color: #fff; }
.start-item small { display: block; color: #666; font-size: 10px; }
.start-item:hover small { color: #def; }
.start-foot {
  background: linear-gradient(90deg, #0f3ea8, #3a8ef5);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}
.start-foot button {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
}
.start-foot button:hover { text-decoration: underline; }

/* ---------- Windows ---------- */
.window {
  position: absolute;
  min-width: 280px;
  background: var(--face);
  border: 3px solid var(--luna-border);
  border-radius: 8px 8px 0 0;
  box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.35);
  display: none;
  flex-direction: column;
  z-index: 10;
  max-width: calc(100vw - 16px);
}
.window.open { display: flex; }
.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100% - 30px) !important;
  border-radius: 0;
}
.window.minimized { display: none !important; }
.titlebar {
  height: 28px;
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 3px 0 6px;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: move;
  background: linear-gradient(180deg, #3eb0ea 0%, #1871dc 20%, #185aaa 80%, #1871dc 100%);
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);
  border-radius: 5px 5px 0 0;
}
.window.inactive .titlebar {
  background: linear-gradient(180deg, #8eb4e8, #6d93cf 40%, #7aa0d8);
}
.tb-icon { width: 16px; height: 16px; object-fit: contain; }
.caption { margin-left: auto; display: flex; gap: 2px; }
.cap {
  width: 21px;
  height: 21px;
  border: 1px solid #154784;
  border-radius: 3px;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  background: linear-gradient(#6ea8f7, #2b66d9);
  padding: 0;
}
.cap:active { transform: translate(1px, 1px); }
.cap.close {
  background: linear-gradient(180deg, #e9785c, #d1260f);
  border-color: #8a1a0c;
  font-weight: 700;
}
.menubar, .statusbar {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--face);
  flex: 0 0 auto;
}
.menubar { border-bottom: 1px solid #aca899; }
.menubar u { text-decoration: underline; }
.statusbar {
  border-top: 1px solid #fff;
  box-shadow: inset 0 1px 0 #808080;
  color: #444;
}
.window-body {
  background: #fff;
  flex: 1;
  overflow: auto;
  min-height: 80px;
}
.window-body.beige { background: var(--face); }

.hero { text-align: center; padding: 22px 22px 16px; }
.hero-dog {
  width: 210px;
  height: 210px;
  object-fit: contain;
  background: #fff;
  border: 2px solid #b7b4a8;
  border-radius: 8px;
  box-shadow: inset 1px 1px 0 #fff;
  animation: float 3s ease-in-out infinite;
}
.hero h1 {
  font-family: "Pixelify Sans", Tahoma, sans-serif;
  font-size: 40px;
  margin: 14px 0 6px;
  font-weight: 700;
}
.hero p { margin: 0 auto 14px; max-width: 420px; font-size: 13px; color: #444; }
.hero-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.xp-btn {
  background: linear-gradient(#fff, var(--face));
  border: 1px solid #003c74;
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #808080, 1px 1px 0 #0001;
  padding: 4px 14px;
  font-size: 12px;
  cursor: pointer;
  min-width: 74px;
}
.xp-btn:hover { filter: brightness(1.04); }
.xp-btn:active { box-shadow: inset 1px 1px 2px #0004; }
.xp-btn.default { border-width: 2px; font-weight: 700; }
.xp-btn.green {
  background: linear-gradient(180deg, #5dcc45, #2f8a24);
  color: #fff;
  border-color: #196619;
  text-shadow: 0 1px 0 #145214;
  font-weight: 700;
}

.search-layout { display: grid; grid-template-columns: 210px 1fr; min-height: 340px; }
.search-side {
  background: linear-gradient(#fffef6, #e7efd2);
  padding: 14px 12px;
  border-right: 1px solid #c6c3b6;
  text-align: center;
}
.search-side img { width: 140px; }
.search-side h2 { font-size: 16px; margin: 8px 0 4px; color: #35580c; }
.search-side p { font-size: 11px; color: #444; }
.search-main { padding: 14px 16px; }
.search-main h3 { margin: 0 0 10px; font-size: 15px; color: #003399; }
.search-row { display: flex; gap: 8px; }
.search-row input {
  flex: 1;
  border: 1px solid #7f9db9;
  padding: 4px 6px;
  font-size: 12px;
}
.search-options { font-size: 12px; display: grid; gap: 6px; margin: 12px 0; }
.results { font-size: 12px; border-top: 1px solid #ddd; padding-top: 10px; }
.results ul { margin: 0; padding-left: 18px; }
.results li { margin: 8px 0; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
.card {
  border: 1px solid #b7b4a8;
  background: #fff;
  padding: 10px;
  font-size: 12px;
  box-shadow: inset 1px 1px 0 #fff;
}
.card h3 { margin: 0 0 6px; font-size: 13px; color: #003399; }
.facts { width: 100%; border-collapse: collapse; font-size: 12px; }
.facts th, .facts td { border-bottom: 1px solid #e4e0d4; padding: 8px 10px; text-align: left; }
.facts th { width: 36%; color: #35580c; background: #f7f6f0; }
.facts tr:hover td, .facts tr:hover th { background: #e8f0fe; }

.tabs { display: flex; gap: 2px; padding: 8px 8px 0; }
.tab {
  border: 1px solid #888;
  border-bottom: 0;
  background: #d6d2c4;
  padding: 4px 12px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 3px 3px 0 0;
}
.tab.active { background: #fff; position: relative; top: 1px; }
.tab-panel { display: none; padding: 14px 16px 8px; font-size: 13px; line-height: 1.5; background: #fff; margin: 0 8px 8px; border: 1px solid #888; }
.tab-panel.active { display: block; }
.tab-panel p { margin: 0 0 10px; }

.help-banner {
  background: linear-gradient(#2f6f1e, #5ea63a);
  color: #fff;
  padding: 14px 16px;
  font-size: 20px;
  font-family: "Pixelify Sans", Tahoma, sans-serif;
}
.help-body { padding: 14px 16px; font-size: 13px; line-height: 1.5; }
.help-body a, .ie-page a { color: #0645ad; }
.ie-page h2 { margin: 0 0 8px; color: #003399; font-size: 20px; font-family: "Pixelify Sans", Tahoma, sans-serif; }

.coming {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 18px;
  text-align: center;
  min-height: 240px;
}
.hourglass {
  width: 28px;
  height: 40px;
  border-radius: 4px;
  background:
    linear-gradient(#f4e27a, #d4b43a) top / 100% 46% no-repeat,
    linear-gradient(#d4b43a, #f4e27a) bottom / 100% 46% no-repeat;
  clip-path: polygon(0 0, 100% 0, 62% 50%, 100% 100%, 0 100%, 38% 50%);
  animation: sand 1.4s ease-in-out infinite;
}
@keyframes sand {
  50% { transform: rotate(180deg); }
}
.coming h2 { margin: 0; color: #003399; font-family: "Pixelify Sans", Tahoma, sans-serif; }
.coming p { margin: 0; font-size: 13px; max-width: 280px; }
.coming code {
  background: #fff;
  border: 2px inset #c8c4b8;
  padding: 6px 12px;
  max-width: 100%;
  font: 12px "Lucida Console", Consolas, monospace;
  overflow-wrap: anywhere;
}

.ie-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  background: var(--face);
  font-size: 11px;
  border-bottom: 1px solid #aca899;
}
.ie-bar input { flex: 1; border: 1px solid #7f9db9; padding: 3px 6px; font-size: 11px; }
.ie-page { padding: 16px; font-size: 13px; line-height: 1.5; }
.notepad {
  width: 100%;
  height: 100%;
  min-height: 240px;
  border: 0;
  padding: 8px;
  font: 13px "Lucida Console", monospace;
  resize: none;
  outline: none;
  background: #fff;
}
.recycle { padding: 16px; font-size: 13px; }

.dialog {
  left: 50%;
  top: 28%;
  transform: translateX(-50%);
  width: 380px;
  z-index: 100;
}
.dialog-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  font-size: 12px;
  background: var(--face);
}
.dialog-body p { margin: 4px 0 0; }
.info-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: #245edc;
  color: #fff;
  font: italic 700 20px/32px Georgia, serif;
  text-align: center;
}
.dialog-actions {
  display: flex;
  justify-content: center;
  padding: 0 12px 14px;
  background: var(--face);
}

.context {
  position: absolute;
  z-index: 95;
  min-width: 180px;
  background: var(--face);
  border: 1px solid #808080;
  box-shadow: 2px 2px 4px #0004;
  padding: 2px;
  display: none;
  font-size: 12px;
}
.context.open { display: block; }
.context button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 4px 18px;
  cursor: pointer;
}
.context button:hover { background: #316ac5; color: #fff; }
.context hr { border: 0; border-top: 1px solid #aca899; margin: 3px 2px; }

.shutdown {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.shutdown.open { display: flex; }
.shutdown-box {
  width: min(420px, 92vw);
  text-align: center;
}
.shutdown-box h2 { margin: 0 0 8px; font-weight: 400; font-size: 28px; }
.shutdown-box p { margin: 0; opacity: 0.9; }
.shutdown-actions { display: flex; gap: 18px; justify-content: center; margin-top: 22px; }
.shutdown-actions button {
  width: 92px;
  height: 64px;
  background: #1a3f86;
  color: #fff;
  border: 1px solid #9cf;
  border-radius: 6px;
  cursor: pointer;
}
.shutdown-actions button:hover { background: #2456b0; }

.hidden { display: none !important; }

@media (max-width: 800px) {
  #desktop { overflow: auto; padding-bottom: 40px; }
  .wallpaper { position: fixed; }
  .taskbar { position: fixed; }
  .start-menu { position: fixed; width: min(392px, 100vw); max-height: calc(100% - 30px); }
  .icons {
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    padding: 8px;
    gap: 6px;
  }
  .window.open, .dialog.open {
    position: relative;
    left: auto !important;
    top: auto !important;
    width: calc(100% - 16px) !important;
    height: auto !important;
    margin: 8px;
    transform: none;
  }
  .window.maximized {
    position: fixed;
    margin: 0;
    width: 100% !important;
    height: calc(100% - 30px) !important;
  }
  .search-layout, .cards { grid-template-columns: 1fr; }
  .rover-pet { width: 120px; right: 8px; bottom: 46px; }
  .balloon { width: 180px; right: 8px; left: auto; bottom: 180px; }
  .boot-title { font-size: 28px; }
  .welcome-card h1 { font-size: 26px; }
  .hero h1 { font-size: 32px; }
}
