:root {
  color-scheme: dark;
  --bq-night: #0a202b;
  --bq-blue: #123848;
  --bq-blue-soft: #245a64;
  --bq-parchment: #f7e9c5;
  --bq-parchment-soft: #e8d09a;
  --bq-gold: #e4b84f;
  --bq-gold-light: #f8dc83;
  --bq-ink: #102b3a;
  --bq-shadow: rgba(4, 14, 20, 0.58);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bq-night);
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--bq-parchment);
}

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

#bq-shell,
#unity-canvas,
#bq-loading {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#bq-shell {
  isolation: isolate;
  background: var(--bq-night);
}

#unity-canvas {
  display: block;
  z-index: 1;
  opacity: 0;
  background: #1F1F20;
  outline: none;
  touch-action: none;
  transition: opacity 420ms ease;
}

#unity-canvas.bq-ready {
  opacity: 1;
}

#bq-loading {
  z-index: 5;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: max(24px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 37%, rgba(244, 194, 87, 0.16), transparent 29%),
    radial-gradient(circle at 16% 12%, rgba(86, 150, 154, 0.16), transparent 23%),
    linear-gradient(160deg, #173e4d 0%, var(--bq-night) 58%, #071820 100%);
  opacity: 1;
  visibility: visible;
  transition: opacity 420ms ease, visibility 0s linear 420ms;
}

#bq-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.2'/%3E%3C/svg%3E");
}

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

.bq-language-switch {
  position: absolute;
  z-index: 8;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  display: flex;
  gap: 9px;
  padding: 7px;
  border: 1px solid rgba(247, 233, 197, 0.2);
  border-radius: 15px;
  background: rgba(7, 24, 32, 0.54);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}

.bq-language-button {
  position: relative;
  display: grid;
  grid-template-columns: 32px auto;
  align-items: center;
  gap: 7px;
  min-width: 67px;
  min-height: 40px;
  padding: 5px 9px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(247, 233, 197, 0.7);
  background: transparent;
  font: inherit;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.bq-language-button:hover {
  color: var(--bq-parchment);
  border-color: rgba(248, 220, 131, 0.32);
  background: rgba(247, 233, 197, 0.07);
  transform: translateY(-1px);
}

.bq-language-button[aria-pressed="true"] {
  color: var(--bq-gold-light);
  border-color: rgba(248, 220, 131, 0.58);
  background: rgba(228, 184, 79, 0.13);
}

.bq-language-button[aria-pressed="true"]::after {
  position: absolute;
  right: 9px;
  bottom: 3px;
  left: 9px;
  height: 2px;
  border-radius: 999px;
  content: "";
  background: var(--bq-gold-light);
  box-shadow: 0 0 7px rgba(248, 220, 131, 0.65);
}

.bq-language-button:focus-visible {
  outline: 3px solid var(--bq-gold-light);
  outline-offset: 3px;
}

.bq-flag {
  position: relative;
  display: block;
  width: 32px;
  height: 21px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 3px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.bq-flag-es {
  background: linear-gradient(to bottom, #aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75% 100%);
}

.bq-flag-en {
  background:
    linear-gradient(to right, transparent 0 40%, #cf142b 40% 60%, transparent 60% 100%),
    linear-gradient(to bottom, transparent 0 35%, #cf142b 35% 65%, transparent 65% 100%),
    #fff;
}

.bq-language-code {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.bq-sky,
.bq-hills {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bq-sky::before {
  content: "";
  position: absolute;
  width: min(58vw, 760px);
  aspect-ratio: 1;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(248, 220, 131, 0.1);
  box-shadow: 0 0 0 64px rgba(248, 220, 131, 0.025), 0 0 0 128px rgba(248, 220, 131, 0.018);
}

.bq-star {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--bq-gold-light);
  box-shadow: 0 0 10px rgba(248, 220, 131, 0.8);
  animation: bqTwinkle 3.6s ease-in-out infinite;
}

.bq-star-a { left: 15%; top: 19%; }
.bq-star-b { left: 27%; top: 10%; animation-delay: -1.2s; }
.bq-star-c { right: 18%; top: 16%; animation-delay: -2.3s; }
.bq-star-d { right: 29%; top: 29%; animation-delay: -0.7s; }
.bq-star-e { left: 20%; top: 38%; animation-delay: -3s; }

.bq-hills {
  top: auto;
  transform-origin: center bottom;
}

.bq-hills-far {
  bottom: -1px;
  height: 31%;
  opacity: 0.55;
  background: #153744;
  clip-path: polygon(0 49%, 10% 38%, 18% 49%, 30% 24%, 39% 42%, 49% 19%, 60% 42%, 69% 30%, 80% 47%, 91% 28%, 100% 43%, 100% 100%, 0 100%);
}

.bq-hills-near {
  bottom: -1px;
  height: 22%;
  background: #0b2732;
  clip-path: polygon(0 44%, 12% 28%, 25% 52%, 38% 32%, 51% 57%, 65% 25%, 77% 49%, 89% 33%, 100% 51%, 100% 100%, 0 100%);
}

.bq-loading-content {
  position: relative;
  z-index: 2;
  width: min(88vw, 560px);
  text-align: center;
  filter: drop-shadow(0 18px 34px var(--bq-shadow));
  animation: bqArrive 900ms cubic-bezier(.2, .75, .25, 1) both;
}

.bq-title-art-wrap {
  position: relative;
  width: min(88vw, 620px);
  margin: 0 auto clamp(8px, 1.8vh, 18px);
}

.bq-title-art {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 18px rgba(6, 18, 24, 0.52));
}

.bq-kicker {
  margin: 0 0 5px;
  color: var(--bq-gold-light);
  font-size: clamp(0.62rem, 1.5vw, 0.76rem);
  font-weight: 750;
  letter-spacing: 0.24em;
}

.bq-tagline {
  margin: 12px 0 clamp(25px, 4vh, 38px);
  color: rgba(247, 233, 197, 0.78);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.98rem, 2.3vw, 1.2rem);
  letter-spacing: 0.015em;
}

.bq-progress {
  position: relative;
  width: min(100%, 390px);
  height: 9px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(248, 220, 131, 0.38);
  border-radius: 999px;
  background: rgba(3, 15, 21, 0.48);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.34), 0 1px 0 rgba(255, 255, 255, 0.04);
}

#unity-progress-bar-full {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b97924 0%, var(--bq-gold) 55%, var(--bq-gold-light) 100%);
  box-shadow: 0 0 14px rgba(248, 220, 131, 0.38);
  transition: width 180ms ease-out;
}

#unity-progress-bar-full::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  margin-left: auto;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62));
  animation: bqShimmer 1.5s ease-in-out infinite;
}

.bq-progress-meta {
  display: flex;
  justify-content: space-between;
  width: min(100%, 390px);
  margin: 9px auto 0;
  color: rgba(247, 233, 197, 0.68);
  font-size: clamp(0.72rem, 1.7vw, 0.84rem);
  letter-spacing: 0.035em;
}

#bq-progress-value {
  min-width: 3ch;
  color: var(--bq-gold-light);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

#unity-warning {
  position: fixed;
  z-index: 20;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  display: none;
  gap: 8px;
  width: min(92vw, 620px);
  transform: translateX(-50%);
}

