:root {
  --ink: #1c140c;
  --ink-soft: #2a1d12;
  --label: #f7f7f7;
  --label-stroke: #5c5c5c;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html {
  background:
    linear-gradient(
      to bottom,
      #7a1410 0%,
      #c43c18 42%,
      #e07a20 56%,
      #f0c45a 100%
    );
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--ink);
  font-family: var(--font);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 38%, transparent 42%, rgba(40, 8, 0, 0.22) 100%),
    linear-gradient(to bottom, rgba(80, 0, 0, 0.08), transparent 28%, transparent 70%, rgba(90, 40, 0, 0.12));
}

.backdrop-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  transform: scale(1.06);
  animation: sky-drift 28s ease-in-out infinite alternate;
}

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  min-height: 100svh;
  padding:
    max(4.5vh, env(safe-area-inset-top, 0px))
    max(1.25rem, env(safe-area-inset-right, 0px))
    max(10vh, env(safe-area-inset-bottom, 0px))
    max(1.25rem, env(safe-area-inset-left, 0px));
  gap: clamp(1.5rem, 4.5vh, 2.75rem);
}

.brand {
  margin: 0;
  line-height: 0;
}

.logo {
  display: block;
  width: min(30rem, 36vw, 46vh);
  max-width: calc(100vw - 2.5rem);
  height: auto;
  filter: drop-shadow(0 14px 28px rgba(40, 0, 0, 0.45));
  animation: logo-float 5.5s ease-in-out infinite;
  user-select: none;
  -webkit-user-drag: none;
}

.links {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(0.875rem, 3.25vmin, 2.25rem);
}

.link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.05rem;
  width: 8.625rem;
  min-height: 66px;
  color: var(--ink-soft);
  text-decoration: none;
  outline: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.icon {
  display: grid;
  place-items: center;
  width: clamp(5.4rem, 12vmin, 8.25rem);
  height: clamp(5.4rem, 12vmin, 8.25rem);
  transform-origin: center bottom;
  transition:
    transform 280ms var(--ease-out),
    filter 280ms var(--ease-out);
  filter: drop-shadow(0 3px 8px rgba(40, 10, 0, 0.28));
}

.icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.label {
  color: var(--label);
  font-size: clamp(1.38rem, 0.375rem + 2.25vmin, 1.68rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
  -webkit-text-stroke: 2px var(--label-stroke);
  paint-order: stroke fill;
  text-shadow: 0 1px 2px rgba(20, 8, 0, 0.32);
  transition:
    color 280ms var(--ease-out),
    transform 280ms var(--ease-out),
    filter 280ms var(--ease-out);
}

.link:active .icon {
  transform: scale(0.94);
}

.link:focus-visible .icon {
  transform: translateY(-4px) scale(1.06);
  filter:
    drop-shadow(0 8px 14px rgba(40, 10, 0, 0.32))
    drop-shadow(0 0 12px rgba(255, 196, 80, 0.42));
}

.link:focus-visible .label {
  color: #fff;
  filter: drop-shadow(0 0 8px rgba(255, 196, 80, 0.35));
}

.link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 15px;
  border-radius: 21px;
}

@media (hover: hover) and (pointer: fine) {
  .link:hover .icon {
    transform: translateY(-5px) scale(1.08);
    filter:
      drop-shadow(0 10px 16px rgba(40, 10, 0, 0.34))
      drop-shadow(0 0 14px rgba(255, 190, 70, 0.42));
  }

  .link:hover .label {
    color: #fff;
    transform: translateY(-1px);
    filter: drop-shadow(0 0 8px rgba(255, 196, 80, 0.28));
  }

  .link:active .icon {
    transform: translateY(-1px) scale(1.02);
  }
}

@keyframes sky-drift {
  from {
    transform: scale(1.06) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.12) translate3d(0, -1.2%, 0);
  }
}

@keyframes logo-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.55rem);
  }
}

@media (max-width: 720px) {
  .stage {
    padding:
      max(6vh, env(safe-area-inset-top, 0px))
      max(1rem, env(safe-area-inset-right, 0px))
      max(12vh, env(safe-area-inset-bottom, 0px))
      max(1rem, env(safe-area-inset-left, 0px));
    gap: clamp(1.6rem, 4.5vh, 2.4rem);
  }

  .logo {
    width: min(18rem, 64vw, 34vh);
  }

  .links {
    width: min(36rem, 100%);
    gap: clamp(0.7rem, 4vw, 1.4rem);
  }

  .link {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: 9.75rem;
    padding: 0.225rem 0.3rem;
  }

  .icon {
    width: clamp(4.5rem, 23vw, 7.275rem);
    height: clamp(4.5rem, 23vw, 7.275rem);
  }

  .label {
    font-size: 1.35rem;
  }
}

@media (max-height: 520px) {
  .stage {
    padding:
      max(2.5vh, env(safe-area-inset-top, 0px))
      max(1rem, env(safe-area-inset-right, 0px))
      max(4vh, env(safe-area-inset-bottom, 0px))
      max(1rem, env(safe-area-inset-left, 0px));
    gap: 0.9rem;
  }

  .logo {
    width: min(13rem, 42vh, 40vw);
  }

  .icon {
    width: clamp(4.125rem, 18vh, 5.4rem);
    height: clamp(4.125rem, 18vh, 5.4rem);
  }

  .link {
    gap: 0.6rem;
  }

  .label {
    font-size: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .backdrop-image,
  .logo,
  .icon,
  .label {
    animation: none;
    transition: none;
  }

  .backdrop-image {
    transform: none;
  }
}
