/* Nunito (SIL OFL 1.1, viz fonts/OFL-Nunito.txt), variabilní, subset latin + latin-ext */
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

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

html,
body {
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
  font-family: "Nunito", 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,
#devicesBtn {
  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,
#devicesBtn:active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.28);
}

#disc[hidden],
#addPhoneBtn[hidden],
#prefsBox[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;
}

#rememberRow {
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  opacity: 0.85;
}

#rememberChk {
  width: 28px;
  height: 28px;
}

#useCodeBtn {
  margin-top: 1.2rem;
  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;
  pointer-events: auto;
}

#useCodeBtn[hidden],
#toast[hidden],
#devicesBtn[hidden],
#chooser[hidden],
#devPanel[hidden] {
  display: none;
}

#toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 18px;
}

#chooser,
#devPanel {
  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;
  overflow: auto;
}

#chooserList {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

#chooserList button {
  min-width: 220px;
  min-height: 96px;
  font-size: 26px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.devrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 20px;
}

.devname {
  min-width: 260px;
}

.devrow button,
.prefrow button,
#addPhoneBtn,
#devForgetAll,
#devClose {
  min-height: 52px;
  padding: 0 18px;
  font-size: 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

button,
input {
  font-family: inherit;
}

.logo {
  width: min(112px, 18vh);
  height: min(112px, 18vh);
  border-radius: 22%;
}

#prefsBox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.prefrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.prefrow span {
  min-width: 110px;
}

.prefrow button.sel {
  background: rgba(80, 160, 255, 0.55);
  border-color: rgba(140, 200, 255, 0.9);
}
