:root {
  --bg-top: #05070f;
  --bg-bottom: #0b1220;
  --card: #111a2e;
  --card-border: #213152;
  --text-main: #f3f6ff;
  --text-soft: #b7c2dd;
  --accent: #6ad2ff;
  --accent-strong: #35b9f3;
  --error: #ff7f8f;
  --success: #81f2c1;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Lucida Sans Unicode", "Segoe UI", sans-serif;
  color: var(--text-main);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  display: grid;
  place-items: center;
  padding: 20px;
}

.stars {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 10% 20%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(2px 2px at 40% 10%, rgba(255, 255, 255, 0.25), transparent),
    radial-gradient(1px 1px at 60% 30%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 80% 40%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(2px 2px at 30% 70%, rgba(255, 255, 255, 0.25), transparent),
    radial-gradient(1px 1px at 70% 80%, rgba(255, 255, 255, 0.3), transparent);
  pointer-events: none;
}

.page-header {
  text-align: center;
  margin-bottom: 16px;
  z-index: 1;
}

.page-header h1 {
  margin: 0;
  letter-spacing: 0.06em;
  font-size: clamp(1.8rem, 4vw, 2.3rem);
}

.page-header p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.96rem;
}

main {
  width: min(900px, 100%);
  z-index: 1;
}

.app-card {
  background: linear-gradient(180deg, rgba(17, 26, 46, 0.98), rgba(14, 23, 40, 0.98));
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 30px);
}

.search-section label {
  display: block;
  font-weight: 500;
  margin-bottom: 10px;
}

.controls {
  display: flex;
  gap: 12px;
}

input[type="date"] {
  flex: 1;
  min-width: 0;
  border: 1px solid #2c3f67;
  border-radius: 12px;
  padding: 12px 14px;
  background: #0d1529;
  color: var(--text-main);
  font: inherit;
}

input[type="date"]:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #03111c;
  font-weight: 700;
  padding: 0 20px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.status {
  margin: 16px 0;
  border: 1px solid transparent;
  padding: 12px 14px;
  border-radius: 10px;
  min-height: 46px;
  display: flex;
  align-items: center;
}

.status-idle,
.status-loading {
  color: var(--text-soft);
  background: rgba(116, 151, 219, 0.08);
  border-color: rgba(116, 151, 219, 0.35);
}

.status-error {
  color: #ffd6dd;
  background: rgba(255, 95, 120, 0.12);
  border-color: rgba(255, 95, 120, 0.35);
}

.status-success {
  color: #d8fff1;
  background: rgba(80, 202, 149, 0.12);
  border-color: rgba(80, 202, 149, 0.35);
}

.result {
  min-height: 460px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
}

.media-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #090f1d;
  border: 1px solid #2b4068;
  border-radius: 14px;
  overflow: hidden;
}

.media-frame img,
.media-frame iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}

.media-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  text-align: center;
  padding: 12px;
}

.meta-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

#apodTitle {
  margin: 0;
  font-size: clamp(1.15rem, 2.3vw, 1.45rem);
}

#apodDate,
#apodCopyright {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.video-tag {
  font-size: 0.8rem;
  border: 1px solid #88d7ff;
  border-radius: 999px;
  color: #bfe9ff;
  padding: 4px 9px;
  white-space: nowrap;
}

.description {
  margin: 0;
  line-height: 1.7;
  color: #d7e1f8;
}

.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 700px) {
  body {
    padding: 14px;
  }

  .controls {
    flex-direction: column;
  }

  button {
    height: 46px;
  }

  .result {
    min-height: 390px;
  }

  .meta-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
