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

:root {
  --bg: #07111c;
  --surface: #0d1726;
  --surface2: #132033;
  --border: #22344d;
  --blue: #7fb2ff;
  --blue-dim: #153252;
  --green: #4bd4a0;
  --green-dim: #12372f;
  --orange: #f3be6f;
  --red: #ff7171;
  --text: #edf4ff;
  --text-muted: #90a3c1;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', sans-serif;

  /* Liquid glass tokens */
  --lg-bg:        rgba(13, 23, 42, 0.45);
  --lg-border:    rgba(127, 178, 255, 0.18);
  --lg-shine:     rgba(255, 255, 255, 0.07);
  --lg-blur:      18px;
  --lg-radius:    18px;
  --lg-shadow:    0 8px 32px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.06) inset;
}

body {
  background:
    radial-gradient(ellipse at 15% 10%, rgba(127, 178, 255, 0.22) 0%, transparent 42%),
    radial-gradient(ellipse at 85% 5%,  rgba(75, 212, 160, 0.18) 0%, transparent 38%),
    radial-gradient(ellipse at 50% 90%, rgba(90, 80, 220, 0.14) 0%, transparent 50%),
    linear-gradient(180deg, #06101a 0%, #050c14 100%);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 40px;
  overflow-x: hidden;
}

/* ============ LIQUID GLASS SVG filter (hidden) ============ */
.lg-svg-filter {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ============ Animated background blobs ============ */
.lg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.lg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.28;
}
.lg-blob-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #3a7bd5 0%, #00d2ff 100%);
  top: -8%; left: -4%;
  animation: lg-drift-1 26s ease-in-out infinite alternate;
}
.lg-blob-2 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #4bd4a0 0%, #00b4d8 100%);
  bottom: -6%; right: -2%;
  animation: lg-drift-2 30s ease-in-out infinite alternate;
  animation-delay: -8s;
}
.lg-blob-3 {
  width: 340px; height: 340px;
  background: radial-gradient(circle, #6f4ef2 0%, #7fb2ff 100%);
  top: 42%; left: 55%;
  animation: lg-drift-3 22s ease-in-out infinite alternate;
  animation-delay: -4s;
}
@keyframes lg-drift-1 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(38vw, 22vh) scale(1.15); }
  66%  { transform: translate(12vw, 48vh) scale(0.9); }
  100% { transform: translate(30vw, 4vh) scale(1.05); }
}
@keyframes lg-drift-2 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-34vw, -28vh) scale(1.12); }
  66%  { transform: translate(-10vw, -52vh) scale(0.92); }
  100% { transform: translate(-26vw, -8vh) scale(1.08); }
}
@keyframes lg-drift-3 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-30vw, 24vh) scale(0.9); }
  66%  { transform: translate(-44vw, -16vh) scale(1.18); }
  100% { transform: translate(-8vw, 14vh) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .lg-blob { animation: none; }
}

.navbar {
  width: 100%;
  position: relative;
  z-index: 10;
  background: var(--lg-bg);
  border-bottom: 1px solid var(--lg-border);
  display: flex;
  align-items: center;
  padding: 12px 24px;
  margin-bottom: 24px;
  gap: 12px;
  backdrop-filter: url(#lg-distort) blur(var(--lg-blur));
  -webkit-backdrop-filter: blur(var(--lg-blur));
  box-shadow: 0 1px 0 var(--lg-shine) inset, 0 4px 24px rgba(0,0,0,0.35);
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.navbar-logo img {
  height: 28px;
  width: auto;
  display: block;
  border-radius: 4px;
}

.navbar-brand {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

.navbar-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--mono);
}

/* Живой индикатор статуса соединения: серый = ожидание, зелёный/пульс = активно */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-right: 6px;
  vertical-align: middle;
  position: relative;
  transition: background 0.3s;
}
.status-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  opacity: 0;
}
.status-dot.live {
  background: var(--green);
}
.status-dot.live::after {
  animation: status-ring 1.6s ease-out infinite;
}
@keyframes status-ring {
  0%   { opacity: 0.6; transform: scale(0.6); }
  100% { opacity: 0; transform: scale(1.8); }
}
@media (prefers-reduced-motion: reduce) {
  .status-dot.live::after { animation: none; }
}

/* ============ Language Switcher ============ */
.lang-switch {
  margin-left: auto;
  position: relative;
  flex-shrink: 0;
}

