:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", Verdana, Arial, sans-serif;
  font-size: 16px;
  --chrome: #c0c0c0;
  --chrome-light: #ffffff;
  --chrome-mid: #dfdfdf;
  --chrome-dark: #404040;
  --night: #07111b;
  --night-soft: #112231;
  --gold: #ffd56a;
  --cyan: #5ee7ef;
}

* { box-sizing: border-box; }

html,
body,
.app-shell {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  background: var(--night);
  color: #fff;
  letter-spacing: 0;
}

button,
input { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

.lock-screen,
.loading-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background-color: #126c6f;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.05) 1px, transparent 1px);
  background-size: 8px 8px;
}

.window {
  width: min(92vw, 470px);
  border: 3px solid;
  border-color: var(--chrome-light) var(--chrome-dark) var(--chrome-dark) var(--chrome-light);
  background: var(--chrome);
  color: #000;
  box-shadow: 10px 12px 0 rgba(0,0,0,.28);
}

.title-bar {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 3px;
  padding: 5px 6px 5px 12px;
  background: #000080;
  color: #fff;
  font-size: 1.12rem;
  font-weight: 700;
}

.window-close,
.win-button {
  border: 3px solid;
  border-color: var(--chrome-light) var(--chrome-dark) var(--chrome-dark) var(--chrome-light);
  background: var(--chrome);
  color: #000;
  text-decoration: none;
  box-shadow: 1px 1px 0 #000;
}

.window-close {
  width: 34px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  line-height: 1;
}

.window-body { padding: 24px; }

.window-body h1 {
  margin: 18px 0 8px;
  font-size: clamp(1.55rem, 6vw, 2rem);
  line-height: 1.15;
}

.window-body p {
  margin: 0 0 22px;
  font-size: 1.08rem;
  line-height: 1.45;
}

.city-monitor {
  height: 110px;
  position: relative;
  overflow: hidden;
  border: 4px inset #dfdfdf;
  background: #07111b;
}

.building {
  position: absolute;
  bottom: 0;
  width: 18%;
  background-color: #192b38;
  background-image: radial-gradient(circle, var(--gold) 0 2px, transparent 3px);
  background-size: 16px 15px;
}

.building-one { left: 5%; height: 58%; }
.building-two { left: 27%; height: 82%; }
.building-three { left: 53%; height: 68%; }
.building-four { right: 4%; height: 92%; }

form { display: grid; gap: 10px; }

label { font-weight: 700; }

input {
  width: 100%;
  min-height: 52px;
  border: 3px inset #fff;
  background: #fff;
  color: #000;
  padding: 8px 12px;
  font-size: 1.25rem;
}

.win-button {
  min-height: 56px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
}

.win-button:active,
.window-close:active {
  border-color: var(--chrome-dark) var(--chrome-light) var(--chrome-light) var(--chrome-dark);
  box-shadow: none;
  transform: translate(1px, 1px);
}

.password-help {
  margin: 3px 0 0 !important;
  font-size: .9rem !important;
  text-align: center;
}

.password-help a {
  display: inline-block;
  padding: 7px;
  color: #000080;
}

.lock-status {
  min-height: 25px;
  margin: 14px 0 0 !important;
  color: #8b0000;
  font-weight: 700;
}

.loading-screen {
  align-content: center;
  color: #fff;
  text-align: center;
  background-color: var(--night);
}

.loading-screen h1 {
  margin: 22px 0 8px;
  font-size: clamp(1.65rem, 7vw, 2.4rem);
}

.loading-screen p { font-size: 1.08rem; }

.loading-city {
  width: min(78vw, 420px);
  height: 150px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  border-bottom: 5px solid #92a8b7;
}

.loading-city span {
  width: 17%;
  background-color: #1d3444;
  background-image: radial-gradient(circle, #40505b 0 2px, transparent 3px);
  background-size: 18px 18px;
  animation: city-lights 1.4s steps(2, end) infinite;
}

.loading-city span:nth-child(1) { height: 48%; animation-delay: -.2s; }
.loading-city span:nth-child(2) { height: 82%; animation-delay: -.8s; }
.loading-city span:nth-child(3) { height: 64%; animation-delay: -.4s; }
.loading-city span:nth-child(4) { height: 95%; animation-delay: -1.1s; }
.loading-city span:nth-child(5) { height: 56%; animation-delay: -.6s; }

@keyframes city-lights {
  50% {
    background-image: radial-gradient(circle, var(--gold) 0 2px, transparent 3px);
    transform: translateY(-3px);
  }
}

.progress-track {
  width: min(78vw, 460px);
  height: 30px;
  margin: 24px auto 8px;
  padding: 4px;
  border: 3px inset #fff;
  background: var(--chrome);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: repeating-linear-gradient(90deg, #000080 0 15px, transparent 15px 18px);
  transition: width .2s linear;
}

.progress-label { min-height: 24px; }

.viewer-screen {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #02070b;
}

.viewer-header,
.viewer-controls {
  z-index: 20;
  display: flex;
  align-items: center;
  background: rgba(7,17,27,.94);
}

.viewer-header {
  min-height: 64px;
  justify-content: space-between;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
  border-bottom: 1px solid #42515d;
}

.viewer-title {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.viewer-title strong { font-size: 1.12rem; }
.viewer-title span { color: #c4d1d9; font-size: .9rem; }

.header-button,
.control-button {
  display: grid;
  place-items: center;
  border: 2px solid #93a5b1;
  background: #172a38;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}

.header-button {
  width: 48px;
  height: 48px;
  font-size: 2rem;
  line-height: 1;
}

.reset-button { font-size: 1.6rem; }

.photo-viewer {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #02070b;
  touch-action: none;
}

.photo-viewer:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 4px solid var(--cyan);
  outline-offset: 2px;
}

.viewer-controls {
  min-height: 78px;
  justify-content: space-between;
  gap: 8px;
  padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  border-top: 1px solid #42515d;
}

.control-button {
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  font-size: 2.3rem;
  line-height: 1;
}

.header-button:active,
.control-button:active { background: #315268; }

.photo-dots {
  min-width: 104px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.photo-dot {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: transparent;
}

.photo-dot[aria-current="true"] { background: var(--gold); }

.ready-message,
.picture-nav-message,
.full-loading {
  z-index: 15;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(90vw, 430px);
  border: 2px solid #9eb1bd;
  background: rgba(7,17,27,.94);
  color: #fff;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0,0,0,.45);
}

.ready-message,
.picture-nav-message {
  top: calc(max(8px, env(safe-area-inset-top)) + 74px);
  padding: 12px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.picture-nav-message {
  top: auto;
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + 88px);
}

.ready-message.visible,
.picture-nav-message.visible { opacity: 1; }

.ready-message strong,
.ready-message span,
.picture-nav-message strong,
.picture-nav-message span { display: block; }

.ready-message span,
.picture-nav-message span { margin-top: 4px; color: #d8e2e8; }

.viewer-screen.navigation-hint-visible #previous-button,
.viewer-screen.navigation-hint-visible #next-button {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255,213,106,.28);
}

.full-loading {
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + 88px);
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
}

.full-loading.complete { border-color: #72db91; }

.spinner {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 4px solid #42515d;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#full-loading-percent { min-width: 42px; color: var(--gold); }

@media (max-width: 430px) {
  .window-body { padding: 19px; }
  .viewer-controls { gap: 5px; }
  .control-button { flex-basis: 49px; width: 49px; height: 49px; }
  .photo-dots { min-width: 82px; gap: 8px; }
  .photo-dot { width: 14px; height: 14px; }
}

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