/* ==========================================================================
   Windows 7 (Aero) look: desktop, glass windows, caption buttons, taskbar,
   message boxes and the Outlook desktop alert.
   ========================================================================== */

:root {
  --ui-font: "Segoe UI", "Selawik", Tahoma, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --glass: rgba(132, 176, 228, 0.55);
  --glass-inactive: rgba(190, 205, 225, 0.6);
  --taskbar-h: 40px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b2a5c;
  font: 12px/1.35 var(--ui-font);
  color: #1e1e1e;
  -webkit-font-smoothing: auto;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: default;
}

input { font: inherit; }

#defs { position: absolute; width: 0; height: 0; }

svg { display: block; }

/* The "screen" is sized and scaled by app.js so that small devices see the
   whole retro desktop rather than a broken layout. */
#screen {
  position: absolute;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  transform-origin: 0 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Desktop + wallpaper ---------- */

#desktop {
  position: absolute;
  inset: 0 0 var(--taskbar-h) 0;
}

.wallpaper {
  position: absolute;
  inset: 0 0 calc(-1 * var(--taskbar-h)) 0;
  background:
    radial-gradient(ellipse 45% 40% at 52% 46%, rgba(120, 210, 255, 0.55), transparent 70%),
    radial-gradient(ellipse 90% 80% at 50% 45%, #2a8ae0 0%, #1667c2 30%, #0d4c9c 58%, #072d66 100%);
  overflow: hidden;
}

.wallpaper .beam {
  position: absolute;
  width: 140%;
  height: 26%;
  left: -20%;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.35;
}
.wallpaper .b1 { top: 18%; transform: rotate(-14deg); background: linear-gradient(90deg, transparent, rgba(160, 230, 255, 0.7), transparent); }
.wallpaper .b2 { top: 52%; transform: rotate(9deg); background: linear-gradient(90deg, transparent, rgba(110, 200, 255, 0.55), transparent); opacity: 0.25; }
.wallpaper .b3 { top: 70%; transform: rotate(-4deg); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent); opacity: 0.18; }
.wallpaper .glow {
  position: absolute;
  left: 50%; top: 44%;
  width: 26vmin; height: 26vmin;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 110, 40, 0.55), transparent 45%),
    radial-gradient(circle at 70% 30%, rgba(140, 220, 40, 0.5), transparent 45%),
    radial-gradient(circle at 30% 72%, rgba(40, 180, 255, 0.6), transparent 45%),
    radial-gradient(circle at 70% 72%, rgba(255, 200, 30, 0.5), transparent 45%);
  filter: blur(22px);
  opacity: 0.7;
}

.desktop-icons {
  position: absolute;
  top: 6px;
  left: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 0;
}

.desk-icon {
  width: 76px;
  padding: 4px 2px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #fff;
  text-shadow: 0 0 3px #000, 0 1px 2px #000;
}
.desk-icon .ico svg { width: 40px; height: 40px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
.desk-icon .lbl { font-size: 12px; line-height: 1.2; text-align: center; word-break: break-word; }
.desk-icon:hover { background: rgba(160, 200, 255, 0.18); border-color: rgba(190, 220, 255, 0.35); }
.desk-icon:focus-visible, .desk-icon.selected { background: rgba(120, 175, 255, 0.35); border-color: rgba(190, 220, 255, 0.6); outline: none; }

/* ---------- Aero glass windows ---------- */

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: 7px 7px 4px 4px;
  padding: 0 7px 7px;
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.28) 0 12%, rgba(255, 255, 255, 0) 12% 22%, rgba(255, 255, 255, 0.16) 22% 25%, rgba(255, 255, 255, 0) 25% 70%, rgba(255, 255, 255, 0.12) 70% 76%, rgba(255, 255, 255, 0) 76%),
    linear-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.05) 60px),
    var(--glass);
  -webkit-backdrop-filter: blur(7px) saturate(1.3);
  backdrop-filter: blur(7px) saturate(1.3);
  box-shadow:
    0 0 0 1px rgba(10, 25, 50, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 10px 34px rgba(0, 0, 0, 0.55);
}
.window.inactive {
  background:
    linear-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.1) 60px),
    var(--glass-inactive);
  box-shadow: 0 0 0 1px rgba(10, 25, 50, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 6px 20px rgba(0, 0, 0, 0.35);
}
.window[hidden] { display: none; }

.window.maximised {
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.titlebar {
  position: relative;
  height: 30px;
  flex: none;
  display: flex;
  align-items: center;
  padding-right: 100px;
}
.window.maximised .titlebar { height: 24px; }

.titlebar .title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #000;
  text-shadow: 0 0 8px #fff, 0 0 8px #fff, 0 0 4px #fff, 0 0 2px #fff;
  pointer-events: none;
}
.titlebar .title.left { text-align: left; padding-left: 6px; }

