/* Quake 2 browser port — stylesheet */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #ddd;
  font-family: "Courier New", Consolas, monospace;
  user-select: none;
}

.hidden { display: none !important; }

/* ---------- video surface ---------- */
#viewport {
  position: fixed;
  inset: 0;
  background: #000;
}

#glcanvas {
  display: block;
  width: 100vw;
  height: 100vh;
  /* сохраняем собственные пропорции канваса (4:3): содержимое буфера вписывается
     в окно с чёрными полями (letterbox) вместо растяжения; разрешение буфера
     задаётся через gl_mode (см. tasks/video.md) */
  object-fit: contain;
  image-rendering: auto;
  cursor: crosshair;
}

body.locked #glcanvas { cursor: none; }

/* ---------- HUD ---------- */
.hud-fps {
  position: fixed;
  top: 4px;
  right: 8px;
  z-index: 30;
  color: #0f0;
  font-size: 12px;
  opacity: 0.8;
}

.hud-center {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  z-index: 30;
  text-align: center;
  font-size: 22px;
  color: #ff0;
  pointer-events: none;
}

.hud-score {
  position: fixed;
  left: 50%;
  top: 15%;
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #444;
  padding: 8px 16px;
  font-size: 13px;
  white-space: pre;
}

/* ---------- console ---------- */
.console {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 45%;
  z-index: 60;
  background: rgba(16, 16, 16, 0.92);
  border-bottom: 2px solid #444;
  display: flex;
  flex-direction: column;
  font-size: 13px;
}

.con-output {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.con-inputline {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-top: 1px solid #333;
}

.con-prompt { color: #0f0; margin-right: 6px; }

#coninput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
}

/* ---------- menu ---------- */
.menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.65);
  overflow-y: auto;
  padding: 40px;
  user-select: none;
}

/* ---------- boot screen ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(circle at 50% 30%, #1a1a2e, #000 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.boot-box {
  text-align: center;
  padding: 32px 48px;
  border: 1px solid #2a2a4a;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 6px;
  /* коробка не растёт за пределы экрана: лог загрузки живёт в
     прокручиваемом блоке .boot-details, кнопка «Запустить» видна всегда */
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 92vh;
  width: min(92vw, 640px);
}

.boot-box h1 {
  font-size: 42px;
  letter-spacing: 6px;
  color: #ddd;
  text-shadow: 0 0 18px #4af;
}

.boot-sub { margin: 8px 0 24px; color: #89a; font-size: 13px; }

.boot-drop {
  border: 2px dashed #3a3a5a;
  border-radius: 6px;
  padding: 28px 36px;
  color: #aab;
  cursor: pointer;
  transition: border-color 0.15s;
  width: 100%;
}

.boot-drop.dragover { border-color: #4af; color: #dff; }

.boot-drop .hint { font-size: 11px; color: #668; margin-top: 8px; }

.boot-drop button {
  margin-top: 16px;
  padding: 8px 22px;
  background: #1c3a5c;
  color: #fff;
  border: 1px solid #2a5a8c;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.boot-drop button:hover { background: #2a4a7c; }

/* итоговая строка: «Загружено файлов: N» — всегда видима, лог свёрнут */
.boot-summary {
  margin-top: 16px;
  font-size: 14px;
  color: #8fa;
  min-height: 18px;
}

/* переключатель «подробно / скрыть» */
.boot-details-toggle {
  margin-top: 8px;
  background: none;
  border: none;
  color: #6a8ab0;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.boot-details-toggle:hover { color: #9ac; }

/* подробности загрузки: фиксированный размер + прокрутка,
   чтобы при сотнях файлов кнопка «Запустить» не уезжала за экран */
.boot-details {
  margin-top: 10px;
  width: 100%;
  height: 220px;
  max-height: 40vh;
  overflow-y: auto;
  text-align: left;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  background: rgba(4, 8, 16, 0.7);
  padding: 8px 12px;
}

.boot-status { margin-top: 0; font-size: 12px; color: #8fa; white-space: pre-wrap; }

/* прогресс загрузки *.pak (см. tasks/boot-progress.md) — всегда видим
   вне сворачиваемого блока «подробно» */
.boot-progress {
  margin-top: 14px;
  text-align: left;
  width: 100%;
}
.boot-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.boot-progress-label {
  font-size: 11px;
  color: #9ac;
  min-height: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* крупный процент — визуальный индикатор загрузки больших файлов */
.boot-progress-pct {
  font-size: 18px;
  font-weight: bold;
  color: #6ab0ff;
  min-width: 52px;
  text-align: right;
}
.boot-progress-track {
  height: 12px;
  border: 1px solid #2a5a8c;
  border-radius: 6px;
  background: #0a1220;
  overflow: hidden;
}
.boot-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1c3a5c, #3a8cf0);
  transition: width 0.15s linear;
}
/* недетерминированный режим («занято») — локальные файлы/нет Content-Length */
.boot-progress.indeterminate .boot-progress-fill {
  width: 40% !important;
  animation: boot-indeterminate 1.2s ease-in-out infinite;
}
@keyframes boot-indeterminate {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

#btn-start {
  margin-top: 18px;
  padding: 10px 34px;
  font-size: 16px;
  background: #5c1c1c;
  border: 1px solid #8c2a2a;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

#btn-start:hover { background: #7c2a2a; }
