* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: block;
  touch-action: none;
  z-index: 1;
}

#overlay,
#codegate {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  background: #000;
  z-index: 2;
  padding: 24px;
}

#overlay.hidden,
#codegate.hidden {
  display: none;
  pointer-events: none;
}

.label {
  font-size: 1.4rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  opacity: 0.55;
}

#status,
#codemsg {
  font-size: 1.6rem;
  opacity: 0.75;
  text-align: center;
  padding: 0 1.5rem;
}

#codeinput {
  width: min(92vw, 420px);
  min-height: 88px;
  font-size: 48px;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #111;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

#codeconnect {
  width: min(92vw, 420px);
  min-height: 72px;
  font-size: 28px;
  border-radius: 12px;
  border: 0;
  background: #e82127;
  color: #fff;
}

#stats,
#gdiag {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 5;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.55);
  padding: 8px 12px;
  border-radius: 6px;
  pointer-events: auto;
  touch-action: manipulation;
}

#gdiag {
  top: 48px;
  pointer-events: none;
}

#stats[hidden],
#gdiag[hidden] {
  display: none;
}

#fs {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  cursor: pointer;
}

#fs:active {
  background: rgba(255, 255, 255, 0.28);
}

/* svislý sloupec ovládání u levého okraje; tlačítko menu vlevo dole */
:root {
  --btn-h: min(64px, calc((100vh - 24px) / 10 - 6px));
}

#controls {
  position: fixed;
  left: 0;
  top: 0;
  bottom: calc(var(--btn-h) + 18px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  padding: 6px;
  width: 84px;
  pointer-events: none;
}

#controls.collapsed {
  display: none;
}

#controls button,
#menu {
  pointer-events: auto;
  width: 72px;
  height: var(--btn-h);
  min-height: 34px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  padding: 2px 4px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  opacity: 0.9;
  flex: 0 0 auto;
}

#controls button svg,
#menu svg {
  width: min(28px, calc(var(--btn-h) - 10px));
  height: min(28px, calc(var(--btn-h) - 10px));
}

#controls button span {
  font-size: 10px;
  opacity: 0.75;
}

#controls button:active,
#menu:active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.28);
}

#menu {
  position: fixed;
  left: 6px;
  bottom: 12px;
  z-index: 4;
}

#menu[hidden],
#controls[hidden] {
  display: none;
}

#stats,
#gdiag {
  left: 96px;
}

@media (max-height: 420px) {
  #controls button span {
    display: none;
  }
}

#menu .ico-expand,
#menu.collapsed .ico-collapse {
  display: none;
}

#menu.collapsed .ico-expand {
  display: block;
}

#bottomBar {
  position: fixed;
  left: 84px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

#disc,
#addPhoneBtn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--btn-h);
  min-height: 34px;
  padding: 2px 14px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  font-size: 14px;
  opacity: 0.9;
}

#disc:active,
#addPhoneBtn:active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.28);
}

#disc[hidden],
#addPhoneBtn[hidden] {
  display: none;
}

.enroll-page {
  overflow: auto;
}

.enroll-box {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 24px;
  text-align: center;
}

#enrollMsg,
#enrollTtl,
#addPhoneMsg {
  font-size: 1.3rem;
  opacity: 0.85;
}

#enrollQr,
#addPhoneQr {
  width: min(80vw, 60vh, 360px);
  height: min(80vw, 60vh, 360px);
  background: #fff;
  border-radius: 8px;
}

#addPhone {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 24px;
  text-align: center;
}

#addPhone[hidden] {
  display: none;
}

#addPhoneClose {
  min-width: 160px;
  min-height: 56px;
  font-size: 20px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.enroll-code {
  font-family: ui-monospace, monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
