/* style.css - mobile-first light theme for Sky9 TV. System fonts only. */

:root {
  --bg: #f3f8fc;
  --surface: #ffffff;
  --surface-alt: #e9f2fa;
  --line: #e1ebf5;
  --text: #0a192f;
  --muted: #4b627e;
  --live: #e5322d;
  --warn: #d97706;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-gradient: linear-gradient(135deg, #0284c7 0%, #004b93 100%);
  --accent-deep: #003d7a;
  --whatsapp: #25d366;
  --whatsapp-hover: #20ba5a;
  --focus: #0284c7;
  --shadow-sm: 0 2px 8px rgba(10, 25, 47, 0.05);
  --shadow-md: 0 8px 24px rgba(10, 25, 47, 0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --gutter: 16px;
  --maxw: 960px;
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[hidden] {
  display: none !important;
}

/* ---- layout ------------------------------------------------------------ */

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.site-name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.header-live {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--live);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-live::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.site-header .round-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--line);
}

.site-header .round-btn:hover {
  background: #deecf8;
  color: var(--primary);
}

main {
  flex: 1 0 auto;
  padding-top: 16px;
  padding-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  margin: 0 0 6px;
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--text);
}

.card-desc {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---- hero card --------------------------------------------------------- */

.hero-card {
  text-align: left;
  background: linear-gradient(135deg, #ffffff 0%, #eef7ff 60%, #dff0ff 100%);
  border-color: #d6e9fa;
}

.hero-title {
  margin: 0 0 6px;
  font-size: clamp(1.25rem, 4.5vw, 1.625rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  overflow-wrap: anywhere;
}

.hero-status {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* ---- install card & ios guide ------------------------------------------ */

.install-card {
  text-align: center;
}

.install-note {
  margin: 10px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.ios-guide {
  background: #eef6fc;
  border-color: #cbe3f7;
}

.ios-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.close-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.close-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.ios-steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  font-size: 0.9375rem;
}

.ios-steps li {
  line-height: 1.4;
}

.ios-share-icon {
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
  color: var(--primary);
}

/* ---- buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-icon {
  flex: none;
}

.btn-watch,
.btn-install {
  width: 100%;
  min-height: 56px;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 1.0625rem;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.btn-watch:hover,
.btn-install:hover {
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45);
}

/* Not live: the button still works (it shows the player) but does not shout. */
.btn-watch[data-live="false"] {
  background: var(--surface-alt);
  color: var(--accent-deep);
  box-shadow: none;
}

.btn-secondary {
  width: 100%;
  background: var(--surface-alt);
  color: var(--accent-deep);
  border: 1px solid #cbe0f4;
}

.btn-secondary:hover {
  background: #deecf8;
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.28);
}

.btn-whatsapp:hover {
  background: var(--whatsapp-hover);
  color: #fff;
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-outline:hover {
  background: var(--surface-alt);
  border-color: #cbe0f4;
}

/* ---- share section ----------------------------------------------------- */

.share-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.share-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 440px) {
  .share-row {
    grid-template-columns: 1fr;
  }
}

/* ---- player ------------------------------------------------------------ */

/* 16:9 box. Full width of content column up to max 960px. Black inside with soft shadow. */
.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #000;
  box-shadow: var(--shadow-md);
  max-width: max(280px, calc((100vh - 120px) * 16 / 9));
  max-width: max(280px, calc((100dvh - 120px) * 16 / 9));
}

@supports not (aspect-ratio: 16 / 9) {
  .player::before {
    content: "";
    display: block;
    padding-top: 56.25%;
  }
}

.player > * {
  position: absolute;
}

.video {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* The picture is only shown while a stream is live. */
.player:not([data-state="live"]) .video {
  visibility: hidden;
}

.overlay {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: #070d18;
  color: #fff;
}

.msg {
  margin: 0;
  font-size: clamp(1.125rem, 4.4vw, 1.75rem);
  font-weight: 700;
  color: #fff;
  overflow-wrap: anywhere;
}

.sub {
  margin: 0;
  color: #94a3b8;
  font-size: clamp(0.9375rem, 3.4vw, 1.125rem);
  overflow-wrap: anywhere;
}

.hint {
  margin: 6px 0 0;
  color: #fbbf24;
  font-size: 0.9375rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: #38bdf8;
  animation: spin 0.9s linear infinite;
}

.spinner.small {
  width: 20px;
  height: 20px;
  border-width: 3px;
}

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

.reconnect {
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.74);
  color: #fff;
  font-weight: 600;
}

/* Big play button: the stream is ready and the browser waits for a tap (that tap turns the sound on too). */
.play-btn {
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  padding: 0 0 0 6px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.play-btn:active {
  transform: translate(-50%, -50%) scale(0.96);
}

/* ---- controls ------------------------------------------------------------ */

.controls {
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 28px 8px 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.player.show-controls .controls {
  opacity: 1;
  pointer-events: auto;
}

/* Outside a live stream only the fullscreen button is useful, and only while fullscreen. */
.player:not([data-state="live"]) .live-btn,
.player:not([data-state="live"]) #mute-btn {
  display: none;
}

.player:not([data-state="live"]):not(.is-fs) .controls {
  display: none;
}

.grow {
  flex: 1;
}

.icon-btn,
.live-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.controls .icon-btn,
.controls .live-btn {
  color: #fff;
}

.controls .icon-btn:hover,
.controls .live-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.live-btn {
  padding: 0 12px;
  font-size: 0.9375rem;
  letter-spacing: 0.06em;
}

.live-btn .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live);
}

/* Dimmed = already at the live edge, nothing to jump to. */
.live-btn.is-dim {
  opacity: 0.45;
  cursor: default;
}

.live-btn.is-dim:hover {
  background: transparent;
}

.ico {
  display: block;
}

#mute-btn .ico-muted,
#fs-btn .ico-exit {
  display: none;
}