/* Globe trigger button */
.lang-globe-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 9px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap;
}
.lang-globe-btn:hover,
.lang-globe-btn[aria-expanded="true"] {
  border-color: var(--blue);
  color: var(--text);
  background: var(--blue-dim);
}
.lang-globe-btn .globe-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.lang-globe-btn .chevron-icon {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.lang-globe-btn[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

/* Desktop dropdown */
.lang-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  min-width: 168px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55), 0 1px 0 rgba(255,255,255,0.05) inset;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 200;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform-origin: top right;
}
.lang-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Mobile bottom sheet backdrop */
.lang-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 500;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.lang-sheet-backdrop.open {
  display: block;
  opacity: 1;
}

/* Mobile bottom sheet panel */
.lang-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 12px 16px 36px;
  z-index: 501;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6), 0 -1px 0 rgba(255,255,255,0.05) inset;
}
.lang-sheet.open {
  transform: translateY(0);
}
.lang-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 16px;
}
.lang-sheet-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--mono);
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding: 0 4px;
}
.lang-sheet-title svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.lang-sheet-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

/* Language option button — used in both dropdown and sheet */
.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
}
.lang-option:hover {
  background: rgba(127,178,255,0.07);
  color: var(--text);
  border-color: rgba(127,178,255,0.15);
}
.lang-option.active {
  background: rgba(127,178,255,0.13);
  color: var(--text);
  border-color: rgba(127,178,255,0.28);
}
.lang-option-name { font-weight: 500; }
.lang-option-code {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}
.lang-option.active .lang-option-code { color: var(--blue); }

.mode-switch {
  position: relative;
  z-index: 5;
  display: flex;
  background: var(--lg-bg);
  border: 1px solid var(--lg-border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin: 0 auto 24px;
  width: fit-content;
  backdrop-filter: url(#lg-distort) blur(var(--lg-blur));
  -webkit-backdrop-filter: blur(var(--lg-blur));
  box-shadow: var(--lg-shadow);
}

.mode-btn {
  padding: 8px 24px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
}
.mode-btn.active {
  background: rgba(127, 178, 255, 0.14);
  color: var(--text);
  border: 1px solid rgba(127, 178, 255, 0.28);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.07) inset;
}
.mode-btn:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.04); }

.card {
  position: relative;
  z-index: 5;
  width: calc(100% - 32px);
  max-width: 640px;
  background: var(--lg-bg);
  border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius);
  overflow: hidden;
  box-shadow: var(--lg-shadow);
  backdrop-filter: url(#lg-distort) blur(var(--lg-blur));
  -webkit-backdrop-filter: blur(var(--lg-blur));
  transition: box-shadow 0.3s, transform 0.3s;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--lg-radius);
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 55%, rgba(127,178,255,0.04) 100%);
  pointer-events: none;
  z-index: 1;
}
.card:hover {
  box-shadow: 0 16px 48px rgba(0,0,0,0.55), 0 1px 0 rgba(255,255,255,0.09) inset, 0 0 0 1px rgba(127,178,255,0.22);
  transform: translateY(-2px);
}

.card-header {
  position: relative;
  z-index: 2;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(127, 178, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, rgba(127,178,255,0.05) 0%, transparent 100%);
}

.card-header .icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.icon-send { background: var(--blue-dim); }
.icon-recv { background: var(--green-dim); }

