/* ==========================================================================
   Snake 2048 - "Cyber-Circuit Neon" landing screen
   Palette and type tokens live in theme.css (shared with the in-game HUD in
   game-ui.css); only component rules belong here.
   This overlays the PIXI canvas and hands off to the game via landing.js.
   ========================================================================== */

#landing {
  --header-h: 68px;

  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-body);
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

#landing[hidden] {
  display: none;
}

#landing.is-leaving {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

/* --- background ---------------------------------------------------------- */

.lp-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 220, 230, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 220, 230, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.lp-grid::after {
  /* soft vignette so the neon in the middle reads brighter */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 60% 45%, rgba(0, 220, 230, 0.07), transparent 60%);
}

/* --- header -------------------------------------------------------------- */

.lp-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(17, 19, 24, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(58, 73, 75, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lp-header-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.lp-wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: linear-gradient(to right, var(--primary-fixed-dim), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 8px rgba(0, 220, 230, 0.55));
  white-space: nowrap;
}

/* --- main ---------------------------------------------------------------- */

.lp-main {
  position: relative;
  z-index: 10;
  height: 100%;
  padding: calc(var(--header-h) + 16px) 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  overflow-y: auto;
}

/* title lockup */

.lp-title {
  text-align: center;
  animation: lp-rise 0.7s ease both;
}

.lp-title-main {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(56px, 11vw, 120px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 0 20px rgba(0, 220, 230, 0.6);
}

.lp-title-sub {
  display: block;
  margin-top: -0.12em;
  font-family: var(--font-display);
  font-size: clamp(42px, 8.5vw, 90px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  color: var(--secondary);
  text-shadow: 0 0 15px rgba(255, 171, 243, 0.5);
}

/* rotating tile */

.lp-cube-stage {
  perspective: 1000px;
  flex: none;
}

.lp-cube {
  --cube: 132px;
  position: relative;
  width: var(--cube);
  height: var(--cube);
  transform-style: preserve-3d;
  animation: lp-rotate-cube 12s infinite linear;
}

.lp-cube-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: calc(var(--cube) * 0.4);
  font-weight: 800;
  color: #000;
  background: var(--secondary);
  border: 2px solid var(--secondary-container);
  box-shadow: inset 0 0 40px rgba(254, 0, 254, 0.5);
}

.lp-cube-face.f-front  { transform: rotateY(0deg)    translateZ(calc(var(--cube) / 2)); }
.lp-cube-face.f-back   { transform: rotateY(180deg)  translateZ(calc(var(--cube) / 2)); }
.lp-cube-face.f-right  { transform: rotateY(90deg)   translateZ(calc(var(--cube) / 2)); }
.lp-cube-face.f-left   { transform: rotateY(-90deg)  translateZ(calc(var(--cube) / 2)); }
.lp-cube-face.f-top    { transform: rotateX(90deg)   translateZ(calc(var(--cube) / 2)); }
.lp-cube-face.f-bottom { transform: rotateX(-90deg)  translateZ(calc(var(--cube) / 2)); }

.lp-cube-shadow {
  width: 96px;
  height: 14px;
  margin: 42px auto 0;
  border-radius: 9999px;
  background: rgba(0, 220, 230, 0.2);
  filter: blur(14px);
  animation: lp-breathe 2s ease-in-out infinite;
}

/* interaction column */

.lp-actions {
  width: 100%;
  max-width: 448px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lp-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(17, 19, 24, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 220, 230, 0.2);
}

.lp-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(227, 253, 255, 0.06), transparent);
  transform: translateX(-100%);
  animation: lp-shimmer 3s linear infinite;
  pointer-events: none;
}

.lp-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.lp-field.is-right {
  flex: none;
  align-items: flex-end;
}

.lp-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--outline);
}

.lp-rank {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--tertiary-fixed);
}

#lp-name {
  width: 100%;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--primary-fixed);
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s ease;
}

#lp-name::placeholder {
  color: rgba(132, 148, 149, 0.7);
  text-transform: uppercase;
}

#lp-name:hover {
  border-bottom-color: rgba(0, 220, 230, 0.3);
}

#lp-name:focus {
  border-bottom-color: var(--primary-fixed-dim);
}

/* primary CTA */

