html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  padding: 0;
  margin: 0;
  font-family: Verdana, sans-serif;
  font-size: 24px;
}

/* Base view styling - alla vyer är dolda som standard */
.view {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* Vy 1: Unity körs */
.unity-view {
  /* Låt Unity-vyn fungera som PWA-containern:
     fyll hela fönstret och ligga fast mot viewporten */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Höjden begränsas uppåt av footern längst ned */
  bottom: 60px; /* måste matcha footerns höjd nedan */
  width: 100%;
  height: auto;
  background: transparent;
}

.unity-view #gameContainer {
  /* Motsvarar PWA:s #unity-container */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: transparent !important;
}

.unity-view canvas {
  /* Låt canvasen fylla hela containern (som i PWA) */
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 1;
}

.unity-view canvas[data-pixel-art="true"] {
  position: absolute;
  image-rendering: optimizeSpeed;
  image-rendering: -webkit-crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: -o-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: optimize-contrast;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
}

/* Vy 2: Unity laddas */
.loading-view {
  background: transparent;
}

.loading-view .loader {
  width: 100%;
  height: 100%;
  position: absolute;
  display: flex;
  flex-direction: column;
  align-content: center;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.loading-view .container {
  width: 90%;
  max-width: 1440px;
  margin: 0 auto;
  text-align: center;
  padding-top: 0px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Vy 3: Fallback för enheter som inte kan köra Unity */
.fallback-view {
  background: #000;
}

.fallback-view .fallback-container {
  width: 100%;
  height: 100%;
  position: absolute;
  display: flex;
  flex-direction: column;
  align-content: center;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.fallback-view .center {
  width: 90%;
  max-width: 1440px;
  margin: 0 auto;
  text-align: center;
  padding: 20px;
}

h2 {
  margin-top: 0;
}

ul {
  text-align: left;
  padding: 0;
  list-style: none;
}

ul li {
  margin-bottom: 1rem;
  line-height: 1.5;
}

ul li:before {
  content: '';
  width: 20px;
  height: 20px;
  display: inline-block;
  margin-right: 10px;
  background-size: contain;
  vertical-align: middle;
  background-repeat: no-repeat;
  background-position: center center;
  background-image: url(icon-check.svg);
}

.fill {
  height: 6px;
  background: #333;
  display: block;
  /* border-radius: 10px; */
  transition-property: width;
  transition-duration: 1s;
}

.logo {
  width: auto;
  max-width: 100%;
  margin: auto auto 30px auto;
  max-height: 180px;
}

/* Animated Folkhus logo */
.animated-logo {
  width: auto;
  max-width: 100%;
  margin: auto auto 30px auto;
  max-height: 180px;
}

.animated-logo svg {
  width: 100%;
  height: auto;
  max-height: 180px;
}

/* Phase 1: hold still */
@keyframes hold {
  from { transform: rotate(0deg); }
  to   { transform: rotate(0deg); }
}

/* Phase 2: spin-up to 720deg; easing controlled by cubic-bezier */
@keyframes spinup {
  from { transform: rotate(0deg); }
  to   { transform: rotate(720deg); }
}

/* Phase 3: smoother pulse using multiple keyframes */
@keyframes spinpulse {
  0%    { transform: rotate(720deg); }
  12.5% { transform: rotate(810deg); }
  25%   { transform: rotate(990deg); }
  37.5% { transform: rotate(1170deg); }
  50%   { transform: rotate(1260deg); }
  62.5% { transform: rotate(1440deg); }
  75%   { transform: rotate(1620deg); }
  87.5% { transform: rotate(1800deg); }
  100%  { transform: rotate(1890deg); }
}

/* Mirrored blade geometry remains */
.animated-logo #bladeGeom {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(-1, 1);
}

/* Chained animations with specific timing functions per phase
   1) hold: ease-in-out (subtle)
   2) spinup: cubic-bezier for exponential-like ramp
   3) spinpulse: ease-in-out for smooth oscillation */
.animated-logo #blade {
  transform-box: fill-box;
  transform-origin: center;
  animation-name: spinup, spinpulse;
  animation-duration: 1s, 5s;
  animation-timing-function: cubic-bezier(0.3, 0, 0.7, 1), cubic-bezier(0.25, 0.1, 0.25, 1);
  animation-delay: 0.3s, 1.3s;
  animation-iteration-count: 1, infinite;
  animation-fill-mode: forwards, both;
}

.app-hero {
  max-width: 100%;
  margin: auto auto 30px auto;
}

.progressbar {
  box-sizing: border-box;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  border: solid 2px #000000;
}

/* Loading text with animated dots */
.loading-text {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.loading-text span {
  font-size: 32px;
  color: #262121;
  font-weight: 400;
}

/* Animated loading dots */
.loading-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.loading-dots .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #262121;
  animation: dotPulse 1s ease-in-out infinite both;
}

.loading-dots .dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots .dot:nth-child(2) {
  animation-delay: -0.16s;
}

.loading-dots .dot:nth-child(3) {
  animation-delay: 0s;
}

@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

.folkhus-icon {
  width: 16px;
  height: 18px;
  display: inline-block;
  margin-right: 8px;
  background-size: contain;
  vertical-align: middle;
  background-repeat: no-repeat;
  background-position: center center;
}

.folkhus-icon.configurator-white-solid {
  background-image: url(icon-configurator-white-solid.svg);
}

.folkhus-icon.support {
    background-image: url(icon-support.svg);
}

.btn-folkhus {
  display: inline-block;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: #262121;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  background-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15),
              0 1px 1px rgba(0, 0, 0, 0.075);
  transition: color 0.30s ease-in-out,
              background-color 0.30s ease-in-out,
              border-color 0.30s ease-in-out,
              box-shadow 0.30s ease-in-out;
  width: 120px;
  text-transform: uppercase;
  margin: 6px 1px;
}

.btn-folkhus-secondary, .btn-folkhus-secondary:visited {
  color: #fff;
  background-color: #3270cf;
}

.btn-folkhus-primary, .btn-folkhus-primary:visited {
  background-color: #f7c787;
}


/* Mobile adjustments */
@media (max-width: 768px) {
  /* Fallback should not have a background on mobile */
  .fallback-view {
    background: transparent;
  }

  /* Prevent top clipping by notches/status bars and dynamic toolbars */
  .fallback-view .fallback-container {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: 100dvh;
    padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    overflow-y: auto;
  }

  .loading-view .loader {
    padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    min-height: 100dvh;
  }

  html,
  body {
    font-size: 10px;
  }

  .fallback-view .center {
    padding: 10px;
  }

  .logo {
    max-height: 120px;
    margin: 0 0 20px 0;
  }

  .animated-logo {
    max-height: 120px;
    margin: 0 0 20px 0;
  }

  .animated-logo svg {
    max-height: 120px;
  }

  .app-hero {
    margin: 0 0 20px 0;
  }

  .btn-folkhus {
    min-width: 73px;
    max-width: 100%;
    font-size: 9px;
    padding: 4px 5px;
    margin: 4px 1px;
  }

  .loading-text {
    gap: 8px;
    margin: 15px 0;
  }

  .loading-text span {
    font-size: 24px;
  }

  .loading-dots .dot {
    width: 12px;
    height: 12px;
  }

  .loading-dots {
    gap: 6px;
  }
}

#unity-fullscreen-button {
  width: 38px;
  height: 38px;
  background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTggM0g1YTIgMiAwIDAgMC0yIDJ2M20xOCAwVjVhMiAyIDAgMCAwLTItMkgxNk0xNiAyMUgxOWEyIDIgMCAwIDAgMi0ydi0zTTMgMTZ2M2EyIDIgMCAwIDAgMiAyaDMiLz48L3N2Zz4=') center/contain no-repeat;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;

  background-size: 80%;
  padding: 5px;
  position: fixed;
  top: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
}

#unity-fullscreen-button:hover {
  opacity: 1;
}