.bq-message {
  padding: 11px 15px;
  border: 1px solid rgba(247, 233, 197, 0.25);
  border-radius: 12px;
  color: #fff8e7;
  background: rgba(11, 39, 50, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  font-size: 0.88rem;
  text-align: center;
}

.bq-message-error {
  border-color: rgba(255, 143, 117, 0.6);
  background: rgba(89, 37, 28, 0.96);
}

#unity-fullscreen-button {
  position: fixed;
  z-index: 4;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 42px;
  height: 42px;
  padding: 0;
  cursor: pointer;
  border: 1px solid rgba(247, 233, 197, 0.34);
  border-radius: 12px;
  color: var(--bq-parchment);
  background: rgba(10, 32, 43, 0.72);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

#unity-fullscreen-button[hidden] {
  display: none;
}

#unity-fullscreen-button span,
#unity-fullscreen-button span::before {
  position: absolute;
  inset: 11px;
  content: "";
  border: solid currentColor;
  border-width: 2px 0 0 2px;
}

#unity-fullscreen-button span::before {
  inset: 7px -7px -7px 7px;
  transform: rotate(180deg);
}

#unity-fullscreen-button:hover {
  color: var(--bq-gold-light);
  border-color: rgba(248, 220, 131, 0.7);
  background: rgba(10, 32, 43, 0.9);
}

#unity-fullscreen-button:focus-visible {
  outline: 3px solid var(--bq-gold-light);
  outline-offset: 3px;
}

/* Keep the mobile browser fullscreen control clear of the in-game action buttons. */
.bq-mobile #unity-fullscreen-button {
  top: max(16px, env(safe-area-inset-top));
  bottom: auto;
}

#diagnostics-icon {
  position: fixed;
  z-index: 7;
  right: 12px;
  top: 12px;
}

.bq-profiler {
  position: fixed;
  z-index: 8;
  left: 8px;
  bottom: 8px;
}

@keyframes bqArrive {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bqTwinkle {
  0%, 100% { opacity: 0.28; transform: scale(0.8); }
  50% { opacity: 0.9; transform: scale(1.25); }
}

@keyframes bqShimmer {
  0%, 100% { opacity: 0.08; }
  50% { opacity: 0.72; }
}

@media (max-height: 590px) {
  .bq-language-switch { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
  .bq-title-art-wrap { width: min(72vw, 440px); margin-bottom: 4px; }
  .bq-tagline { margin: 7px 0 18px; }
  .bq-kicker { letter-spacing: 0.17em; }
}

@media (max-width: 420px) {
  .bq-language-switch { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); gap: 5px; padding: 5px; }
  .bq-language-button { grid-template-columns: 28px auto; min-width: 59px; min-height: 36px; padding: 4px 7px; }
  .bq-flag { width: 28px; height: 18px; }
  .bq-kicker { max-width: 290px; margin-right: auto; margin-left: auto; line-height: 1.45; }
  .bq-progress-meta { font-size: 0.72rem; }
}

#bq-rotate {
  position: fixed;
  z-index: 15;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 37%, rgba(244, 194, 87, 0.16), transparent 29%),
    linear-gradient(160deg, #173e4d 0%, var(--bq-night) 58%, #071820 100%);
  text-align: center;
}

#bq-rotate[hidden] {
  display: none;
}

.bq-rotate-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 320px;
}

.bq-rotate-icon {
  width: 72px;
  height: 72px;
  color: var(--bq-gold-light);
  animation: bqRotateHint 2.2s ease-in-out infinite;
}

.bq-rotate-title {
  margin: 0;
  color: var(--bq-parchment);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.bq-rotate-copy {
  margin: 0;
  color: rgba(247, 233, 197, 0.78);
  font-size: 0.92rem;
  line-height: 1.5;
}

@keyframes bqRotateHint {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(12deg); }
}

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