/* Project 3008: the setup wizard, the game and the result card. */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Window chrome glyphs ---------- */

.controls [data-action="minimize"]::before {
  content: "";
  width: 6px;
  height: 2px;
  margin-top: 6px;
  background: var(--ink);
}
.controls [data-action="maximize"]::before {
  content: "";
  width: 9px;
  height: 8px;
  border: 1px solid var(--ink);
  border-top-width: 2px;
}
.window.maximized .controls [data-action="maximize"]::before {
  width: 7px;
  height: 6px;
  box-shadow: 2px -2px 0 -1px var(--face), 2px -2px 0 0 var(--ink);
}

/* ---------- Wizard layout ---------- */

.installer { width: min(660px, calc(100vw - 16px)); }

.wizard { min-height: 0; }

.pages {
  position: relative;
  flex: 1;
  min-height: 0;
  height: 404px;
  overflow: auto;
}
.installer.maximized .pages { height: auto; }

.page { min-height: 100%; display: flex; flex-direction: column; }

.page h2 { outline: none; }

/* Welcome and finish pages: the classic side banner */
.page-hero {
  display: grid;
  grid-template-columns: 164px 1fr;
  background: var(--hi);
}
.side-art {
  background: var(--select);
  overflow: hidden;
}
.side-art svg { display: block; width: 100%; height: 100%; }
.hero-body { padding: 18px 24px 16px; display: flex; flex-direction: column; }
.hero-body h2 {
  margin: 0 0 16px;
  font: bold 18px/1.25 Verdana, var(--ui);
}
.hero-body p { margin: 0 0 10px; max-width: 52ch; }
.hero-body .push { margin-top: auto; padding-top: 8px; }
.quiet { color: #555; font-size: 12.5px; }

/* Interior pages: white header band */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 14px 10px 20px;
  background: var(--hi);
  border-bottom: 1px solid var(--shadow);
  box-shadow: 0 1px 0 var(--hi);
}
.page-head h2 { margin: 0; font-size: 13.5px; font-weight: bold; }
.page-head p { margin: 3px 0 0 16px; font-size: 13px; }
.head-icon { flex: none; width: 32px; height: 32px; }
.head-icon svg { width: 32px; height: 32px; }

.page-content { padding: 14px 24px 10px 36px; flex: 1; }
.page-content .lead { margin: 0 0 8px; }

/* License */
.eula {
  height: 196px;
  overflow: auto;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.5;
}
.eula h3 { margin: 0 0 6px; font-size: 13px; }
.eula p { margin: 0 0 8px; }
.eula ol { margin: 0; padding-left: 22px; }
.eula li { margin-bottom: 6px; }
.eula:focus-visible { outline: 1px dotted var(--ink); outline-offset: -4px; }

.accept { border: 0; margin: 0; padding: 10px 0 0; display: grid; gap: 4px; }
.accept label { display: inline-flex; align-items: center; width: fit-content; }

/* Group boxes */
.group {
  margin: 0;
  padding: 8px 10px 10px;
  border: 1px solid var(--shadow);
  box-shadow: inset 1px 1px 0 var(--hi), 1px 1px 0 var(--hi);
}
.group legend { padding: 0 4px; }

