/* ==========================================================================
   STARTRACKS - ULTRA CLEAN SINGLE-SCREEN (REFRESH BUTTON & DYNAMIC CONTENT)
   ========================================================================== */

:root {
  --bg-dark: #070709;
  --bg-card: rgba(18, 18, 22, 0.95);
  --border-light: rgba(255, 255, 255, 0.15);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --font-inter: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-inter);
  -webkit-font-smoothing: antialiased;
}

/* STAGE LAYOUT */
.app-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #070709;
}

/* BACKDROP OVERLAY */
.backdrop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.backdrop-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* CENTER STAGE CONTENT */
.center-stage-card {
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 620px;
  padding: 1rem;
}

/* TOP STARBURST LOGO ABOVE TITLE */
.top-starburst-wrapper {
  position: relative;
  width: min(32vw, 130px);
  height: min(32vw, 130px);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.top-starburst-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.85));
}

.top-starburst-wrapper.spinning {
  animation: spinThreeTimesDecelerate 1.3s cubic-bezier(0.12, 0.8, 0.35, 1);
}

@keyframes spinThreeTimesDecelerate {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(1080deg);
  }
}

.brand-title {
  font-family: var(--font-inter);
  font-size: clamp(2.6rem, 5.5vw, 4rem);
  font-weight: 900;
  letter-spacing: -1.5px;
  color: #ffffff;
  margin-bottom: 0.4rem;
  line-height: 1.05;
  text-shadow: 0 4px 25px rgba(0, 0, 0, 0.8);
}

.motto-text {
  font-family: var(--font-inter);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  letter-spacing: 0.5px;
  transition: opacity 0.3s ease;
  white-space: pre-line;
  line-height: 1.35;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.8);
}

/* CIRCULAR REFRESH BUTTON BELOW MOTTO */
.refresh-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-family: var(--font-inter);
  font-size: 1.6rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  line-height: 1;
  margin: 0.4rem auto 0;
}

.refresh-btn:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  transform: scale(1.12);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.refresh-svg {
  width: 22px;
  height: 22px;
  display: block;
  transition: stroke 0.25s ease;
}

.refresh-btn:hover .refresh-svg {
  stroke: #000000;
}

.refresh-btn:not(:hover):not(.spinning) {
  animation: buttonPulse 2.4s ease-in-out infinite;
}

@keyframes buttonPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2);
    border-color: var(--border-light);
  }
  50% {
    box-shadow: 0 0 20px 4px rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.7);
  }
}

.refresh-btn.spinning {
  animation: rotateSpin 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes rotateSpin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* BOTTOM CONTACT FOOTER BAR */
.bottom-contact-bar {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  width: max-content;
  max-width: 90vw;
}

.contact-link {
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-inter);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.3px;
  transition: all 0.25s ease;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.2rem 0.4rem;
}

.contact-link:hover {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.contact-divider {
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.8rem;
  user-select: none;
}

/* TOP RIGHT ANIMATION PAUSE/PLAY TOGGLE BUTTON */
.anim-toggle-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.25s ease, transform 0.25s ease;
  padding: 0.5rem;
  line-height: 1;
  outline: none;
}

.anim-toggle-btn:hover {
  color: #ffffff;
  transform: scale(1.18);
}

.anim-toggle-svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

/* PAUSED ANIMATIONS STATE */
body.animations-paused .floating-frame,
body.animations-paused .floating-frame[class*="frame-"] {
  animation-play-state: paused !important;
}



