:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  background: #fff;
  color: #161616;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-width: 240px; min-height: 100%; }

body { height: 100vh; height: 100svh; overflow: hidden; background: #fff; }

.desktop {
  position: absolute;
  inset: 0 0 78px;
  overflow: hidden;
}

.portrait {
  position: absolute;
  left: 34px;
  top: 34px;
  width: min(360px, 62vw, 64vh);
  padding: 0;
  border: 0;
  margin: 0;
  border-radius: 0;
  background: transparent;
  transform: scale(.8333333333);
  transform-origin: 0 0;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.portrait.is-dragging { cursor: grabbing; }
.portrait.is-resizing { cursor: nwse-resize; }
.portrait img { display: block; width: 100%; height: auto; pointer-events: none; }

.resize-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 36px;
  height: 36px;
  cursor: nwse-resize;
  touch-action: none;
  visibility: hidden;
}

.portrait.is-ready .resize-handle { visibility: visible; }
.resize-handle:focus-visible { outline: 1px solid #111; outline-offset: 1px; }
.resize-handle::after {
  content: '';
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 9px;
  height: 9px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  background: repeating-linear-gradient(135deg, transparent 0 3px, rgb(255 255 255 / 75%) 3px 4px);
}

.pointer {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  visibility: hidden;
  z-index: 2;
}

.pointer-arrow, .pointer-resize {
  position: absolute;
  display: block;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 12%));
}

.pointer-arrow { left: -2.111111px; top: -1.411765px; }
.pointer-resize { left: -9px; top: -9px; opacity: 0; }

footer {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 20px;
  right: 20px;
}

nav { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 12px 26px; }

nav a {
  display: inline-block;
  color: #626262;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 400;
  text-decoration: none;
  text-underline-offset: 4px;
  padding-block: 5px;
  transition: color 150ms ease;
}

nav a:hover { color: #111; text-decoration: underline; }
nav a:focus-visible { color: #111; outline: 1px solid #111; outline-offset: 5px; }

@media (max-width: 540px) {
  .desktop { bottom: 88px; }
  .portrait { left: 22px; top: 22px; width: min(236px, 66vw, 58vh); }
  nav { gap: 8px 20px; }
  nav a { font-size: 11px; }
  footer { left: 16px; right: 16px; bottom: max(24px, env(safe-area-inset-bottom)); }
}

@media (max-height: 420px) {
  .desktop { bottom: 62px; }
  footer { bottom: max(14px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .portrait { left: 50%; top: 50%; transform: translate(-50%, -50%); }
}