/* Hardware */
.check-log {
  height: 118px;
  margin: 0 0 12px;
  padding: 6px 10px;
  font: 12px/1.45 var(--mono);
  white-space: pre;
  overflow: hidden;
}
.gpu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; }
.gpu-grid legend { grid-column: 1 / -1; }
.gpu-grid label { display: flex; align-items: flex-start; gap: 2px; padding: 3px 2px; }
.gpu-grid input { margin-top: 3px; }
.gpu-grid .gpu-name { display: block; }
.gpu-grid .gpu-spec { display: block; font-size: 11.5px; color: #5a5a5a; }
.estimate { min-height: 3em; margin: 12px 0 0; font-weight: bold; }
.estimate s { color: var(--shadow); font-weight: normal; }

/* Game files */
.dropzone {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 26px 16px;
  text-align: center;
  outline: 1px dashed var(--shadow);
  outline-offset: -9px;
}
.dropzone p { margin: 0; }
.dropzone .browse { margin-top: 6px; }
.dropzone.over { background: #e8edff; outline-color: var(--select); }
.verdict { min-height: 4.4em; margin: 12px 0 4px; }
.verdict .checking { color: #555; }

/* Installing */
.install-action { margin: 0 0 2px; }
.install-file {
  margin: 0 0 8px;
  font: 12px/1.4 var(--mono);
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress { height: 22px; padding: 3px; }
.progress-fill {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(90deg, var(--select) 0 9px, transparent 9px 11px);
}
.install-meta { display: flex; justify-content: space-between; margin: 5px 0 10px; font-size: 12.5px; }
.install-log {
  height: 112px;
  margin: 0;
  padding: 6px 10px;
  font: 12px/1.5 var(--mono);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.install-log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.install-log div:last-child::after { content: "_"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.waiting {
  display: grid;
  justify-items: start;
  gap: 2px;
  min-height: 112px;
  padding: 6px 0 0;
}
.waiting p { margin: 0; }
.waiting .countdown { font: bold 26px/1.2 var(--mono); letter-spacing: -0.02em; }
.waiting .waited { color: #444; }
.waiting .now-playing { color: #444; font-style: italic; margin-bottom: 8px; }

.tip { margin: 12px 0 0; min-height: 2.9em; color: #333; font-size: 12.5px; }

/* Finish */
.results {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 4px 0 14px;
  padding: 10px 12px;
  background: var(--face);
  box-shadow: var(--sunken);
}
.results dt { color: #444; }
.results dd { margin: 0; font-weight: bold; }
.share-row { display: flex; flex-wrap: wrap; gap: 6px; }
.visit { display: inline-flex; align-items: center; width: fit-content; margin-top: 14px; }

/* Footer */
.wizard-foot { flex: none; }
.brand-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 0 8px;
  color: var(--shadow);
  font-size: 12px;
  text-shadow: 1px 1px 0 var(--hi);
}
.brand-line hr { flex: 1; }
.wizard-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 10px 9px;
}
.wizard-buttons .btn-cancel { margin-left: 8px; }

/* ---------- The game ---------- */

.game {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: #000;
  outline: none;
}
.stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  user-select: none;
  touch-action: none;
}
.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.game.crashed canvas { filter: grayscale(1) brightness(0.65); }

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font: bold clamp(11px, 1.3vw, 15px)/1.35 var(--mono);
  color: var(--hi);
  text-shadow: 2px 2px 0 var(--ink);
}
.hud > span { position: absolute; }
.hud-fps { top: 2.5%; left: 2%; font-size: clamp(16px, 2.6vw, 30px); color: #ffe14d; }
.hud-gfx { top: 2.5%; right: 2%; text-align: right; }
.hud-speed { bottom: 3%; right: 2%; font-size: clamp(14px, 2vw, 22px); }
.hud-hint { bottom: 3%; left: 2%; display: flex; gap: 2.2em; opacity: 0.9; }
.hud-stutter { top: 46%; left: 50%; translate: -50% 0; padding: 4px 10px; background: rgba(0, 0, 0, 0.6); white-space: nowrap; }

.shaders {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  background: #000;
  color: #d8d8d8;
  font: 14px/1.4 var(--mono);
  text-align: center;
}
.shaders p { margin: 0; }
.shaders .shader-title { font: italic bold clamp(22px, 3vw, 34px)/1.1 var(--serif); color: var(--hi); }
.shaders .shader-count { font-size: clamp(16px, 2vw, 22px); }
.shaders .progress { width: min(360px, 70vw); background: #111; box-shadow: inset 0 0 0 1px #555; }
.shaders .progress-fill { background: repeating-linear-gradient(90deg, #ffe14d 0 9px, transparent 9px 11px); }
.shaders .shader-note { color: #8c8c8c; font-size: 12.5px; }

.paused {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  color: var(--hi);
  font: italic bold clamp(24px, 4vw, 44px)/1.1 var(--serif);
  text-shadow: 3px 3px 0 var(--ink);
}

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  .page-hero { grid-template-columns: 1fr; }
  .side-art { display: none; }
  .page-content { padding: 12px 14px; }
  .page-head p { margin-left: 0; }
  .gpu-grid { grid-template-columns: repeat(2, 1fr); }
  .pages { height: min(470px, calc(100dvh - 210px)); }
  .hud-hint { display: none; }
  .brand-line span { display: none; }
}

@media (max-height: 640px) {
  .pages { height: calc(100dvh - 190px); }
}
