* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
body {
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  font-family: Tahoma, Arial, sans-serif;
}
.monitor {
  position: relative;
  width: min(1120px, calc(100vw - 24px), calc((100svh - 24px) * 1.5));
  aspect-ratio: 3/2;
  background: url("../assets/aim-monitor.png") center/100% 100% no-repeat;
  filter: drop-shadow(0 18px 25px #392d1f35);
}
.desktop {
  position: absolute;
  inset: 10.35% 12.7% 18.8%;
  overflow: hidden;
  background: #5b8ecc url("../assets/bliss.jpg") center/cover no-repeat;
  border-radius: 1.3%;
  box-shadow: inset 0 0 25px #001a3d99;
}
.desktop-icon {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 82px;
  margin: 24px 0 0 25px;
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.2;
  text-shadow: 1px 1px #001433;
}
.desktop-icon:nth-child(2) {
  margin-top: 18px;
}
.desktop-icon:nth-child(3) {
  margin-top: 18px;
}
.desktop-icon:nth-child(4) {
  margin-top: 18px;
}
.desktop-icon:nth-child(5) {
  margin-top: 18px;
}
.icon-picture {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
}
.icon-picture img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}
.tom-picture {
  overflow: hidden;
  border: 2px solid #fff;
  background: #ccc;
  box-shadow: 1px 1px #111;
}
.tom-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.aim-picture img {
  width: 45px;
  height: 45px;
  filter: drop-shadow(1px 2px 1px #111);
}
.computer-picture {
  font-size: 37px;
  text-shadow: none;
}
.solitaire-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: drop-shadow(1px 2px 1px #1118);
}
.mine-icon {
  display: grid;
  width: 44px;
  height: 44px;
  grid-template-columns: repeat(3, 1fr);
  background: #999;
  box-shadow: 2px 3px 4px #1119;
  transform: perspective(60px) rotateX(3deg) rotateY(-4deg);
}
.mine-icon i {
  position: relative;
  border: 1px solid #888;
  background: #c0c0c0;
}
.mine-icon i:nth-child(1)::after,
.mine-icon i:nth-child(5)::after,
.mine-icon i:nth-child(7)::after {
  content: "1";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #0000ef;
  font: 700 16px/1 "Courier New", monospace;
  text-shadow: none;
}
.mine-icon i:nth-child(2)::after {
  content: "3";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ef0000;
  font: 700 16px/1 "Courier New", monospace;
  text-shadow: none;
}
.mine-icon i:nth-child(3)::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #050505;
  box-shadow: -4px 0 #050505, 4px 0 #050505, 0 -4px #050505, 0 4px #050505;
  transform: translate(-50%, -50%);
}
.desktop-icon:focus-visible,
.desktop-icon:hover span:last-child {
  outline: 1px dotted #fff;
  background: #083d8caa;
}
.taskbar {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  background: #c0c0c0;
  border-top: 2px solid #fff;
  box-shadow: inset 0 -1px #777;
  font-size: 12px;
}
.start {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 25px;
  padding: 2px 8px;
  color: #111;
  text-decoration: none;
  font-weight: 700;
  border: 2px outset #eee;
}
.start b {
  color: #167b30;
  font-size: 17px;
}
.task-name {
  padding: 5px 12px;
  border: 2px inset #eee;
}
.taskbar time {
  margin-left: auto;
  padding: 5px 8px;
  border: 2px inset #eee;
}
.glass {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(
    125deg,
    #fff1,
    transparent 28%,
    transparent 72%,
    #fff08
  );
  box-shadow: inset 0 0 25px #0008;
}
.computer-screensaver { position:absolute; inset:0; z-index:4; width:100%; height:100%; opacity:0; visibility:hidden; pointer-events:none; }
.desktop.screensaver-on .computer-screensaver { opacity:1; visibility:visible; pointer-events:auto; }
/* Lay out the actual hit targets, rather than scaling a clipped column. */
.desktop-icons { display: grid; grid-template-columns: repeat(2, 96px); gap: 12px; padding: 22px; }
.desktop-icon, .desktop-icon:nth-child(n) { width: 96px; min-height: 80px; margin: 0; padding: 7px 0; align-content: center; }
@media (max-width: 700px), (max-height: 500px) {
  .desktop-icons { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; max-width: 320px; }
  .desktop-icon, .desktop-icon:nth-child(n) { width: 100%; min-height: 80px; font-size: 13px; }
  .taskbar { height: 48px; gap: 4px; font-size: 11px; }
  .start { height: 44px; padding: 2px 7px; }
  .task-name, .taskbar time { padding: 5px 4px; white-space: nowrap; }
}
/* The physical controls stay on the long lower bezel in either orientation. */
@media (max-width: 700px) and (orientation: portrait) {
  .monitor { width: calc(100vw - 12px); }
  .desktop-icons { max-width: none; padding: 3px 6px; gap: 2px; }
  .desktop-icon, .desktop-icon:nth-child(n) { min-height: 48px; padding: 1px 0; gap: 2px; font-size: 11px; }
  .icon-picture, .mine-icon { width: 28px; height: 28px; }
  .taskbar { height: 44px; }
  .start { height: 40px; }
}

