/* ==========================================================================
   Aero desktop shell

   Layout follows the real Windows 7 metrics so the proportions read right:
   40px taskbar, 30px title bar, 8px glass frame, 21px caption buttons with a
   wider close. Every colour that the user can change is a custom property on
   :root, so Settings only ever writes to those.
   ========================================================================== */

:root {
  /* user colour, written by Settings */
  --glass-h: 206;
  --glass-s: 58%;
  --glass-l: 54%;
  --glass-a: 0.55;
  --blur: 16px;

  /* derived surfaces */
  --glass:        hsla(var(--glass-h), var(--glass-s), var(--glass-l), var(--glass-a));
  --glass-deep:   hsla(var(--glass-h), var(--glass-s), calc(var(--glass-l) - 22%), calc(var(--glass-a) + 0.28));
  --glass-pale:   hsla(var(--glass-h), calc(var(--glass-s) - 14%), calc(var(--glass-l) + 22%), calc(var(--glass-a) - 0.1));
  --accent:       hsl(var(--glass-h), 72%, 48%);
  --accent-soft:  hsla(var(--glass-h), 78%, 62%, 0.35);

  /* frame lines: Aero draws a dark outer edge and a light inner edge */
  --edge-outer: rgba(15, 42, 66, 0.62);
  --edge-inner: rgba(255, 255, 255, 0.55);

  /* metrics */
  --taskbar-h: 40px;
  --title-h: 30px;
  --frame: 8px;
  --icon-size: 48px;
  --cell-w: 84px;
  --cell-h: 90px;

  /* ink */
  --ink: #14324c;
  --ink-soft: #5c7a94;
  --ink-dim: #8aa0b4;

  --ui: "Segoe UI", Selawik, "Noto Sans", Tahoma, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font: 12px/1.4 var(--ui);
  color: var(--ink);
  background: #0d3357;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

img { -webkit-user-drag: none; }
button { font: inherit; color: inherit; }

/* ==========================================================================
   Startup
   ========================================================================== */

#boot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  background: #000;
  color: #d5e6f5;
  transition: opacity .55s ease;
}
#boot.hide { opacity: 0; pointer-events: none; }

#boot .squares {
  display: grid;
  grid-template-columns: repeat(2, 26px);
  grid-template-rows: repeat(2, 26px);
  gap: 5px;
  transform: perspective(240px) rotateY(-14deg);
}
#boot .squares i {
  border-radius: 2px;
  animation: bootglow 1.8s ease-in-out infinite;
}
#boot .squares i:nth-child(1) { background: #d94a3a; animation-delay: 0s; }
#boot .squares i:nth-child(2) { background: #4fb04a; animation-delay: .18s; }
#boot .squares i:nth-child(3) { background: #2f8ed6; animation-delay: .36s; }
#boot .squares i:nth-child(4) { background: #e8b53c; animation-delay: .54s; }
@keyframes bootglow {
  0%, 100% { opacity: .35; transform: scale(.9); }
  50%      { opacity: 1;   transform: scale(1); }
}
#boot .boot-text {
  font-size: 17px;
  font-weight: 300;
  letter-spacing: .3px;
  opacity: .82;
}

/* ==========================================================================
   Desktop and icons
   ========================================================================== */

#desktop {
  position: fixed;
  inset: 0 0 var(--taskbar-h) 0;
  overflow: hidden;
  background-color: #14568c;
  /* the image itself is set inline by the shell: a relative url() inside a
     custom property would resolve against this stylesheet, not the page */
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
#desktop.fill-fit     { background-size: contain; }
#desktop.fill-stretch { background-size: 100% 100%; }
#desktop.fill-tile    { background-size: auto; background-repeat: repeat; }
#desktop.fill-center  { background-size: auto; }

#icon-layer { position: absolute; inset: 0; }
#icon-layer.hidden { display: none; }

