/* ===== Base ===== */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

.sage-body {
  position: relative;
  height: 100dvh;
  background: #010d23;
  color: #ffffff;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* Background image overlay */
.sage-bg {
  position: fixed;
  inset: 0;
  background-image: url("assets/sage_bg_desktop.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.9;
  z-index: 0;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== Header ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: #02143a;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-claim {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  color: #ffffff;
  font-weight: 600;
  font-size: 16px;
  padding: 11px 28px;
  border-radius: 12px;
  background: linear-gradient(90deg, #3fc6e0 0%, #7573ee 100%);
  box-shadow: 0 4px 14px rgba(63, 198, 224, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-claim:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(117, 115, 238, 0.4);
}

.coin-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.btn-all-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: #1a2a4a;
  font-weight: 600;
  font-size: 16px;
  padding: 11px 22px;
  border-radius: 12px;
  background: #ffffff;
  border: 2px solid #8f8bff;
  transition: transform 0.2s ease;
}

.btn-all-tools:hover {
  transform: translateY(-1px);
}

/* ===== Main ===== */
.app-main {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2vh, 24px) 20px;
}

.content-wrap {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Hero: sphere + waves + logo */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0;
}

.sphere-block {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sphere {
  width: clamp(140px, 20vh, 220px);
  height: auto;
  object-fit: contain;
  animation: float 4s ease-in-out infinite;
}

.wave {
  position: absolute;
  width: 150px;
  height: auto;
  opacity: 0.85;
  pointer-events: none;
}

.wave-left {
  left: -70px;
  top: 10px;
}

.wave-right {
  right: -70px;
  bottom: 10px;
}

.hero-logo {
  width: clamp(120px, 14vh, 150px);
  height: auto;
  object-fit: contain;
  margin-top: -14px;
}

@keyframes float {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-12px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.explore-heading {
  margin: clamp(10px, 2.2vh, 22px) 0 clamp(10px, 2vh, 18px);
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
}

/* ===== Cards grid ===== */
.cards-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 1.8vh, 18px) 22px;
}

.tool-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: clamp(11px, 1.8vh, 16px) 18px;
  background: rgba(41, 41, 48, 0.19);
  border: 1px solid rgba(82, 80, 234, 0.9);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* top highlight line */
.tool-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    transparent
  );
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: rgba(120, 140, 255, 1);
  box-shadow: 0 12px 24px rgba(72, 185, 237, 0.25);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* placeholder look when icon src is empty — hide the broken-image glyph,
   show a neat dashed box on the wrapper. Replace img src to use real icon. */
.card-icon:has(img[src=""]),
.card-icon:has(img:not([src])) {
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 8px;
}

.card-icon img[src=""],
.card-icon img:not([src]) {
  visibility: hidden;
}

.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
}

.card-desc {
  margin: clamp(6px, 1.2vh, 12px) 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.65);
}

/* ===== Footer T&C ===== */
.app-footer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  width: 100%;
  padding: 12px 16px;
  background: #02143a;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  text-align: center;
}

.app-footer p {
  margin: 0;
  font-size: 12px;
  color: #ffffff;
}

.app-footer a {
  color: #ffffff;
  text-decoration: underline;
}

.app-footer a:hover {
  color: #cbd5e1;
}

.app-footer .shield {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 4px;
  color: #ffffff;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* On small screens or short viewports the content can't fit in one screen —
   allow scrolling there instead of clipping it. */
@media (max-width: 640px), (max-height: 560px) {
  .sage-body {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .app-main {
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 12px 14px;
  }

  .header-right {
    gap: 10px;
  }

  .btn-claim,
  .btn-all-tools {
    font-size: 14px;
    padding: 9px 16px;
  }

  .app-main {
    padding: 28px 16px 32px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .sphere {
    width: 180px;
  }

  .hero-logo {
    width: 130px;
  }

  .wave {
    width: 100px;
  }

  .wave-left {
    left: -40px;
  }

  .wave-right {
    right: -40px;
  }
}