/* FLOATING FRAMES WITH REAL MEDIA */
.floating-frame {
  position: absolute;
  cursor: pointer;
  z-index: 5;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    top 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    left 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-frame:not(.expanded):hover {
  z-index: 20;
}

.floating-frame:not(.expanded) .frame-border {
  width: 220px;
  aspect-ratio: 1 / 1;
  height: auto;
}

.frame-border {
  padding: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.75);
  position: relative;
  transition: background 0.3s ease, width 0.45s cubic-bezier(0.16, 1, 0.3, 1), height 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-frame:hover .frame-border {
  background: #ffffff;
}

.media-container {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* TEXT FRAME STYLING */
.text-frame-container {
  width: 100%;
  height: 100%;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 6px;
  box-sizing: border-box;
}

.text-frame-content {
  color: #ffffff;
  font-family: var(--font-inter);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  font-style: italic;
  margin: 0;
}

/* EXPANDED FRAME STATE (MEDIA ASPECT-FITTED, ZERO BLACK BARS) */
.floating-frame.expanded {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) rotate(0deg) !important;
  z-index: 1000 !important;
  animation: none !important;
  width: fit-content !important;
  height: fit-content !important;
  max-width: 90vw !important;
  max-height: 85vh !important;
}

.floating-frame.expanded .frame-border {
  aspect-ratio: auto !important;
  width: fit-content !important;
  height: fit-content !important;
  max-width: 90vw !important;
  max-height: 85vh !important;
  background: rgba(255, 255, 255, 0.25);
  padding: 6px;
  border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-frame.expanded .media-container {
  aspect-ratio: auto !important;
  width: auto !important;
  height: auto !important;
  max-width: calc(90vw - 12px) !important;
  max-height: calc(85vh - 12px) !important;
  background: transparent !important;
}

.floating-frame.expanded .text-frame-container {
  aspect-ratio: auto !important;
  width: min(85vw, 620px) !important;
  height: auto !important;
  min-height: 240px;
  padding: 3.5rem 2.5rem;
  border-radius: 8px;
}

.floating-frame.expanded .text-frame-content {
  font-size: 1.45rem;
  line-height: 1.6;
}

.floating-frame.expanded .frame-media {
  aspect-ratio: auto !important;
  width: auto !important;
  height: auto !important;
  max-width: calc(90vw - 12px) !important;
  max-height: calc(85vh - 12px) !important;
  object-fit: contain !important;
  border-radius: 8px;
  display: block;
}

/* MAGNIFYING LENS (LUPA) FOR EXPANDED DIARY PHOTOS ONLY (4X ZOOM) */
.magnifier-lens {
  position: fixed;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.7), 0 20px 40px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  z-index: 2000;
  display: none;
  background-repeat: no-repeat;
  transition: transform 0.05s ease-out;
}

.floating-frame.expanded img.frame-media[data-category="diary"] {
  cursor: zoom-in;
}

/* MINIMAL CLOSE CROSS */
.frame-close-btn {
  position: absolute;
  top: -42px;
  right: -5px;
  z-index: 1050;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-inter);
  font-weight: 300;
  font-size: 2.2rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.2s ease, color 0.2s ease;
  user-select: none;
}

.floating-frame.expanded .frame-close-btn {
  opacity: 1;
  pointer-events: auto;
}

.frame-close-btn:hover {
  color: #ffffff;
  transform: scale(1.2);
}

/* UNIFIED TOP/LEFT POSITIONS & FLOATING ANIMATIONS */
.frame-1 {
  top: 10%;
  left: 8%;
  animation: float1 7s ease-in-out infinite alternate;
}

.frame-2 {
  top: 12%;
  left: 74%;
  animation: float2 8s ease-in-out infinite alternate;
}

.frame-3 {
  top: 64%;
  left: 10%;
  animation: float3 7.5s ease-in-out infinite alternate;
}

.frame-4 {
  top: 66%;
  left: 74%;
  animation: float4 8.5s ease-in-out infinite alternate;
}

@keyframes float1 {
  0% {
    transform: translate(0, 0) rotate(-2deg);
  }

  100% {
    transform: translate(15px, 18px) rotate(1deg);
  }
}

@keyframes float2 {
  0% {
    transform: translate(0, 0) rotate(3deg);
  }

  100% {
    transform: translate(-18px, 14px) rotate(-1deg);
  }
}

@keyframes float3 {
  0% {
    transform: translate(0, 0) rotate(1deg);
  }

  100% {
    transform: translate(16px, -14px) rotate(-2deg);
  }
}

@keyframes float4 {
  0% {
    transform: translate(0, 0) rotate(-3deg);
  }

  100% {
    transform: translate(-14px, -18px) rotate(2deg);
  }
}