.dicon {
  position: absolute;
  width: var(--cell-w);
  padding: 5px 3px 6px;
  display: grid;
  justify-items: center;
  gap: 5px;
  border-radius: 3px;
  text-align: center;
  cursor: default;
}
.dicon img {
  width: var(--icon-size);
  height: var(--icon-size);
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45));
}
.dicon span {
  max-width: 100%;
  padding: 1px 3px;
  border-radius: 2px;
  font-size: 11px;
  line-height: 1.3;
  color: #fff;
  /* the Win7 label shadow: tight and dark, not a blur halo */
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 4px rgba(0, 0, 0, .55);
  overflow: hidden;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.dicon:hover {
  background: rgba(128, 190, 245, .22);
  box-shadow: inset 0 0 0 1px rgba(170, 218, 255, .45);
}
.dicon.selected {
  background: rgba(88, 165, 240, .35);
  box-shadow: inset 0 0 0 1px rgba(160, 210, 255, .8);
}
.dicon.selected span { background: rgba(20, 74, 132, .5); }
.dicon.dragging { opacity: .5; }

#marquee {
  position: absolute;
  display: none;
  z-index: 5;
  border: 1px solid rgba(178, 222, 255, .9);
  background: rgba(120, 190, 250, .22);
  pointer-events: none;
}

#drop-ghost {
  position: absolute;
  display: none;
  z-index: 6;
  width: var(--cell-w);
  height: var(--cell-h);
  border: 1px dashed rgba(215, 238, 255, .85);
  border-radius: 3px;
  background: rgba(120, 190, 250, .16);
  pointer-events: none;
}

/* ==========================================================================
   Windows
   ========================================================================== */

#window-layer { position: absolute; inset: 0; pointer-events: none; }
#window-layer .window { pointer-events: auto; }

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  min-height: 140px;
  padding: 0 var(--frame) var(--frame);
  border-radius: 7px 7px 3px 3px;
  background: var(--glass-pale);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  /* dark outer line, light inner line, then the drop shadow */
  box-shadow:
    inset 0 0 0 1px var(--edge-inner),
    0 0 0 1px var(--edge-outer),
    0 12px 34px rgba(0, 0, 0, .42),
    0 2px 8px rgba(0, 0, 0, .28);
}
.window.inactive {
  background: hsla(var(--glass-h), 16%, 76%, .42);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .38),
    0 0 0 1px rgba(70, 92, 112, .45),
    0 6px 18px rgba(0, 0, 0, .26);
}
.window.inactive .win-title { color: rgba(36, 58, 78, .55); text-shadow: none; }
.window.minimized { display: none; }
.window.maximized { padding: 0; border-radius: 0; }
.window.snapping {
  transition: left .12s ease, top .12s ease, width .12s ease, height .12s ease;
}

