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

:root {
  --menubar-h: 28px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --glass: rgba(30, 30, 40, 0.45);
  --glass-border: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.92);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Wallpaper — macOS-style aurora gradient */
body {
  background:
    radial-gradient(120% 90% at 15% 10%, #2b3a8f 0%, transparent 55%),
    radial-gradient(100% 80% at 85% 15%, #7b2d8b 0%, transparent 55%),
    radial-gradient(120% 100% at 70% 90%, #d4586d 0%, transparent 60%),
    radial-gradient(100% 100% at 20% 85%, #e8873c 0%, transparent 55%),
    linear-gradient(180deg, #141a3c 0%, #3c1e50 100%);
  background-attachment: fixed;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; }

/* ===== Menu bar ===== */
.menubar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--menubar-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  background: rgba(20, 20, 30, 0.35);
  backdrop-filter: blur(30px) saturate(1.8);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  font-size: 13px;
  z-index: 100;
  user-select: none;
}

.menubar-left, .menubar-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

.menu-item {
  padding: 3px 10px;
  border-radius: 5px;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  display: flex;
  align-items: center;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.16); }
.menu-item-bold { font-weight: 700; }
.apple-menu svg { display: block; }

/* ===== Apple dropdown ===== */
.dropdown {
  position: fixed;
  top: calc(var(--menubar-h) + 4px);
  left: 8px;
  min-width: 210px;
  padding: 5px;
  background: var(--glass);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 200;
}
.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
}
.dropdown-item:hover { background: #2f6fed; }
.dropdown-sep {
  height: 1px;
  margin: 4px 10px;
  background: rgba(255, 255, 255, 0.18);
}

/* ===== Desktop icons ===== */
.desktop {
  position: fixed;
  top: calc(var(--menubar-h) + 14px);
  right: 10px;
  bottom: 90px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap-reverse;
  align-content: flex-end;
  gap: 6px 4px;
  z-index: 1;
}

.desk-icon {
  width: 96px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border-radius: 8px;
  text-decoration: none;
}
.desk-icon:hover,
.desk-icon:focus-visible { background: rgba(255, 255, 255, 0.12); }

.desk-icon .icon-tile {
  width: 58px;
  height: 58px;
  font-size: 34px;
}

.desk-icon .icon-label {
  font-size: 12px;
  text-align: center;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  word-break: break-word;
}

/* Shared app-icon tile (squircle) */
.icon-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22.5%;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    0 5px 12px rgba(0, 0, 0, 0.35);
  user-select: none;
}

/* ===== Dock ===== */
.dock-wrap {
  position: fixed;
  bottom: 8px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
}

.dock {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 6px 8px;
  background: var(--glass);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.dock-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  transition: transform 0.12s ease-out;
  transform-origin: bottom center;
}
.dock-item:hover { transform: scale(1.35) translateY(-8px); }
.dock-item:hover + .dock-item,
.dock-item:has(+ .dock-item:hover) { transform: scale(1.15) translateY(-4px); }

.dock-item .icon-tile {
  width: 52px;
  height: 52px;
  font-size: 30px;
}

/* Tooltip label */
.dock-item::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 12px);
  padding: 4px 10px;
  background: rgba(40, 40, 50, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: 7px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.dock-item:hover::after { opacity: 1; }

/* Running indicator dot */
.dock-item .dot {
  width: 4px;
  height: 4px;
  margin-top: 2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
}
.dock-item .dot.hidden-dot { background: transparent; }

.dock-sep {
  width: 1px;
  align-self: stretch;
  margin: 4px 4px;
  background: rgba(255, 255, 255, 0.22);
}

/* Minimized window thumbnails (right side of the dock, like macOS) */
.dock-min { animation: genie-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes genie-in {
  from { opacity: 0; transform: translateY(30px) scale(0.3); }
  to   { opacity: 1; transform: none; }
}

.mini-window {
  position: relative;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(240, 242, 250, 0.95), rgba(205, 210, 228, 0.95));
  border-radius: 16%;
}
.mini-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 12px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding-left: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px 8px 0 0;
}
.mini-bar i {
  width: 4px; height: 4px;
  border-radius: 50%;
}
.mini-bar i:nth-child(1) { background: #ff5f57; }
.mini-bar i:nth-child(2) { background: #febc2e; }
.mini-bar i:nth-child(3) { background: #28c840; }
.mini-icon { font-size: 22px; margin-top: 10px; }

/* ===== Window ===== */
.window {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 24px));
  background: rgba(38, 38, 46, 0.82);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  z-index: 150;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--menubar-h) - 110px);
  animation: window-pop 0.18s ease-out;
}
@keyframes window-pop {
  from { opacity: 0; transform: translateX(-50%) scale(0.95); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}
.window.dragged { transform: none; animation: none; }
.window[hidden] { display: none; }

.window-titlebar {
  position: relative;
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  cursor: grab;
  user-select: none;
}
.window-titlebar:active { cursor: grabbing; }

.window-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
}

.traffic-lights { display: flex; gap: 8px; }
.light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 0.5px solid rgba(0, 0, 0, 0.2);
  padding: 0;
}
.light-close { background: #ff5f57; cursor: pointer; }
.light-min   { background: #febc2e; }
.light-max   { background: #28c840; }

.window-body {
  overflow-y: auto;
  padding: 26px 30px 30px;
  text-align: center;
  font-size: 14px;
  line-height: 1.55;
}
.about-avatar { font-size: 56px; margin-bottom: 8px; }
.window-body h1 { font-size: 22px; font-weight: 700; }
.about-sub { color: rgba(255, 255, 255, 0.65); margin-bottom: 14px; }
.window-body p { margin-bottom: 14px; }

.about-specs {
  margin: 0 auto;
  font-size: 13px;
  border-collapse: collapse;
}
.about-specs th {
  text-align: right;
  padding: 2px 10px 2px 0;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}
.about-specs td { text-align: left; }
.about-specs a { color: #6ab0ff; text-decoration: none; }

/* ===== Mail compose window ===== */
.window-mail { width: min(520px, calc(100vw - 24px)); }

.mail-form {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  font-size: 13px;
}

.mail-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.mail-field label {
  color: rgba(255, 255, 255, 0.55);
  min-width: 52px;
  text-align: right;
}
.mail-field input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
}

.mail-chip {
  background: rgba(47, 111, 237, 0.35);
  border: 1px solid rgba(110, 160, 255, 0.4);
  border-radius: 20px;
  padding: 2px 10px;
}

.mail-copy {
  margin-left: auto;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.15s;
}
.mail-copy:hover { background: rgba(255, 255, 255, 0.22); }
.mail-copy.copied { background: rgba(40, 200, 64, 0.35); }

#mail-body {
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px 16px;
  min-height: 140px;
}

.mail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 14px;
}
.mail-hint { font-size: 11px; color: rgba(255, 255, 255, 0.45); }

.mail-send {
  background: #2f6fed;
  border-radius: 7px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.mail-send:hover { background: #3f7dff; }

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .hide-mobile { display: none; }

  .desktop {
    right: 0;
    left: 0;
    align-content: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 0 6px;
  }
  .desk-icon { width: 84px; }

  .dock-item:hover { transform: none; }
  .dock { gap: 2px; }
  .dock-item .icon-tile { width: 46px; height: 46px; font-size: 26px; }
}
