/* Reset some default styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  /* Dynamic viewport for mobile */
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--sky-gradient, linear-gradient(to bottom, #87ceeb, #f0f8ff));
  transition: background 1s linear;
  color: #333;
  overflow-x: hidden;
}

h1 {
  font-size: clamp(1.8em, 7vw, 3em);
  /* Responsive font size */
  margin-bottom: clamp(20px, 4vh, 30px);
  text-align: center;
  width: 100%;
  word-wrap: break-word;
}

.links {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vh, 15px);
  width: 100%;
  max-width: min(90vw, 450px);
}

.links a {
  text-decoration: none;
  color: white;
  background-color: #4caf50;
  padding: clamp(14px, 3vh, 18px) 20px;
  border-radius: 8px;
  transition: background-color 0.3s ease, transform 0.2s ease;
  text-align: center;
  font-weight: bold;
  font-size: clamp(14px, 3.5vw, 16px);
  min-height: 48px;
  /* Better touch target for all devices */
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.links a:active {
  background-color: #45a049;
  transform: scale(0.98);
}

/* Hover only for devices that support it (desktop) */
@media (hover: hover) {
  .links a:hover {
    background-color: #45a049;
    transform: scale(1.05);
  }
}

#status {
  margin-top: clamp(20px, 4vh, 25px);
  font-size: clamp(0.85em, 3vw, 1em);
  color: #555;
  text-align: center;
  line-height: 1.6;
  width: 100%;
  max-width: 90vw;
}

/* Small phones (< 360px) */
@media (max-width: 359px) {
  body {
    padding: 15px 10px;
  }

  h1 {
    font-size: 1.5em;
  }

  .links a {
    padding: 12px 15px;
    font-size: 14px;
  }
}

/* Medium phones (360px - 414px) */
@media (min-width: 360px) and (max-width: 414px) {
  .links {
    max-width: 340px;
  }
}

/* Large phones & small tablets (415px - 767px) */
@media (min-width: 415px) and (max-width: 767px) {
  .links {
    max-width: 400px;
  }
}

/* Tablets (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  h1 {
    font-size: 2.5em;
  }

  .links {
    max-width: 500px;
  }

  .links a {
    font-size: 18px;
  }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
  body {
    padding: 10px 20px;
  }

  h1 {
    font-size: 1.5em;
    margin-bottom: 15px;
  }

  .links {
    gap: 10px;
  }

  .links a {
    padding: 10px 15px;
    min-height: 42px;
  }

  #status {
    margin-top: 15px;
    font-size: 0.85em;
  }
}

/* iPhone notch support */
@supports (padding-top: env(safe-area-inset-top)) {
  body {
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}