/* RESPONSIVE MOBILE FIT (SINGLE VIEWPORT 4-CORNER FLOATING LAYOUT) */
@media (max-width: 900px) {
  .app-stage {
    flex-direction: column;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
  }

  /* TOP STARBURST MOVED TO TOP-LEFT CORNER ON MOBILE */
  .top-starburst-wrapper {
    position: absolute;
    top: 1.2rem;
    left: 1.2rem;
    width: 42px;
    height: 42px;
    margin-bottom: 0;
    z-index: 100;
  }

  /* TOP RIGHT ANIMATION TOGGLE BUTTON */
  .anim-toggle-btn {
    top: 1.2rem;
    right: 1.2rem;
    font-size: 1.15rem;
    padding: 0.3rem;
  }

  .center-stage-card {
    padding: 1rem 0.5rem;
    max-width: 92vw;
    z-index: 15;
  }

  .brand-title {
    font-size: clamp(2.2rem, 9vw, 3.2rem);
    margin-bottom: 0.3rem;
  }

  .motto-text {
    font-size: clamp(0.92rem, 3.8vw, 1.15rem);
    margin-bottom: 1rem;
  }

  .refresh-btn {
    width: 44px;
    height: 44px;
  }

  /* CONTACT FOOTER BAR - SINGLE LINE & SAFE AREA FOR MOBILE BROWSERS */
  .bottom-contact-bar {
    bottom: 1.2rem;
    bottom: max(1.2rem, env(safe-area-inset-bottom, 1.2rem));
    gap: 0.4rem;
    width: 100%;
    max-width: 98vw;
    padding: 0 0.3rem;
  }

  .contact-link {
    font-size: clamp(0.74rem, 3.3vw, 0.9rem);
    white-space: nowrap;
    padding: 0.2rem 0.2rem;
  }

  .contact-divider {
    font-size: 0.75rem;
    opacity: 0.4;
  }

  /* SQUARE FLOATING FRAMES ON MOBILE (1:1 ASPECT RATIO, OPTIMAL FLUID SPACE FIT) */
  .floating-frame:not(.expanded) .frame-border {
    width: min(38vw, 155px);
    aspect-ratio: 1 / 1;
    height: auto;
    padding: 5px;
    border-radius: 12px;
  }

  .text-frame-container {
    padding: 0.5rem 0.4rem;
  }

  .text-frame-content {
    font-size: 0.75rem;
    line-height: 1.35;
  }

  /* 2 TOP FRAMES & 2 BOTTOM FRAMES (CENTERED VERTICALLY IN UPPER/LOWER HALF) */
  .floating-frame:not(.expanded).frame-1 {
    position: absolute !important;
    top: 13.5% !important;
    left: 3.5% !important;
    right: auto !important;
    bottom: auto !important;
    animation: float1Mobile 6.5s ease-in-out infinite alternate;
  }

  .floating-frame:not(.expanded).frame-2 {
    position: absolute !important;
    top: 15.5% !important;
    right: 3.5% !important;
    left: auto !important;
    bottom: auto !important;
    animation: float2Mobile 7.5s ease-in-out infinite alternate;
  }

  .floating-frame:not(.expanded).frame-3 {
    position: absolute !important;
    bottom: 12% !important;
    left: 3.5% !important;
    top: auto !important;
    right: auto !important;
    animation: float3Mobile 7s ease-in-out infinite alternate;
  }

  .floating-frame:not(.expanded).frame-4 {
    position: absolute !important;
    bottom: 14% !important;
    right: 3.5% !important;
    top: auto !important;
    left: auto !important;
    animation: float4Mobile 8s ease-in-out infinite alternate;
  }

  .floating-frame.expanded .frame-close-btn {
    top: -38px;
    right: 0;
  }
}

/* TIGHTER MOBILE FLOATING ANIMATIONS (GPU ACCELERATED, 0% CPU LAG) */
@keyframes float1Mobile {
  0% {
    transform: translate(0, 0) rotate(-2deg);
  }
  100% {
    transform: translate(7px, 9px) rotate(1deg);
  }
}

@keyframes float2Mobile {
  0% {
    transform: translate(0, 0) rotate(2deg);
  }
  100% {
    transform: translate(-9px, 7px) rotate(-1deg);
  }
}

@keyframes float3Mobile {
  0% {
    transform: translate(0, 0) rotate(1deg);
  }
  100% {
    transform: translate(8px, -7px) rotate(-2deg);
  }
}

@keyframes float4Mobile {
  0% {
    transform: translate(0, 0) rotate(-2deg);
  }
  100% {
    transform: translate(-7px, -9px) rotate(1deg);
  }
}