#mute-btn[data-muted="true"] .ico-sound {
  display: none;
}

#mute-btn[data-muted="true"] .ico-muted {
  display: block;
}

.player.is-fs #fs-btn .ico-enter {
  display: none;
}

.player.is-fs #fs-btn .ico-exit {
  display: block;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---- fullscreen (the browser makes .player fill the screen) -------------- */

.player:fullscreen {
  border-radius: 0;
  box-shadow: none;
  max-width: none;
  aspect-ratio: auto;
}

.player:fullscreen::before {
  display: none;
}

.player:-webkit-full-screen {
  border-radius: 0;
  box-shadow: none;
  max-width: none;
  aspect-ratio: auto;
}

.player:-webkit-full-screen::before {
  display: none;
}

/* ---- stream title ---------------------------------------------------------- */

.now {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  margin-top: 14px;
}

.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--live);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.title {
  margin: 0;
  min-width: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

.notice {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

/* ---- toast ----------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 10px 22px;
  border-radius: 999px;
  background: #0a192f;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(10, 25, 47, 0.25);
  pointer-events: none;
  max-width: calc(100vw - 32px);
  text-align: center;
  overflow-wrap: anywhere;
}

/* ---- footer ---------------------------------------------------------------- */

.site-footer {
  margin-top: auto;
  padding-top: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.tagline {
  margin: 0 0 4px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.footer-copy {
  margin: 0;
  font-size: 0.8125rem;
  color: #64748b;
  font-weight: 600;
}

.noscript {
  padding-top: 8px;
  padding-bottom: 8px;
  color: var(--warn);
}

/* ---- small screens and motion ----------------------------------------------- */

@media (max-height: 480px) and (orientation: landscape) {
  .header-row {
    min-height: 44px;
  }

  main {
    padding-top: 8px;
  }
}

@media (min-width: 720px) {
  main {
    padding-top: 24px;
  }

  .site-name {
    font-size: 1.375rem;
  }

  .title {
    font-size: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .spinner {
    animation: none;
    border-top-color: rgba(255, 255, 255, 0.18);
    border-right-color: #38bdf8;
  }

  .controls {
    transition: none;
  }
}
