:root {
  color-scheme: dark;
}

html,
body {
  position: relative;
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  box-sizing: border-box;
  color: #f5f7fb;
  background: #0b0d11;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

iframe {
  border-width: 0;
}

a {
  color: inherit;
  text-decoration: underline;
}

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
}

button:focus-visible,
.ui-picker__trigger:focus-visible,
.ui-picker__option:focus-visible,
.topbar-btn:focus-visible {
  outline: 2px solid #5eb0ff;
  outline-offset: 2px;
}

.loading-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: color-mix(in srgb, white 22%, transparent);
  z-index: 100;
}

.loading {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #5eb0ff, #8ec8ff);
  box-shadow:
    0 0 20px color-mix(in srgb, #5eb0ff 85%, transparent),
    0 0 6px #5eb0ff;
}

.loading-overlay[hidden] {
  display: none !important;
}

.loading-player {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: min(34rem, 86vw);
  padding: 1.5rem;
}

.loading-overlay {
  background-size: cover !important;
  background-position: center !important;
  background-color: #0b0d11;
  width: 100vw;
  height: 100vh;
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

/* Topbar buttons live outside the overlay layer. */
.topbar-btn.icon-btn {
  pointer-events: all;
}

.loading-label {
  margin: 0;
  color: #fff;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-shadow: 0 8px 28px color-mix(in srgb, black 45%, transparent);
}

.did-you-know {
  margin: 1rem 0 0;
  color: color-mix(in srgb, white 88%, transparent);
  font-size: 0.95rem;
  line-height: 1.55;
  font-weight: 400;
}

.did-you-know strong {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.support-text-style {
  margin: 0;
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  width: 100%;
  position: fixed;
  text-align: center;
  color: color-mix(in srgb, white 78%, transparent);
  font-size: 0.85rem;
}

.support-text-style strong {
  color: #fff;
}

.viewer-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  width: 100%;
  height: 100%;
  padding: 2rem;
  box-sizing: border-box;
  color: #f5f7fb;
  font-size: 1rem;
  text-align: center;
  background: #12151c;
}

.viewer-error__message {
  margin: 0;
  max-width: 28rem;
  line-height: 1.55;
}

.viewer-error__retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid color-mix(in srgb, white 14%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, #5eb0ff 20%, transparent);
  color: #f5f7fb;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease;
}

.viewer-error__retry:hover {
  background: color-mix(in srgb, #5eb0ff 32%, transparent);
}

.viewer-error__retry:focus-visible {
  outline: 2px solid #5eb0ff;
  outline-offset: 2px;
}