.lp-start {
  position: relative;
  width: 100%;
  padding: 24px 32px;
  border: 1px solid rgba(0, 220, 230, 0.4);
  border-radius: 0;
  background: var(--surface);
  color: #fff;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  cursor: pointer;
  overflow: hidden;
  animation: lp-pulse-glow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  transition: transform 0.15s ease, border-color 0.3s ease;
}

.lp-start::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(111, 246, 255, 0.35), transparent 70%);
  transition: opacity 0.3s ease;
}

.lp-start:hover::before {
  opacity: 0.3;
}

.lp-start:hover {
  border-color: var(--primary-fixed);
}

.lp-start:active {
  transform: scale(0.97);
}

.lp-start:focus-visible {
  outline: 2px solid var(--primary-fixed);
  outline-offset: 3px;
}

.lp-start span {
  position: relative;
  z-index: 1;
}

.lp-start i {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 0 solid var(--primary-fixed);
}

.lp-start i:nth-child(1) { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.lp-start i:nth-child(2) { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.lp-start i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.lp-start i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

/* booting state, before the game bundle has built its intro screen */

.lp-start[disabled] {
  cursor: progress;
  color: var(--outline);
  border-color: rgba(58, 73, 75, 0.6);
  animation: none;
}

.lp-start[disabled] i {
  border-color: var(--outline-variant);
}

.lp-start[disabled]::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 35%;
  background: linear-gradient(90deg, transparent, var(--primary-fixed-dim), transparent);
  animation: lp-scan 1.4s ease-in-out infinite;
}

/* hint strip */

.lp-hint {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 16px;
  background: rgba(26, 28, 32, 0.4);
  border-left: 2px solid var(--tertiary-fixed);
}

.lp-hint-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  background: rgba(121, 255, 91, 0.1);
  color: var(--tertiary-fixed);
}

.lp-hint-icon svg {
  width: 22px;
  height: 22px;
}

.lp-hint-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--tertiary-fixed);
}

.lp-hint-body {
  font-size: 12px;
  color: var(--outline);
}

/* --- footer -------------------------------------------------------------- */

.lp-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 16px;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(132, 148, 149, 0.45);
}

.lp-meter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.lp-meter-track {
  width: 128px;
  height: 4px;
  overflow: hidden;
  background: var(--surface-variant);
  border-radius: 9999px;
}

.lp-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-fixed-dim), var(--primary-container));
  box-shadow: 0 0 8px rgba(0, 220, 230, 0.5);
  transition: width 0.35s ease;
}

/* --- animations ---------------------------------------------------------- */

@keyframes lp-rotate-cube {
  0%   { transform: rotateX(0deg) rotateY(0deg); }
  100% { transform: rotateX(360deg) rotateY(360deg); }
}

@keyframes lp-pulse-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 220, 230, 0.4); border-color: rgba(0, 220, 230, 0.4); }
  50%      { box-shadow: 0 0 25px rgba(0, 220, 230, 0.8); border-color: rgba(0, 220, 230, 1); }
}

@keyframes lp-shimmer {
  0%   { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

@keyframes lp-scan {
  0%   { transform: translateX(-30%); }
  100% { transform: translateX(310%); }
}

@keyframes lp-breathe {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.9; }
}

@keyframes lp-rise {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: none; }
}

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 639px) {
  #landing { --header-h: 56px; }
  .lp-header { padding: 0 16px; }
  .lp-wordmark { font-size: 20px; }
  .lp-main { gap: 24px; padding-bottom: 64px; }
  .lp-cube { --cube: 104px; }
  .lp-cube-shadow { margin-top: 28px; }
  .lp-actions { gap: 16px; }
  .lp-start { padding: 20px 16px; font-size: 18px; letter-spacing: 0.16em; }
  .lp-hint { display: none; }
  /* the SYST readout is the first flex child; hiding it would strand the
     meter on the left, so pin the footer to the right instead */
  .lp-footer { justify-content: flex-end; }
  .lp-footer .lp-syst { display: none; }
}

@media (max-height: 700px) and (min-width: 640px) {
  .lp-main { gap: 24px; }
  .lp-cube { --cube: 104px; }
  .lp-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #landing *,
  #landing *::before,
  #landing *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .lp-start { box-shadow: 0 0 14px rgba(0, 220, 230, 0.5); }
}
