:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #020409;
  overflow: hidden;
}

#container {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.target-guide {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.target-guide img {
  width: min(72vw, 420px);
  max-height: 60vh;
  object-fit: contain;
  opacity: 0.5;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.35));
}

.target-guide p {
  margin: 0;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #d8e3ff;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.target-guide.hidden {
  display: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1.5rem;
  pointer-events: none;
  z-index: 100;
}

.panel {
  width: min(420px, 90vw);
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  background:
    linear-gradient(160deg, rgba(8, 18, 34, 0.7), rgba(7, 14, 28, 0.74)),
    url('./assets/African%20Continent%20shaped%20Motherboard.jpeg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  color: #f8fafb;
  text-align: center;
  pointer-events: auto;
  position: relative;
  isolation: isolate;
}

.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 25% 10%, rgba(36, 189, 255, 0.18), transparent 45%),
    linear-gradient(180deg, rgba(8, 14, 24, 0.06), rgba(8, 14, 24, 0.28));
  z-index: 0;
  pointer-events: none;
}

.panel > * {
  position: relative;
  z-index: 1;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  line-height: 1.3;
}

p {
  margin: 0 0 0.75rem;
  line-height: 1.4;
  font-size: 0.95rem;
}

.rotate-phone-prompt {
  margin: 0 0 0.8rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(11, 20, 36, 0.55);
  border: 1px solid rgba(164, 215, 255, 0.28);
  color: #d8eeff;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.rotate-icon {
  width: 1.4rem;
  height: 1.4rem;
  object-fit: contain;
  filter: invert(1) sepia(1) saturate(3) hue-rotate(185deg) brightness(1.3);
  flex-shrink: 0;
  animation: spin-hint 2.5s ease-in-out infinite;
}

@keyframes spin-hint {
  0%   { transform: rotate(0deg); }
  40%  { transform: rotate(-30deg); }
  60%  { transform: rotate(30deg); }
  100% { transform: rotate(0deg); }
}

button {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1rem;
  margin: 0.4rem 0;
  font-size: 0.95rem;
  cursor: pointer;
  color: #ffffff;
  background: linear-gradient(135deg, #556eff, #18c9ff);
  transition: transform 120ms ease, opacity 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.hidden {
  display: none;
}

.error {
  color: #f87171;
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

.debug-log {
  display: none;
}

@media (max-width: 640px) {
  .target-guide img {
    width: min(82vw, 360px);
    max-height: 52vh;
  }

  .target-guide p {
    font-size: 0.72rem;
  }

  .overlay {
    padding: 0.75rem;
    align-items: flex-end;
  }

  .panel {
    padding: 1rem;
    border-radius: 16px;
    width: 95vw;
    max-width: 95vw;
  }

  h1 {
    font-size: 1.1rem;
    margin: 0 0 0.4rem;
  }

  p {
    font-size: 0.9rem;
    margin: 0 0 0.6rem;
  }

  .rotate-phone-prompt {
    font-size: 0.75rem;
    padding: 0.4rem 0.65rem;
    margin: 0 0 0.65rem;
  }

  button {
    padding: 0.8rem 0.8rem;
    font-size: 0.9rem;
    margin: 0.3rem 0;
  }

  .error {
    font-size: 0.85rem;
  }

  .debug-log {
    font-size: 0.7rem;
    padding: 0.7rem;
    max-height: 100px;
  }
}

@media (max-width: 380px) {
  .overlay {
    padding: 0.5rem;
  }

  .panel {
    padding: 0.8rem;
    border-radius: 12px;
    width: 100vw;
    max-width: 100vw;
  }

  h1 {
    font-size: 0.95rem;
    margin: 0 0 0.3rem;
  }

  p {
    font-size: 0.8rem;
    margin: 0 0 0.5rem;
  }

  .rotate-phone-prompt {
    font-size: 0.72rem;
    padding: 0.35rem 0.55rem;
  }

  button {
    padding: 0.7rem 0.7rem;
    font-size: 0.8rem;
    margin: 0.25rem 0;
  }

  .debug-log {
    font-size: 0.65rem;
    padding: 0.6rem;
    max-height: 80px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .overlay {
    padding: 0.5rem;
  }

  .panel {
    max-width: 90vw;
    padding: 0.75rem;
  }

  h1 {
    font-size: 0.95rem;
  }

  p {
    font-size: 0.8rem;
  }

  .rotate-phone-prompt {
    font-size: 0.72rem;
    margin: 0 0 0.55rem;
  }

  button {
    padding: 0.6rem 0.7rem;
    font-size: 0.85rem;
  }

  .debug-log {
    font-size: 0.65rem;
    padding: 0.5rem;
    max-height: 80px;
  }
}