@media (max-height: 360px) and (orientation: landscape) {
  .desktop-icons { padding: 6px; gap: 4px; }
  .desktop-icon, .desktop-icon:nth-child(n) { min-height: 68px; padding: 2px 0; }
  .icon-picture { width: 36px; height: 36px; }
  .mine-icon { width: 36px; height: 36px; }
}

/* Keep the icon artwork inside its box and leave clear space for the label. */
.desktop-icons { position: absolute; inset: 16px 12px 60px; display: block; padding: 0; max-width: none; }
.desktop-icon, .desktop-icon:nth-child(n) { position: absolute; width: 100px; height: 84px; min-height: 0; padding: 4px; gap: 7px; top: 0; left: 0; touch-action: none; user-select: none; -webkit-user-select: none; text-shadow: 0 1px 2px #001433; }
.desktop-icon:nth-child(even) { left: 112px; }
.desktop-icon:nth-child(n+3) { top: 98px; }
.desktop-icon.dragging { z-index: 6; cursor: grabbing; }
.icon-picture img, .aim-picture img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.mine-icon { --mine-size: 44px; width: var(--mine-size); height: var(--mine-size); transform: none; }
.mine-icon i::after { font-size: calc(var(--mine-size) / 3) !important; }
.mine-icon i:nth-child(3)::before { width: 25%; height: 25%; box-shadow: -2px 0 #050505, 2px 0 #050505, 0 -2px #050505, 0 2px #050505; }
@media (max-width: 700px) and (orientation: portrait) {
  .desktop-icons { inset: 2px 4px 46px; }
  .desktop-icon, .desktop-icon:nth-child(n) { width: 50%; height: 48px; padding: 1px; gap: 3px; }
  .desktop-icon:nth-child(even) { left: 50%; }
  .desktop-icon:nth-child(n+3) { top: 50%; }
  .mine-icon { --mine-size: 28px; }
}
@media (max-height: 360px) and (orientation: landscape) {
  .desktop-icons { inset: 4px 8px 52px; }
  .desktop-icon, .desktop-icon:nth-child(n) { height: 68px; gap: 4px; padding: 2px; }
  .desktop-icon:nth-child(n+3) { top: 72px; }
  .mine-icon { --mine-size: 36px; }
}

img[src$="solitaire-logo.png"] { clip-path: polygon(23% 18%, 29% 9%, 43% 6%, 69% 6%, 74% 10%, 74% 28%, 80% 34%, 78% 38%, 74% 38%, 74% 79%, 36% 88%, 27% 80%, 27% 40%, 21% 39%, 18% 35%, 26% 26%); }

.monitor { view-transition-name:desk-computer; }

.desktop { perspective:1000px; box-shadow:inset 0 0 18px #000b; }
.desktop-icons { transform:translateZ(-3px); }
.desktop .glass { background:radial-gradient(ellipse at 23% 12%,#fff9dc19,transparent 55%),linear-gradient(118deg,transparent 18%,#d3e2e80f 37%,transparent 64%); background-size:150% 150%; border-radius:4% / 6%; box-shadow:inset 0 0 10px #0008; pointer-events:none; transition:background-position 180ms; }
@media(prefers-reduced-motion:reduce) { .desktop .glass { transition:none; } }
