* {
  box-sizing: border-box;
}

:root {
  --bg: #050b12;
  --panel: rgba(8, 19, 31, .76);
  --panel-strong: rgba(8, 19, 31, .92);
  --border: rgba(116, 180, 212, .20);
  --accent: #00c1e6;
  --accent-soft: rgba(0, 193, 230, .14);
  --text: #f5f8fb;
  --muted: #9db1c0;
  --danger: #ff6472;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  font-family: Inter, Arial, Helvetica, sans-serif;
  overscroll-behavior: none;
}

body {
  touch-action: none;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(0,193,230,.08), transparent 34%),
    #000;
  touch-action: none;
}

#remoteVideo {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#topHud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(7,17,28,.90), rgba(7,17,28,.68));
  box-shadow: 0 18px 55px rgba(0,0,0,.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand img {
  width: 112px;
  height: auto;
  display: block;
}

.brandDivider {
  width: 1px;
  height: 23px;
  margin: 0 12px;
  background: rgba(255,255,255,.15);
}

.brandName {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  white-space: nowrap;
}

.brandName b {
  color: var(--accent);
}

.hudMeta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(245,248,251,.82);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.metaDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1fcb7a;
  box-shadow: 0 0 0 5px rgba(31,203,122,.10);
}

.metaDivider {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,.13);
}

#overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(0,193,230,.10), transparent 31%),
    var(--bg);
  color: var(--text);
}

#overlay.connected {
  display: none;
}

.overlayLogo {
  width: min(210px, 42vw);
  height: auto;
  margin-bottom: 26px;
}

.overlayTitle {
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

#status {
  font-size: clamp(21px, 3.6vw, 38px);
  font-weight: 750;
  letter-spacing: -.02em;
}

#detail {
  margin-top: 9px;
  color: var(--muted);
  font-size: clamp(12px, 1.7vw, 16px);
}

#controlBadge {
  position: absolute;
  left: 16px;
  top: 82px;
  z-index: 30;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: rgba(255,255,255,.76);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  pointer-events: none;
}

#controlBadge.ready {
  border-color: rgba(0,193,230,.45);
  background: rgba(6,38,49,.80);
  color: #68e6ff;
}

#controlBadge.blocked {
  border-color: rgba(255,100,114,.48);
  color: #ff9ba4;
}

#controlBar {
  position: absolute;
  left: 16px;
  bottom: 42px;
  z-index: 35;
  display: flex;
  gap: 9px;
}

#controlBar button,
#statsButton {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 700;
  font-size: 22px;
  box-shadow: 0 10px 28px rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  touch-action: manipulation;
}

#controlBar button:active,
#statsButton:active {
  transform: scale(.96);
  border-color: rgba(0,193,230,.55);
  background: rgba(0,193,230,.14);
}

#statsButton {
  position: absolute;
  right: 16px;
  bottom: 42px;
  z-index: 35;
  font-size: 16px;
}

#stats {
  position: absolute;
  right: 16px;
  top: 82px;
  z-index: 32;
  min-width: 235px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 12px;
  box-shadow: 0 18px 45px rgba(0,0,0,.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
}

#stats.hidden {
  display: none;
}

.statsHeader {
  margin-bottom: 9px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

#stats > div:not(.statsHeader) {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 0;
}

#stats span {
  color: var(--muted);
}

#stats b {
  font-weight: 700;
}

#bottomBrand {
  position: absolute;
  left: 50%;
  bottom: 13px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  color: rgba(255,255,255,.46);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  pointer-events: none;
}

.footerDot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

@media (max-width: 650px) {
  #topHud {
    top: 8px;
    left: 8px;
    right: 8px;
    min-height: 48px;
    border-radius: 15px;
  }

  .brand img {
    width: 88px;
  }

  .brandDivider {
    margin: 0 9px;
  }

  .brandName {
    font-size: 10px;
  }

  .hudMeta {
    font-size: 9px;
  }

  #controlBadge,
  #stats {
    top: 65px;
  }
}


#orientationControl {
  position: absolute;
  left: 16px;
  top: 126px;
  z-index: 34;
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--panel-strong);
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.orientationBtn {
  min-width: 72px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  cursor: pointer;
  touch-action: manipulation;
}

.orientationBtn.active {
  background: var(--accent-soft);
  color: #68e6ff;
  box-shadow: inset 0 0 0 1px rgba(0,193,230,.32);
}

.orientationBtn:active {
  transform: scale(.97);
}

@media (max-width: 650px) {
  #orientationControl {
    left: 8px;
    top: 105px;
  }

  .orientationBtn {
    min-width: 62px;
    height: 32px;
    padding: 0 9px;
    font-size: 9px;
  }
}