.titlebar {
  position: relative;
  flex: 0 0 var(--title-h);
  height: var(--title-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  cursor: default;
}
.win-icon { width: 16px; height: 16px; flex: 0 0 16px; }
.win-title {
  flex: 1;
  min-width: 0;
  /* leave room for the caption group so the text stays optically centred */
  padding-right: 96px;
  text-align: center;
  font-size: 12px;
  color: var(--ink);
  /* Aero title glow: a soft white halo, not a drop shadow */
  text-shadow: 0 0 6px rgba(255, 255, 255, .95), 0 0 12px rgba(255, 255, 255, .8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.caption-buttons {
  position: absolute;
  top: 0;
  right: 1px;
  display: flex;
}
.cap {
  width: 29px;
  height: 21px;
  display: grid;
  place-items: center;
  color: #16324e;
  border: 1px solid rgba(255, 255, 255, .45);
  border-top: 0;
  background:
    linear-gradient(rgba(255, 255, 255, .62), rgba(210, 232, 250, .28) 52%, rgba(176, 210, 238, .34));
  cursor: default;
}
.cap:first-child { border-radius: 0 0 0 4px; }
.cap:hover  { background: linear-gradient(rgba(255, 255, 255, .95), rgba(205, 234, 255, .6)); }
.cap:active { background: linear-gradient(rgba(160, 202, 238, .9), rgba(205, 232, 252, .75)); }
.cap svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.cap.close {
  width: 45px;
  border-radius: 0 0 4px 4px;
  border-color: rgba(255, 190, 185, .55);
  color: #fff;
  background: linear-gradient(#e8776a, #cf3b2c 52%, #b8261a);
}
.cap.close:hover  { background: linear-gradient(#f4988c, #e04b3a 52%, #c73123); }
.cap.close:active { background: linear-gradient(#b8261a, #d8503f); }

.win-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 0 0 2px 2px;
  box-shadow: 0 0 0 1px rgba(28, 62, 92, .28);
}
.win-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.win-native { width: 100%; height: 100%; overflow: auto; }

.win-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: #f3f7fb;
  color: #46647f;
}
.win-loading.done { display: none; }
.win-loading .lbar {
  width: 180px;
  height: 11px;
  border-radius: 6px;
  background: #dde7f0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .16);
  overflow: hidden;
}
.win-loading .lbar i {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #62b93f, #a8e57e, #62b93f);
  animation: marquee 1.15s linear infinite;
}
@keyframes marquee {
  from { transform: translateX(-105%); }
  to   { transform: translateX(320%); }
}

/* An iframe eats pointer events, so a shield covers every one of them for the
   duration of a drag or resize. Without this, moving a window across another
   window's content stalls the gesture. */
.shield { position: absolute; inset: 0; z-index: 40; display: none; }
body.dragging .shield { display: block; }

.rs { position: absolute; z-index: 20; }
.rs.n  { top: -2px; left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.rs.s  { bottom: -2px; left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.rs.w  { left: -2px; top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.rs.e  { right: -2px; top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.rs.nw { top: -2px; left: -2px; width: 14px; height: 14px; cursor: nwse-resize; }
.rs.ne { top: -2px; right: -2px; width: 14px; height: 14px; cursor: nesw-resize; }
.rs.sw { bottom: -2px; left: -2px; width: 14px; height: 14px; cursor: nesw-resize; }
.rs.se { bottom: -2px; right: -2px; width: 14px; height: 14px; cursor: nwse-resize; }
.window.maximized .rs { display: none; }

#snap-ghost {
  position: absolute;
  display: none;
  z-index: 9000;
  border: 1px solid rgba(200, 232, 255, .95);
  border-radius: 3px;
  background: rgba(135, 195, 250, .2);
  backdrop-filter: blur(2px);
  pointer-events: none;
  transition: left .08s ease, top .08s ease, width .08s ease, height .08s ease;
}

/* ==========================================================================
   Taskbar
   ========================================================================== */

#taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--taskbar-h);
  z-index: 8000;
  display: flex;
  align-items: stretch;
  /* Aero taskbar: bright hairline, a glassy upper half, a darker lower half */
  background:
    linear-gradient(
      rgba(255, 255, 255, .34) 0,
      rgba(255, 255, 255, .10) 45%,
      rgba(0, 0, 0, .12) 46%,
      rgba(0, 0, 0, .30) 100%),
    var(--glass-deep);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),
    0 -1px 0 rgba(0, 0, 0, .35);
}

#start-orb {
  position: relative;
  flex: 0 0 50px;
  display: grid;
  place-items: center;
  cursor: default;
}
#start-orb img {
  width: 46px;
  height: 46px;
  /* the orb sits proud of the bar, the way it does in Windows 7 */
  margin-bottom: 3px;
  transition: filter .12s ease;
}
#start-orb:hover img   { filter: brightness(1.18) drop-shadow(0 0 6px rgba(140, 205, 255, .85)); }
#start-orb.open img    { filter: brightness(1.3) drop-shadow(0 0 9px rgba(170, 220, 255, .95)); }

#task-buttons {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  overflow: hidden;
}

.tbtn {
  position: relative;
  flex: 0 1 auto;
  height: 34px;
  min-width: 42px;
  max-width: 168px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #f2f8ff;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  cursor: default;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
}
.tbtn img { width: 22px; height: 22px; flex: 0 0 22px; }
.tbtn span { overflow: hidden; text-overflow: ellipsis; }

/* pinned but not running: icon only, no frame */
.tbtn.pinned-only { justify-content: center; padding: 0 10px; }
.tbtn.pinned-only span { display: none; }

.tbtn:hover {
  border-color: rgba(255, 255, 255, .40);
  background: linear-gradient(rgba(255, 255, 255, .30), rgba(255, 255, 255, .10));
}
/* running: a quiet raised tile */
.tbtn.running {
  border-color: rgba(255, 255, 255, .26);
  background: linear-gradient(rgba(255, 255, 255, .18), rgba(255, 255, 255, .04));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
/* active: brighter, with the colour wash Aero puts behind the focused button */
.tbtn.active {
  border-color: rgba(255, 255, 255, .5);
  background:
    linear-gradient(rgba(255, 255, 255, .42), rgba(255, 255, 255, .14) 52%, rgba(255, 255, 255, .22));
  box-shadow: inset 0 0 12px var(--accent-soft), inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.tbtn.drop-target { box-shadow: inset 0 0 0 2px rgba(200, 234, 255, .95); }

#tray {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 4px 0 11px;
  border-left: 1px solid rgba(255, 255, 255, .18);
  color: #eef6ff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
}
#tray .tray-icon {
  width: 17px;
  height: 17px;
  opacity: .88;
  cursor: default;
}
#tray .tray-icon:hover { opacity: 1; }

#clock {
  padding: 0 8px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.28;
  font-variant-numeric: tabular-nums;
  border-radius: 3px;
  cursor: default;
}
#clock:hover { background: rgba(255, 255, 255, .14); }

#show-desktop {
  flex: 0 0 13px;
  height: 100%;
  border-left: 1px solid rgba(255, 255, 255, .30);
  background: linear-gradient(rgba(255, 255, 255, .10), rgba(255, 255, 255, .02));
  cursor: default;
}
#show-desktop:hover { background: linear-gradient(rgba(255, 255, 255, .36), rgba(255, 255, 255, .14)); }

/* ==========================================================================
   Start menu
   ========================================================================== */

#start-menu {
  position: fixed;
  left: 3px;
  bottom: calc(var(--taskbar-h) - 3px);
  z-index: 8500;
  width: 490px;
  height: 545px;
  display: none;
  grid-template-columns: 1fr 172px;
  border-radius: 7px 7px 4px 4px;
  background: var(--glass-deep);
  backdrop-filter: blur(calc(var(--blur) + 6px)) saturate(1.5);
  -webkit-backdrop-filter: blur(calc(var(--blur) + 6px)) saturate(1.5);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .45),
    0 0 0 1px var(--edge-outer),
    0 16px 44px rgba(0, 0, 0, .5);
  overflow: hidden;
}
#start-menu.open { display: grid; }

