:root {
  --blue: #0b69ff;
  --cyan: #00a2ff;
  --bg: #030812;
  --panel: rgba(3, 8, 18, 0.86);
  --line: rgba(0, 149, 255, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 16% 18%, rgba(0, 149, 255, 0.2), transparent 28rem),
    radial-gradient(circle at 84% 74%, rgba(19, 185, 95, 0.12), transparent 24rem),
    var(--bg);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

.cube-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.cube-toolbar {
  position: fixed;
  top: 18px;
  left: clamp(14px, 3vw, 44px);
  right: clamp(14px, 3vw, 44px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  pointer-events: none;
}

.cube-toolbar > * {
  pointer-events: auto;
}

.cube-brand {
  display: none;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px 10px 10px;
  background: var(--panel);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

.cube-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.cube-brand span {
  display: grid;
  gap: 3px;
}

.cube-brand strong {
  color: #fff;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  font-weight: 900;
  line-height: 0.95;
  white-space: nowrap;
}

.cube-brand strong span {
  color: var(--blue);
}

.cube-brand small {
  color: #d9e8ff;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.template-picker {
  position: relative;
}

.template-toggle,
.template-menu button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font: inherit;
  font-weight: 900;
}

.template-toggle {
  gap: 10px;
  width: 54px;
  min-height: 54px;
  border: 1px solid rgba(0, 149, 255, 0.48);
  padding: 0;
  color: #fff;
  background: #0759f7;
  box-shadow: 0 16px 34px rgba(0, 88, 255, 0.32);
  cursor: pointer;
}

.template-toggle svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  transition: transform 180ms ease;
}

.template-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.template-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  width: min(290px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(14px);
}

.template-menu[hidden] {
  display: none;
}

.template-menu button {
  justify-content: flex-start;
  min-height: 42px;
  border: 1px solid transparent;
  padding: 0 12px;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.template-menu button:hover,
.template-menu button:focus-visible,
.template-menu button.is-active {
  border-color: rgba(0, 149, 255, 0.56);
  background: rgba(0, 149, 255, 0.16);
  outline: none;
}

.cube-scene {
  width: 100vw;
  height: 100vh;
  perspective: 1800px;
  perspective-origin: 50% 50%;
}

.site-cube {
  --depth-x: 50vw;
  --depth-y: 50vh;
  position: relative;
  width: 100vw;
  height: 100vh;
  transform-style: preserve-3d;
  transition: transform 960ms cubic-bezier(0.2, 0.74, 0.18, 1);
}

.site-cube[data-active-face="front"] {
  transform: translateZ(calc(var(--depth-x) * -1)) rotateY(0deg);
}

.site-cube[data-active-face="right"] {
  transform: translateZ(calc(var(--depth-x) * -1)) rotateY(-90deg);
}

.site-cube[data-active-face="back"] {
  transform: translateZ(calc(var(--depth-x) * -1)) rotateY(-180deg);
}

.site-cube[data-active-face="left"] {
  transform: translateZ(calc(var(--depth-x) * -1)) rotateY(90deg);
}

.site-cube[data-active-face="top"] {
  transform: translateZ(calc(var(--depth-y) * -1)) rotateX(-90deg);
}

.site-cube[data-active-face="bottom"] {
  transform: translateZ(calc(var(--depth-y) * -1)) rotateX(90deg);
}

.site-cube.is-bottom-interactive {
  transform: none;
  transition: none;
}

.site-cube.is-bottom-interactive .cube-face {
  opacity: 0;
  pointer-events: none;
}

.site-cube.is-bottom-interactive .face-bottom {
  z-index: 2;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.cube-face {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #fff;
  backface-visibility: hidden;
  box-shadow: 0 0 0 1px rgba(0, 149, 255, 0.24), 0 26px 90px rgba(0, 0, 0, 0.34);
}

.cube-face iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.face-front {
  transform: rotateY(0deg) translateZ(var(--depth-x));
}

.face-right {
  transform: rotateY(90deg) translateZ(var(--depth-x));
}

.face-back {
  transform: rotateY(180deg) translateZ(var(--depth-x));
}

.face-left {
  transform: rotateY(-90deg) translateZ(var(--depth-x));
}

.face-top {
  transform: rotateX(90deg) translateZ(var(--depth-y));
}

.face-bottom {
  transform: rotateX(-90deg) translateZ(var(--depth-y));
}

@media (max-width: 720px) {
  .cube-toolbar {
    align-items: flex-start;
  }

  .cube-brand {
    padding: 8px;
  }

  .cube-brand img {
    width: 38px;
    height: 38px;
  }

  .cube-brand strong {
    font-size: 1.06rem;
  }

  .cube-brand small {
    display: none;
  }

  .template-toggle {
    width: 46px;
    min-height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-cube,
  .template-toggle svg {
    transition: none;
  }
}