.card-title { font-size: 14px; font-weight: 600; }
.card-desc { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.card-body { position: relative; z-index: 2; padding: 20px; }

.steps { display: flex; flex-direction: column; gap: 18px; }

.step {
  display: flex;
  gap: 12px;
  opacity: 0.35;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.step.active { opacity: 1; }
.step.done { opacity: 0.75; }
.step.just-activated {
  animation: step-enter 0.4s ease;
}
@keyframes step-enter {
  0%   { opacity: 0.35; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .step.just-activated { animation: none; }
}

.step-num {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid #4a5568;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #a0aec0;
  margin-top: 2px;
  transition: all 0.3s;
}
.step.active .step-num {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-dim);
}
.step.done .step-num {
  border-color: var(--green);
  background: var(--green-dim);
  color: var(--green);
}
.step.done .step-num::after { content: '✓'; }
.step.done .step-num-inner { display: none; }

.step-content { flex: 1; }
.step-label {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #a0aec0;
}
.step.active .step-label { color: var(--text); }

.eta-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.eta-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.eta-chip strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.file-drop {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.file-drop:hover, .file-drop.dragging {
  border-color: var(--blue);
  background: var(--blue-dim);
}
.file-drop .drop-icon { font-size: 24px; margin-bottom: 4px; }
.file-drop p { font-size: 12px; color: var(--text-muted); }
.file-drop strong { color: var(--text); }
.file-drop input { display: none; }

.file-info {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.file-info.visible { display: flex; }
.file-icon { font-size: 18px; }
.file-name { font-size: 12px; font-weight: 500; }
.file-size { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.file-remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.file-remove:hover { color: var(--red); background: rgba(248,81,73,0.1); }

.key-area {
  width: 100%;
  min-height: 80px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  resize: vertical;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.key-area:focus { outline: none; border-color: var(--blue); }
.key-area::placeholder { color: var(--text-muted); }
.key-area[readonly] { color: var(--green); cursor: text; }

/* Пульсация рамки, пока ждём, что собеседник вставит/отсканирует ключ сюда */
.key-area.waiting {
  animation: key-waiting 1.8s ease-in-out infinite;
}
@keyframes key-waiting {
  0%, 100% { border-color: var(--border); box-shadow: 0 0 0 0 rgba(127,178,255,0); }
  50%      { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(127,178,255,0.12); }
}
@media (prefers-reduced-motion: reduce) {
  .key-area.waiting { animation: none; }
}

.key-box { position: relative; }
.copy-btn {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-family: var(--sans);
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover { color: var(--text); border-color: var(--blue); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

.btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: inherit;
  pointer-events: none;
}
.btn:not(:disabled):hover::after { opacity: 1; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #5a9bff 0%, var(--blue) 100%); color: #06101a; box-shadow: 0 4px 16px rgba(127,178,255,0.35); }
.btn-primary:not(:disabled):hover { box-shadow: 0 6px 22px rgba(127,178,255,0.5); transform: translateY(-1px); }
.btn-green { background: linear-gradient(135deg, #3ecf8e 0%, var(--green) 100%); color: #06101a; box-shadow: 0 4px 16px rgba(75,212,160,0.35); }
.btn-green:not(:disabled):hover { box-shadow: 0 6px 22px rgba(75,212,160,0.5); transform: translateY(-1px); }

.status-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid;
}
.status-bar.visible { display: flex; }
.status-bar.info { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); }
.status-bar.success { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.status-bar.error { background: rgba(248,81,73,0.1); border-color: var(--red); color: var(--red); }
.status-bar.warning { background: rgba(227,179,65,0.1); border-color: var(--orange); color: var(--orange); }

.spinner {
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-wrap { display: none; }
.progress-wrap.visible { display: block; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s;
  position: relative;
  overflow: hidden;
}
/* Бегущий блик поверх залитой части — сигнал "процесс идёт" */
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.45) 50%, transparent 100%);
  width: 60px;
  animation: progress-shimmer 1.6s linear infinite;
}
@keyframes progress-shimmer {
  0%   { transform: translateX(-60px); }
  100% { transform: translateX(calc(100% + 60px)); }
}
/* Пульсирующее свечение на переднем крае заливки */
.progress-bar {
  position: relative;
}
.progress-bar::after {
  content: '';
  position: absolute;
  top: 50%;
  left: var(--progress-pct, 0%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 0 rgba(75,212,160,0.6);
  animation: progress-pulse 1.4s ease-out infinite;
  opacity: var(--progress-active, 0);
  transition: left 0.3s;
  pointer-events: none;
}
@keyframes progress-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(75,212,160,0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(75,212,160,0); }
  100% { box-shadow: 0 0 0 0 rgba(75,212,160,0); }
}
@media (prefers-reduced-motion: reduce) {
  .progress-fill::after,
  .progress-bar::after { animation: none; }
}

.panel { display: none; }
.panel.active { display: block; }

.hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.key-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.key-tab {
  padding: 4px 10px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.key-tab.active {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--blue);
}

.qr-panel { display: none; }
.qr-panel.visible { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.qr-wrap {
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
  border-radius: 12px;
  padding: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 320px);
  max-width: calc(100vw - 48px);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(127, 178, 255, 0.35),
    0 12px 30px rgba(0, 0, 0, 0.22),
    0 0 24px rgba(127, 178, 255, 0.22);
}
.qr-wrap.qr-pop {
  animation: qr-pop-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes qr-pop-in {
  0%   { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .qr-wrap.qr-pop { animation: none; }
}
.qr-wrap canvas, .qr-wrap img {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: crisp-edges;
}

.qr-size-note { font-size: 10px; color: var(--blue); text-align: center; font-weight: 500; }

.qr-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 8px 0;
  width: 100%;
}

.qr-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 40px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  user-select: none;
}

.qr-btn:hover {
  background: var(--surface);
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(127, 178, 255, 0.15);
}

.qr-btn:active {
  transform: translateY(0);
}

.scan-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 11px;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: all 0.2s;
  margin-top: 6px;
}
.scan-btn:hover { border-color: var(--blue); color: var(--blue); }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.visible { display: flex; }

.modal {
  background: var(--lg-bg);
  border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius);
  padding: 20px;
  width: min(400px, 95vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  backdrop-filter: url(#lg-distort) blur(var(--lg-blur));
  -webkit-backdrop-filter: blur(var(--lg-blur));
  box-shadow: var(--lg-shadow);
  position: relative;
}
.modal::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--lg-radius);
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.modal-title {
  font-size: 14px;
  font-weight: 600;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--red); }

#scanVideo {
  width: 100%;
  max-width: 320px;
  border-radius: 8px;
  background: #000;
  aspect-ratio: 1;
  object-fit: cover;
  transition: box-shadow 0.15s ease-out;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
}
#scanVideo.scan-flash {
  animation: scanFlashGlow 0.6s ease-out;
}
@keyframes scanFlashGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.9), 0 0 0 0 rgba(34, 197, 94, 0.5) inset;
  }
  30% {
    box-shadow: 0 0 28px 10px rgba(34, 197, 94, 0.85), 0 0 40px 14px rgba(34, 197, 94, 0.45) inset;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}
.scan-hint { font-size: 11px; color: var(--text-muted); text-align: center; }
.scan-status { font-size: 12px; font-weight: 500; color: var(--green); min-height: 18px; }

.scan-video-wrap { position: relative; width: 100%; max-width: 320px; }
.torch-btn {
  display: none;
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--lg-border);
  background: var(--lg-bg);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  z-index: 2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--lg-shadow);
  transition: all 0.2s ease;
}
.torch-btn:hover { border-color: var(--orange); }
.torch-btn.active {
  background: rgba(243, 190, 111, 0.22);
  border-color: var(--orange);
  color: var(--orange);
  box-shadow: 0 0 12px 2px rgba(243, 190, 111, 0.35), var(--lg-shadow);
}

