:root {
  color-scheme: dark;
  --bg: #141418;
  --panel: #1d1d23;
  --border: #2c2c34;
  --text: #eaeaf0;
  --muted: #9797a3;
  --accent: #4f8cff;
  --accent-hover: #6c9fff;
  --danger: #e5484d;
  --online: #38c172;
  --offline: #6b6b76;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.screen {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.screen.hidden {
  display: none;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 14px;
  border-bottom: 1px solid var(--border);
}

.bar h1 {
  font-size: 17px;
  margin: 0;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--offline);
}

.status-dot.online {
  background: var(--online);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.content.centered {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  text-align: center;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 6px;
}

input[type="text"] {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #101014;
  color: var(--text);
  font-size: 16px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 15px;
  cursor: pointer;
}

.btn.block {
  display: block;
  width: 100%;
  margin-top: 12px;
}

.btn.large {
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
}

.btn.primary {
  background: var(--accent);
  color: white;
}

.btn.primary:hover {
  background: var(--accent-hover);
}

.btn.secondary {
  background: #2a2a32;
  color: var(--text);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn.link {
  background: none;
  color: var(--muted);
  text-decoration: underline;
  margin-top: 20px;
}

.row {
  display: flex;
  gap: 10px;
}

.row .btn {
  flex: 1;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0;
}

.hint.error {
  color: var(--danger);
}

.hint a {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.camera-wrap {
  display: none;
  margin-top: 16px;
  border-radius: 12px;
  overflow: hidden;
  background: black;
  aspect-ratio: 3 / 4;
}

.camera-wrap.active {
  display: block;
}

.camera-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  color: var(--text);
  margin: 18px 0;
}

.switch-row input {
  width: 20px;
  height: 20px;
}

#preview-image {
  max-width: 100%;
  max-height: 55vh;
  border-radius: 10px;
  object-fit: contain;
  background: #000;
}

.progress-track {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  margin: 16px 0 6px;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.15s ease;
}

.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: #26262e;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 10;
}
