/* ═══════════════════════════════════════
   LEVEL DETAIL — page-specific styles
   Base theme (palette, fonts, navbar, footer, .page-content) comes from
   css/styles.css, loaded before this file. Only the level-detail layout,
   its buttons, and its status/toast states are defined here.
═══════════════════════════════════════ */

:root {
  /* styles.css sets color-scheme: light globally; this page is dark-themed
     (navy/coral/yellow on blue), so scrollbars/native controls should match. */
  color-scheme: dark;

  --level-blue: #2f8ff0;
  --level-blue-dark: #1f6fd0;
  --level-gray: #6b6b7a;
  --level-gray-dark: #55555f;
  --level-orange: #ff9d4d;
  --level-orange-dark: #f2872f;
  --level-purple: #6a4fa0;
  --level-purple-dark: #59417c;
}

/* Same nav-wrapping issue UGClevels.css documents: this page's navbar has
   10 items too (identical list), so it needs the same earlier hamburger
   breakpoint as the levels feed rather than styles.css's default 768px. */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .mobile-toggle { display: block; }
  .navbar-inner { justify-content: space-between; }
}

/* ═══════════════════════════════════════
   LAYOUT
═══════════════════════════════════════ */
.level-detail-layout {
  position: relative;
  max-width: 1024px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.level-back {
  position: absolute;
  top: 24px;
  left: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--white);
  transition: background 0.2s, transform 0.2s;
  z-index: 2;
}

.level-back:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(-2px);
}

.level-back svg {
  width: 26px;
  height: 26px;
}

.level-detail-title {
  font-family: 'Luckiest Guy', cursive;
  font-size: clamp(1.2rem, 2.6vw, 1.9rem);
  color: var(--white);
  text-align: center;
  margin: 0 0 32px;
  padding: 0 60px;
  /* stroke/shadow treatment comes free from styles.css's [class*="title"] rule */
}

.level-detail-content {
  display: grid;
  grid-template-columns: minmax(0, 380px) 1fr;
  gap: 40px;
  align-items: start;
  justify-content: center;
}

/* .level-status/.level-detail-content each set their own `display`, which
   overrides the browser's default `[hidden] { display: none }` rule — an
   author stylesheet's normal declarations always beat the user-agent
   stylesheet's, regardless of selector specificity. The `hidden` attribute
   alone can't hide either element here; toggle this class instead (two
   classes = higher specificity than the single-class display rules above,
   so this reliably wins). */
.level-status.is-hidden,
.level-detail-content.is-hidden {
  display: none;
}

/* ═══════════════════════════════════════
   PREVIEW + STATS COLUMN
═══════════════════════════════════════ */
.level-preview-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.level-preview-frame {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 10px;
  border: 4px solid var(--white);
  background-color: var(--navy);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.level-stats {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.level-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  font-weight: 700;
  font-size: 1.35rem;
}

.level-stat svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.level-platform {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 0.92rem;
}

/* ═══════════════════════════════════════
   ACTIONS COLUMN
═══════════════════════════════════════ */
.level-actions-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding-top: 8px;
}

.level-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 200px;
  padding: 16px 40px;
  border: none;
  border-radius: 999px;
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  color: var(--white);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.level-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}

.level-btn svg {
  width: 18px;
  height: 18px;
}

.level-btn-play {
  background: var(--level-blue);
}

.level-btn-play:hover {
  background: var(--level-blue-dark);
}

.level-btn-copy {
  background: var(--level-gray);
  font-family: 'Fira Sans Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.level-btn-copy:hover {
  background: var(--level-gray-dark);
}

.level-btn-copy.copied {
  background: #3aa76d;
}

.level-btn-share {
  background: var(--level-orange);
}

.level-btn-share:hover {
  background: var(--level-orange-dark);
}

/* ═══════════════════════════════════════
   SHARE PANEL
═══════════════════════════════════════ */
.level-share-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 620px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  transition: max-height 0.3s ease, opacity 0.25s ease, transform 0.25s ease, margin-top 0.3s ease;
}

.level-share-panel.open {
  max-height: 240px;
  opacity: 1;
  transform: translateY(0);
}

.level-share-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--level-purple);
  color: var(--white);
  font-family: 'Fira Sans Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, transform 0.2s;
}

.level-share-pill:hover {
  background: var(--level-purple-dark);
  transform: translateY(-2px);
}

.level-share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--level-purple);
  font-size: 10px;
  line-height: 1;
}

/* ═══════════════════════════════════════
   STATUS STATES (loading / not found / error)
═══════════════════════════════════════ */
.level-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 24px;
  color: var(--white);
  text-align: center;
  font-family: 'Fira Sans Condensed', sans-serif;
  font-weight: 600;
}

.level-status p {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: level-spin 0.8s linear infinite;
}

@keyframes level-spin {
  to { transform: rotate(360deg); }
}

.retry-button {
  padding: 12px 32px;
  font-family: 'Luckiest Guy', cursive;
  font-size: 12px;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 30px;
  background: var(--coral);
  color: var(--white);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.retry-button:hover {
  background: var(--coral-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════
   TOAST (copy-to-clipboard / share feedback)
═══════════════════════════════════════ */
.level-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  background: rgba(20, 29, 66, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--white);
  font-family: 'Fira Sans Condensed', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 300;
}

.level-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 720px) {
  .level-detail-content {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 28px;
  }

  .level-preview-col {
    width: 100%;
    max-width: 380px;
  }
}

@media (max-width: 480px) {
  .level-detail-layout {
    padding: 16px 14px 40px;
  }

  .level-btn {
    min-width: 0;
    width: 100%;
    padding: 14px 24px;
  }

  .level-actions-col {
    width: 100%;
  }

  .level-share-panel {
    grid-template-columns: repeat(2, 1fr);
    max-width: 100%;
  }

  .level-share-panel.open {
    max-height: 320px;
  }
}