.sm-left {
  display: flex;
  flex-direction: column;
  margin: 7px 0 7px 7px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(24, 60, 92, .3);
  overflow: hidden;
}

.sm-tabs {
  display: flex;
  gap: 1px;
  padding: 6px 6px 0;
  background: #eef4fa;
  border-bottom: 1px solid #c8d9e7;
}
.sm-tab {
  padding: 5px 13px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  color: #2c5479;
  font-size: 11.5px;
  cursor: default;
}
.sm-tab:hover { background: rgba(198, 226, 248, .55); }
.sm-tab.active {
  background: #fff;
  border-color: #c8d9e7;
  color: #123350;
  font-weight: 600;
  margin-bottom: -1px;
  padding-bottom: 6px;
}

.sm-list { flex: 1; overflow-y: auto; padding: 5px; }
.sm-list::-webkit-scrollbar { width: 12px; }
.sm-list::-webkit-scrollbar-thumb {
  border: 3px solid #fff;
  border-radius: 6px;
  background: #b9cddc;
}
.sm-list::-webkit-scrollbar-thumb:hover { background: #93b4cb; }

.sm-cat {
  padding: 9px 7px 4px;
  color: var(--ink-dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .7px;
  text-transform: uppercase;
}
.sm-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: default;
}
.sm-item img { width: 24px; height: 24px; flex: 0 0 24px; }
.sm-item .label { min-width: 0; }
.sm-item .label div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-item .sub { color: var(--ink-dim); font-size: 10.5px; }
.sm-item:hover {
  border-color: #a9d2ef;
  background: linear-gradient(#eef7ff, #cfe6fa);
}
.sm-item.dragging { opacity: .5; }
.sm-item .star {
  margin-left: auto;
  padding: 0 2px;
  font-size: 13px;
  color: #cbd6e0;
}
.sm-item .star.on { color: #e8a521; }
.sm-item .star:hover { color: #f0b23e; }

.sm-search { padding: 7px; background: #f2f8fd; border-top: 1px solid #c8d9e7; }
.sm-search input {
  width: 100%;
  padding: 5px 9px;
  border: 1px solid #9dbdd8;
  border-radius: 2px;
  background: #fff;
  font: inherit;
  color: var(--ink);
  outline: none;
}
.sm-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.sm-right {
  display: flex;
  flex-direction: column;
  padding: 12px 9px 9px;
  color: #f3f9ff;
}
.sm-user { display: grid; justify-items: center; gap: 6px; margin-bottom: 12px; }
.sm-user img {
  width: 54px;
  height: 54px;
  border-radius: 3px;
  background: linear-gradient(#f0f7ff, #b9d8f2);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .75), 0 2px 8px rgba(0, 0, 0, .4);
}
.sm-user .name { font-size: 12.5px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }

.sm-link {
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 12px;
  cursor: default;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
.sm-link:hover {
  border-color: rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .2);
}
.sm-sep { height: 1px; margin: 7px 5px; background: rgba(255, 255, 255, .22); }
.sm-right .spacer { flex: 1; }

.sm-shutdown {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 3px;
  font-size: 12px;
  cursor: default;
  background: linear-gradient(rgba(255, 255, 255, .24), rgba(255, 255, 255, .07));
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
.sm-shutdown:hover { background: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, .16)); }

/* ==========================================================================
   Context menu
   ========================================================================== */

#ctx {
  position: fixed;
  z-index: 9500;
  display: none;
  min-width: 186px;
  padding: 2px;
  border: 1px solid #9db8cf;
  border-radius: 3px;
  background: #fbfdfe;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}
#ctx .ci {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: default;
}
#ctx .ci img { width: 16px; height: 16px; }
#ctx .ci .gap { width: 16px; }
#ctx .ci:hover { border-color: #a9d2ef; background: linear-gradient(#eef7ff, #cfe6fa); }
#ctx .ci.disabled { color: #a7b7c4; pointer-events: none; }
#ctx .csep { height: 1px; margin: 3px 7px; background: #dbe6ef; }

/* ==========================================================================
   Settings, rendered natively inside a window
   ========================================================================== */

.settings { display: flex; height: 100%; background: #fff; }
.set-nav {
  flex: 0 0 152px;
  padding: 8px 6px;
  background: #eff5fa;
  border-right: 1px solid #cddce8;
}
.set-nav div {
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: default;
}
.set-nav div:hover { border-color: #bcdaf0; background: #ddedf9; }
.set-nav div.active {
  border-color: #93bfe0;
  background: linear-gradient(#d5eafb, #b6d9f2);
  font-weight: 600;
}
.set-body { flex: 1; padding: 18px 20px; overflow-y: auto; }
.set-body h2 { margin: 0 0 3px; font-size: 16px; font-weight: 400; color: #12456e; }
.set-body p.hint { margin: 0 0 18px; color: var(--ink-soft); }
.set-row { margin-bottom: 18px; }
.set-row > label { display: block; margin-bottom: 7px; font-weight: 600; color: #2a5075; }
.set-row .inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.account-head { display: flex; align-items: flex-start; gap: 14px; }
.account-head img {
  width: 76px;
  height: 76px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(24, 60, 92, .35), 0 2px 6px rgba(0, 0, 0, .22);
}
.account-head > div { flex: 1; }

.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 7px; }
.avatar-grid .av {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
  cursor: default;
  object-fit: cover;
}
.avatar-grid .av:hover { border-color: #8ec4e9; }
.avatar-grid .av.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; }
.wall-grid .w {
  height: 58px;
  border: 2px solid transparent;
  border-radius: 3px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
  cursor: default;
}
.wall-grid .w:hover { border-color: #8ec4e9; }
.wall-grid .w.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatches .s {
  width: 32px;
  height: 32px;
  border: 2px solid transparent;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  cursor: default;
}
.swatches .s:hover { border-color: #7fb6e0; }
.swatches .s.sel { border-color: var(--ink); }

.set-body input[type=range] { width: 230px; accent-color: var(--accent); vertical-align: middle; }
.set-body input[type=text],
.set-body select,
.set-body textarea {
  padding: 5px 8px;
  border: 1px solid #9dbdd8;
  border-radius: 2px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.set-body input[type=text] { min-width: 240px; }
.set-body input[type=text]:focus,
.set-body select:focus,
.set-body textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.btn {
  padding: 5px 15px;
  border: 1px solid #8db3d1;
  border-radius: 3px;
  background: linear-gradient(#fdfeff, #dfeaf4);
  color: var(--ink);
  cursor: default;
}
.btn:hover { border-color: var(--accent); background: linear-gradient(#fff, #d3e7f8); }
.btn:active { background: linear-gradient(#c3dcf1, #dceaf6); }
.btn.danger { border-color: #ce9a94; background: linear-gradient(#fff7f6, #f4dcd9); color: #8c2a21; }
.btn.danger:hover { border-color: #b8564a; background: linear-gradient(#fff, #f0cbc6); }

.keycap {
  display: inline-block;
  min-width: 96px;
  padding: 4px 12px;
  border: 1px solid #9dbdd8;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #f5fafe;
  font-family: Consolas, "SF Mono", monospace;
  text-align: center;
}
.keycap.listening { border-color: #ddb04a; background: #fff8e2; }

.chk { display: flex; align-items: center; gap: 7px; margin: 7px 0; }
.chk input { width: 14px; height: 14px; accent-color: var(--accent); }

/* ==========================================================================
   Panic layer and toast
   ========================================================================== */

#panic-layer {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: none;
  background: #fff;
}
#panic-layer.on { display: block; }
#panic-layer iframe { width: 100%; height: 100%; border: 0; }
/* the shell keeps its state, it is only made invisible */
body.panicked #desktop,
body.panicked #taskbar,
body.panicked #start-menu,
body.panicked #ctx { visibility: hidden; }

#toast {
  position: fixed;
  right: 12px;
  bottom: calc(var(--taskbar-h) + 12px);
  z-index: 9600;
  display: none;
  max-width: 300px;
  padding: 9px 14px;
  border: 1px solid #9db8cf;
  border-radius: 3px;
  background: #fbfdfe;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}
#toast.show { display: block; animation: toast-in .18s ease; }
@keyframes toast-in {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ==========================================================================
   Small screens: windows fill the space, the right Start column is dropped
   ========================================================================== */

@media (max-width: 720px) {
  #start-menu { width: calc(100vw - 6px); height: 68vh; grid-template-columns: 1fr; }
  .sm-right { display: none; }
  .window:not(.maximized) { border-radius: 5px 5px 2px 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