.footer {
  width: calc(100% - 32px);
  max-width: 640px;
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-dev {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  font-family: var(--mono);
}
.footer-dev span { color: var(--blue); }
.footer-info {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
}
.footer-dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--border);
  display: inline-block;
}
#faq-toggle-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--lg-bg);
  border: 1px solid var(--lg-border);
  color: var(--blue);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--lg-shadow);
  backdrop-filter: url(#lg-distort) blur(var(--lg-blur));
  -webkit-backdrop-filter: blur(var(--lg-blur));
  transition: all 0.25s;
  z-index: 999;
}

#faq-toggle-btn:hover {
  border-color: rgba(127, 178, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(127,178,255,0.12), var(--lg-shadow);
  transform: scale(1.08);
}

/* Hide FAQ button while the language bottom sheet is open (mobile only) */
@media (max-width: 640px) {
  body.lang-sheet-open #faq-toggle-btn {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.75);
  }
}

.faq-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.faq-overlay.visible {
    display: flex;
}

.faq-content {
  background: var(--lg-bg);
  border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius);
  width: min(500px, 95vw);
  max-height: min(760px, 90vh);
  overflow-y: auto;
  padding: 24px;
  position: relative;
  font-family: var(--sans);
  color: var(--text);
  box-shadow: var(--lg-shadow);
  backdrop-filter: url(#lg-distort) blur(var(--lg-blur));
  -webkit-backdrop-filter: blur(var(--lg-blur));
}
.faq-content::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--lg-radius);
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 55%);
  pointer-events: none;
}

#faq-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}

#faq-close-btn:hover {
    color: var(--red);
}

.faq-content h2 {
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    margin: 0 0 12px 0;
    text-align: center;
    font-family: var(--mono);
}

.faq-divider {
    border-top: 1px solid var(--border);
    margin-bottom: 20px;
}

.faq-section {
    margin-bottom: 18px;
}

.faq-section h3 {
    color: var(--blue);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0 0 4px 0;
    font-family: var(--mono);
}

.faq-section p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.faq-footer {
    margin-top: 28px;
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: 1px;
    font-family: var(--mono);
}

.faq-footer span {
    color: var(--blue);
}

.footer-dev a,
.faq-footer a {
  color: var(--blue);
  text-decoration: none;
}

.footer-dev a:hover,
.faq-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .card {
    width: calc(100% - 20px);
  }

  .card-body {
    padding: 16px;
  }

  .qr-wrap {
    width: min(100%, calc(100vw - 40px));
    max-width: calc(100vw - 40px);
    padding: 8px;
  }

  .qr-size-note {
    max-width: calc(100vw - 40px);
  }

  .modal {
    width: min(360px, 92vw);
    padding: 16px;
  }
}