:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #10131a;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #27324a 0, #10131a 55%, #080a0f 100%);
}

#app-shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#unity-canvas {
  display: block;
  width: auto;
  height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  aspect-ratio: 9 / 16;
  border: 0;
  outline: 0;
  background: #10131a;
  box-shadow: 0 24px 80px rgb(0 0 0 / 45%);
}

#loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(8 10 15 / 82%);
  transition: opacity 220ms ease, visibility 220ms ease;
}

#loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  width: min(360px, calc(100vw - 48px));
  padding: 28px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 22px;
  background: rgb(22 27 38 / 92%);
  box-shadow: 0 22px 70px rgb(0 0 0 / 35%);
}

.brand {
  color: #71a7ff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.loading-title {
  margin-top: 8px;
  font-size: 21px;
  font-weight: 700;
}

.progress-track {
  height: 8px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(255 255 255 / 9%);
}

#progress {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #337cff, #6ec6ff);
  transition: width 120ms linear;
}

#loading-status {
  margin-top: 10px;
  color: rgb(255 255 255 / 62%);
  font-size: 13px;
}

#unity-warning {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  z-index: 20;
  width: min(560px, calc(100vw - 28px));
  transform: translateX(-50%);
}

.banner {
  margin-bottom: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #17120a;
  background: #ffd36e;
  box-shadow: 0 8px 28px rgb(0 0 0 / 30%);
}

.banner.error {
  color: #fff;
  background: #b32636;
}

@media (max-aspect-ratio: 9 / 16) {
  #unity-canvas {
    width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    height: auto;
  }
}

@media (max-width: 720px) {
  #unity-canvas {
    box-shadow: none;
  }
}

/* Панель проверки заказа — только для тестовой страницы */
#order-check {
  position: fixed;
  inset: auto 0 0 0;
  max-height: 70vh;
  overflow-y: auto;
  background: #0f141c;
  color: #f2f5f9;
  border-top: 2px solid #2f86ff;
  padding: 18px 20px 26px;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  z-index: 50;
}
#order-check.hidden { display: none; }
.order-check-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.order-check-head b { font-size: 16px; }
.order-check-head button {
  background: none;
  border: 1px solid #35435a;
  color: #9fb0c6;
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font: inherit;
}
.order-check-head button:hover { border-color: #2f86ff; color: #f2f5f9; }
#order-check table { border-collapse: collapse; margin-bottom: 14px; }
#order-check th {
  text-align: left;
  color: #8fa1b8;
  font-weight: 500;
  padding: 4px 18px 4px 0;
  white-space: nowrap;
}
#order-check td { padding: 4px 0; }
#order-check .count { color: #69b6ff; margin: 0 0 12px; }
#order-check .render {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid #1d2735;
}
#order-check .render img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  flex-shrink: 0;
}
#order-check a { color: #69b6ff; }