.caption-buttons {
  position: absolute;
  top: -1px;
  right: 0;
  display: flex;
  border-radius: 0 0 5px 5px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.window.maximised .caption-buttons { top: 0; right: 2px; }
.caption-buttons { z-index: 6; }

/* Resize handles along the glass frame */
.rs { position: absolute; z-index: 5; }
.rs.n { top: -4px; left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.rs.s { bottom: -4px; left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.rs.e { right: -4px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.rs.w { left: -4px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.rs.nw { left: -4px; top: -4px; width: 14px; height: 14px; cursor: nwse-resize; }
.rs.se { right: -4px; bottom: -4px; width: 14px; height: 14px; cursor: nwse-resize; }
.rs.ne { right: -4px; top: -4px; width: 14px; height: 14px; cursor: nesw-resize; }
.rs.sw { left: -4px; bottom: -4px; width: 14px; height: 14px; cursor: nesw-resize; }
.window.maximised .rs { display: none; }

.cap {
  position: relative;
  height: 19px;
  width: 26px;
  background: linear-gradient(#e7eef7 0%, #cfdced 45%, #a9c0de 50%, #b8cfeb 80%, #d2e3f6 100%);
  border-left: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}
.cap:first-child { border-left: 0; }
.cap.max { width: 25px; }
.cap.close { width: 45px; background: linear-gradient(#efb1a3 0%, #df8670 45%, #c8462e 50%, #d2583f 75%, #e9a68f 100%); }
.cap:hover { background: linear-gradient(#f0f7ff 0%, #c4e1fb 45%, #5fa8ee 50%, #8fd0ff 80%, #c5f0ff 100%); }
.cap.close:hover { background: linear-gradient(#ffc4b6 0%, #f68d72 45%, #e2330f 50%, #f25a2f 75%, #ffcc9f 100%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 0 12px rgba(255, 90, 40, 0.9); }
.cap:active { background: linear-gradient(#b4cbe8, #7ea3d2 50%, #3e76c2 51%, #6aa0dc); }
.cap.close:active { background: linear-gradient(#e88f7c, #c84a2e 50%, #a8230a 51%, #c94a2a); }

/* glyphs: white with a dark outline */
.cap::before, .cap::after { content: ""; position: absolute; left: 50%; top: 50%; }
.cap.min::before { width: 9px; height: 3px; transform: translate(-50%, 2px); background: #fff; box-shadow: 0 0 0 1px #3a4a66; }
.cap.max::before { width: 9px; height: 7px; transform: translate(-50%, -50%); border: 2px solid #fff; border-top-width: 3px; box-shadow: 0 0 0 1px #3a4a66, inset 0 0 0 1px #3a4a66; }
.window.maximised .cap.max::before { width: 7px; height: 6px; transform: translate(-30%, -30%); }
.window.maximised .cap.max::after { width: 7px; height: 6px; transform: translate(-75%, -75%); border: 2px solid #fff; border-top-width: 2px; border-right-width: 0; border-bottom-width: 0; box-shadow: -1px -1px 0 0 #3a4a66; }
/* One shape with a single outline, so neither stroke draws over the other's border */
.cap.close::before {
  width: 13px;
  height: 12px;
  transform: translate(-50%, -50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 12'%3E%3Cpath d='M2.5 2 L10.5 10 M10.5 2 L2.5 10' stroke='%235a1408' stroke-width='4.2' stroke-linecap='round'/%3E%3Cpath d='M2.5 2 L10.5 10 M10.5 2 L2.5 10' stroke='%23fff' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cap.close::after { content: none; }

/* Client area of a window: the opaque part inside the glass frame */
.client {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f0f0f0;
  border: 1px solid rgba(40, 60, 90, 0.75);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.window.maximised .client { border-left: 0; border-right: 0; border-bottom: 0; }

/* ---------- Message boxes / dialogs ---------- */

#layer { position: absolute; inset: 0; pointer-events: none; z-index: 1000; }
#layer > * { pointer-events: auto; }

.modal-shade { position: absolute; inset: 0; background: transparent; }

.dialog .client { background: #fff; }
.dialog .caption-buttons .cap.close { width: 43px; }

.msgbox-body {
  display: flex;
  gap: 12px;
  padding: 20px 22px 22px 12px;
  min-height: 70px;
  align-items: flex-start;
  max-width: 420px;
}
.msgbox-body .ico svg { width: 32px; height: 32px; }
.msgbox-body .text { padding-top: 6px; font-size: 12px; color: #000; }
.msgbox-body .text .main { color: #1f3b8c; font-size: 15px; margin-bottom: 6px; }

.dlg-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px 11px;
  background: #f0f0f0;
  border-top: 1px solid #dfdfdf;
}

.w7btn {
  min-width: 73px;
  height: 23px;
  padding: 0 10px;
  border: 1px solid #707070;
  border-radius: 3px;
  background: linear-gradient(#f2f2f2 0%, #ebebeb 49%, #dddddd 50%, #cfcfcf 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
  color: #000;
  text-align: center;
}
.w7btn:hover { border-color: #3c7fb1; background: linear-gradient(#eaf6fd 0%, #d9f0fc 49%, #bee6fd 50%, #a7d9f5 100%); }
.w7btn:active { border-color: #2c628b; background: linear-gradient(#e5f4fc 0%, #c4e5f6 49%, #98d1ef 50%, #68b3db 100%); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); }
.w7btn.default { border-color: #3399ff; box-shadow: inset 0 0 0 1px #9fd5ff, 0 0 0 0 transparent; }
.w7btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.w7btn[disabled] { color: #8d8d8d; border-color: #adb2b5; background: #f4f4f4; box-shadow: none; }

/* Send/Receive progress dialog */
.sr-dialog .client { background: #f0f0f0; }
.sr-body { padding: 12px 12px 8px; width: 470px; max-width: 100%; }
.sr-top { display: flex; gap: 10px; align-items: flex-start; }
.sr-top .ico svg { width: 32px; height: 32px; }
.sr-top .status { flex: 1; }
.sr-top .status .line { margin: 2px 0 8px; }
.sr-top .side { display: flex; flex-direction: column; gap: 6px; }
.sr-check { margin: 10px 0 8px 42px; display: flex; gap: 6px; align-items: center; }
.sr-check i { width: 13px; height: 13px; border: 1px solid #8f8f8f; background: linear-gradient(#e8e8e8, #fff); display: inline-block; }
.sr-tabs { display: flex; gap: 0; margin-top: 4px; }
.sr-tabs span { padding: 3px 10px; border: 1px solid #898c95; border-bottom: 0; background: linear-gradient(#f3f3f3, #e5e5e5); margin-right: -1px; }
.sr-tabs span.on { background: #fff; position: relative; top: 1px; }
.sr-table { border: 1px solid #898c95; background: #fff; height: 92px; overflow: hidden; }
.sr-table .hdr, .sr-table .row { display: grid; grid-template-columns: 1fr 120px 90px; }
.sr-table .hdr span { padding: 3px 6px; border-right: 1px solid #e5e5e5; border-bottom: 1px solid #d5d5d5; background: linear-gradient(#fff, #f1f2f4); color: #4c607a; }
.sr-table .row span { padding: 3px 6px; display: flex; align-items: center; gap: 4px; }
.sr-table .row .tick { color: #2f9a1a; font-weight: bold; width: 12px; display: inline-block; }

.w7progress {
  height: 15px;
  border: 1px solid #b2b2b2;
  border-radius: 3px;
  background: linear-gradient(#f3f3f3, #dcdcdc);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}
.w7progress i {
  display: block;
  height: 100%;
  width: 0;
  background:
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%) no-repeat,
    linear-gradient(#cbf5bc 0%, #7ddd60 45%, #29b31a 50%, #45cd2f 100%);
  background-size: 80px 100%, 100% 100%;
  animation: glint 1.6s linear infinite;
  transition: width 0.35s linear;
}
@keyframes glint { from { background-position: -80px 0, 0 0; } to { background-position: 500px 0, 0 0; } }

/* ---------- Outlook 2010 desktop alert ---------- */

.desktop-alert {
  position: absolute;
  right: 12px;
  bottom: calc(var(--taskbar-h) + 12px);
  width: 330px;
  padding: 8px 10px 10px 10px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 2px 10px;
  border: 1px solid #8a9bb4;
  border-radius: 2px;
  background: linear-gradient(#ffffff, #e8edf4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  z-index: 1100;
  cursor: pointer;
}
.desktop-alert.show { opacity: 0.94; transform: none; }
.desktop-alert:hover { opacity: 1; }
.desktop-alert .ico { grid-row: span 3; padding-top: 2px; }
.desktop-alert .ico svg { width: 32px; height: 32px; }
.desktop-alert .from { font-weight: bold; color: #1f3b5b; padding-right: 40px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desktop-alert .subj { color: #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desktop-alert .prev { color: #555; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.desktop-alert .x { position: absolute; right: 4px; top: 3px; width: 16px; height: 16px; line-height: 14px; text-align: center; color: #666; border: 1px solid transparent; border-radius: 2px; }
.desktop-alert .x:hover { border-color: #e1c56b; background: linear-gradient(#fff6d4, #fde59a); }
.desktop-alert .acts { position: absolute; right: 24px; top: 3px; display: flex; gap: 2px; }
.desktop-alert .acts span { width: 16px; height: 16px; display: inline-block; }

/* ---------- Taskbar ---------- */

#taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--taskbar-h);
  display: flex;
  align-items: stretch;
  z-index: 900;
  background:
    linear-gradient(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08) 48%, rgba(0, 0, 0, 0.12) 52%, rgba(0, 0, 0, 0.22)),
    rgba(28, 54, 92, 0.62);
  -webkit-backdrop-filter: blur(6px) saturate(1.2);
  backdrop-filter: blur(6px) saturate(1.2);
  border-top: 1px solid rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.start-orb {
  width: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -6px;
  margin-bottom: 0;
}
.start-orb svg { width: 42px; height: 42px; filter: drop-shadow(0 0 3px rgba(0, 20, 60, 0.7)); transition: filter 0.2s; }
.start-orb:hover svg { filter: drop-shadow(0 0 7px rgba(120, 210, 255, 0.95)) brightness(1.15); }

.tb-buttons { display: flex; gap: 2px; padding: 0 4px; }
.tb-btn {
  width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 3px;
  margin: 1px 0;
}
.tb-btn svg { width: 30px; height: 30px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
.tb-btn:hover { background: radial-gradient(ellipse at 50% 100%, rgba(140, 200, 255, 0.55), rgba(255, 255, 255, 0.08) 70%); border-color: rgba(255, 255, 255, 0.4); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); }
.tb-btn.running { border-color: rgba(255, 255, 255, 0.35); background: linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06) 50%, rgba(255, 255, 255, 0.02) 51%, rgba(255, 255, 255, 0.1)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45); }
.tb-btn.running.active { background: radial-gradient(ellipse at 50% 100%, rgba(120, 190, 255, 0.5), transparent 70%), linear-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.06) 51%, rgba(255, 255, 255, 0.18)); }
.tb-btn.flash { animation: tbflash 0.8s ease-in-out 4 alternate; }
@keyframes tbflash { to { background: linear-gradient(rgba(255, 190, 90, 0.9), rgba(240, 140, 20, 0.85)); } }

.tray {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  color: #fff;
  padding-left: 6px;
}
.tray-up { width: 18px; height: 30px; color: #fff; font-size: 10px; border-radius: 2px; }
.tray-ico { width: 22px; height: 30px; display: flex; align-items: center; justify-content: center; }
.tray-ico[hidden] { display: none; }
.tray-up:hover, .tray-ico:hover { background: rgba(255, 255, 255, 0.15); }
.tray-mail svg { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.4)); }
.clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  height: 100%;
  font-size: 12px;
  line-height: 1.25;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
}
.clock:hover { background: rgba(255, 255, 255, 0.12); }
.show-desktop {
  width: 15px;
  height: 100%;
  border-left: 1px solid rgba(0, 0, 0, 0.45);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.3);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
}
.show-desktop:hover { background: rgba(255, 255, 255, 0.35); }

/* ---------- Phone mode ---------- */
#screen.phone .tb-btn:not(#tb-outlook),
#screen.phone .tray-up,
#screen.phone .tray-ico:not(.tray-mail) { display: none; }
#screen.phone .start-orb { width: 48px; }
#screen.phone .desktop-alert { left: 8px; right: 8px; width: auto; bottom: calc(var(--taskbar-h) + 8px); }
#screen.phone .desktop-alert .from { font-size: 14px; }
#screen.phone .desktop-alert .subj, #screen.phone .desktop-alert .prev { font-size: 13px; }
#screen.phone .msgbox-body { max-width: none; }
#screen.phone .w7btn { height: 30px; min-width: 84px; font-size: 13px; }
@media (orientation: landscape) {
  #screen.phone .desktop-alert { left: auto; width: min(420px, calc(100% - 16px)); }
}

/* Send/Receive progress dialog on narrow screens: buttons drop below the progress bar */
#screen.phone .sr-top { flex-wrap: wrap; }
#screen.phone .sr-top .status { min-width: 0; flex-basis: calc(100% - 42px); }
#screen.phone .sr-top .side { flex-direction: row; justify-content: flex-end; width: 100%; gap: 8px; }
#screen.phone .sr-check { margin-left: 0; }
#screen.phone .sr-table .hdr, #screen.phone .sr-table .row { grid-template-columns: 1fr 96px; }
#screen.phone .sr-table .hdr span:nth-child(3), #screen.phone .sr-table .row span:nth-child(3) { display: none; }
#screen.phone .sr-table .row span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
