/* ==================================================================
   Morse Flash
   ================================================================== */

:root {
  --bg: #07080b;
  --bg-soft: #0d0f14;
  --surface: #13151b;
  --surface-2: #191c23;
  --ink: #f4f1e9;
  --muted: #9a9da8;
  --dim: #686c77;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --amber: #ffb52e;
  --amber-soft: #ffd277;
  --amber-deep: #f59300;
  --green: #4be0a5;
  --red: #ff6874;
  --blue: #7fa7ff;
  --radius: 24px;
  --radius-sm: 14px;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Consolas,
    monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-stage-open {
  overflow: hidden;
  touch-action: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

h1,
h2,
h3,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(255, 181, 46, 0.35);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------
   Фон
   ------------------------------------------------------------------ */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(55% 42% at 50% -8%, rgba(255, 181, 46, 0.17), transparent 70%),
    radial-gradient(45% 40% at 100% 78%, rgba(104, 134, 255, 0.07), transparent 70%),
    radial-gradient(50% 38% at 0% 100%, rgba(255, 128, 46, 0.045), transparent 70%),
    var(--bg);
}

.ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(60% 55% at 50% 10%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(60% 55% at 50% 10%, #000 0%, transparent 78%);
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ------------------------------------------------------------------
   Каркас
   ------------------------------------------------------------------ */

.page {
  width: min(100%, 1140px);
  margin: 0 auto;
  padding: 0 24px calc(40px + var(--safe-bottom));
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #221604;
  background: linear-gradient(145deg, #ffdf8f 0%, #ffb52e 45%, #f08b00 100%);
  box-shadow:
    0 8px 24px rgba(255, 166, 26, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
}

.brand-name {
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-name em {
  font-style: normal;
  color: var(--amber);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 42px;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  transition:
    color 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease,
    transform 0.18s ease;
}

.icon-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.icon-button:active {
  transform: translateY(1px);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.install-button {
  width: auto;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
}

.install-button span {
  white-space: nowrap;
}

.help-button {
  font-size: 16px;
  font-weight: 750;
}

/* ------------------------------------------------------------------
   Баннер HTTPS
   ------------------------------------------------------------------ */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 181, 46, 0.23);
  border-radius: 16px;
  background: rgba(255, 181, 46, 0.07);
  color: #f5d49a;
}

.banner svg {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  margin-top: 2px;
  color: var(--amber);
}

.banner strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
  color: var(--ink);
}

.banner p {
  font-size: 12px;
  line-height: 1.5;
}

.banner code {
  font-family: var(--mono);
  color: var(--amber-soft);
}

/* ------------------------------------------------------------------
   Заголовок
   ------------------------------------------------------------------ */

.intro {
  max-width: 760px;
  margin-top: 56px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(75, 224, 165, 0.5);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(75, 224, 165, 0.48);
  }
  55% {
    box-shadow: 0 0 0 7px rgba(75, 224, 165, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(75, 224, 165, 0);
  }
}

.intro h1 {
  font-size: clamp(3rem, 7.4vw, 5.4rem);
  font-weight: 800;
  line-height: 0.94;
  letter-spacing: -0.055em;
}

.intro h1 span {
  color: var(--amber);
  text-shadow: 0 0 50px rgba(255, 181, 46, 0.32);
  position: relative;
  white-space: nowrap;
}

.intro h1 span::after {
  content: "";
  position: absolute;
  left: 3%;
  right: 2%;
  bottom: 0.055em;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: 0.32;
}

.intro-copy {
  max-width: 590px;
  margin-top: 19px;
  color: var(--muted);
  font-size: clamp(14px, 1.8vw, 17px);
  line-height: 1.6;
}

/* ------------------------------------------------------------------
   Переключатель режима
   ------------------------------------------------------------------ */

.mode-tabs {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: inline-flex;
  gap: 4px;
  margin-top: 34px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 14, 18, 0.72);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 170px;
  padding: 8px 19px 8px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition:
    color 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.mode-tab:hover {
  color: var(--ink);
}

.mode-tab.is-active {
  border-color: rgba(255, 181, 46, 0.2);
  background: linear-gradient(180deg, rgba(255, 181, 46, 0.16), rgba(255, 181, 46, 0.06));
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.18);
}

.mode-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--dim);
  transition:
    color 0.18s ease,
    background-color 0.18s ease;
}

.mode-tab.is-active .mode-icon {
  background: rgba(255, 181, 46, 0.13);
  color: var(--amber);
}

.mode-icon svg {
  width: 20px;
  height: 20px;
}

.mode-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.mode-copy strong {
  font-size: 14px;
  font-weight: 700;
}

.mode-copy small {
  margin-top: 3px;
  color: var(--dim);
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-tab.is-active .mode-copy small {
  color: rgba(255, 210, 119, 0.66);
}

/* ------------------------------------------------------------------
   Общие карточки
   ------------------------------------------------------------------ */

.tab-panel {
  animation: panel-in 0.28s ease both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.transmit-layout,
.receive-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 18px;
  margin-top: 22px;
  align-items: start;
}

.receive-layout {
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
}

.card {
  position: relative;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 42%),
    linear-gradient(180deg, rgba(24, 27, 34, 0.92), rgba(15, 17, 22, 0.94));
  box-shadow: var(--shadow);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  pointer-events: none;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}

.eyebrow {
  margin-bottom: 5px;
  color: rgba(255, 181, 46, 0.7);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.card h2 {
  font-size: 22px;
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.counter {
  padding-top: 5px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

/* ------------------------------------------------------------------
   Передача: сообщение
   ------------------------------------------------------------------ */

.transmit-layout > .card {
  min-width: 0;
}

.message-input {
  display: block;
  width: 100%;
  min-height: 158px;
  max-height: 330px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(4, 6, 9, 0.48);
  color: var(--ink);
  font-size: clamp(18px, 2.6vw, 22px);
  font-weight: 530;
  line-height: 1.45;
  letter-spacing: -0.012em;
  resize: vertical;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.message-input::placeholder {
  color: #5e626d;
}

.message-input:focus {
  outline: none;
  border-color: rgba(255, 181, 46, 0.42);
  background: rgba(5, 7, 11, 0.66);
  box-shadow: 0 0 0 4px rgba(255, 181, 46, 0.08);
}

.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.035em;
  transition:
    color 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease;
}

.chip:hover {
  border-color: rgba(255, 181, 46, 0.28);
  background: rgba(255, 181, 46, 0.08);
  color: var(--amber-soft);
}

.text-button {
  flex: 0 0 auto;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
  transition: color 0.16s ease;
}

.text-button:hover {
  color: var(--red);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 13px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 104, 116, 0.2);
  border-radius: 12px;
  background: rgba(255, 104, 116, 0.06);
  color: #ffb7bd;
  font-size: 12px;
  line-height: 1.45;
}

.notice svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.morse-box {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.morse-box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
  color: var(--dim);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.morse-box-head .mono {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
}

.morse-preview {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  max-height: 190px;
  overflow: auto;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.morse-preview::-webkit-scrollbar {
  width: 6px;
}

.morse-preview::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

.preview-empty {
  width: 100%;
  padding: 20px 14px;
  border: 1px dashed rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  color: var(--dim);
  font-size: 12px;
  text-align: center;
}

.morse-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 45px;
  padding: 6px 8px 5px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.026);
}

.morse-chip-char {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  line-height: 1;
}

.morse-chip-code {
  margin-top: 4px;
  color: var(--amber-soft);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.13em;
  line-height: 1;
}

.morse-chip.is-unsupported {
  border-color: rgba(255, 104, 116, 0.22);
  color: var(--red);
}

.morse-space {
  flex: 0 0 7px;
}

/* ------------------------------------------------------------------
   Передача: настройки
   ------------------------------------------------------------------ */

.settings-card {
  display: flex;
  flex-direction: column;
}

.field {
  margin-bottom: 21px;
}

.field:last-of-type {
  margin-bottom: 0;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.field-label {
  display: block;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.field-hint {
  margin-top: 7px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.5;
}

.field-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.field-inline .field-hint {
  margin-top: 3px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(4, 6, 9, 0.42);
}

.segment {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 630;
  transition:
    color 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease;
}

.segment svg {
  width: 17px;
  height: 17px;
}

.segment:hover {
  color: var(--ink);
}

.segment.is-active {
  border-color: rgba(255, 181, 46, 0.18);
  background: rgba(255, 181, 46, 0.1);
  color: var(--amber-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.value-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid rgba(255, 181, 46, 0.17);
  border-radius: 999px;
  background: rgba(255, 181, 46, 0.07);
  color: var(--amber-soft);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.range {
  display: block;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range:focus-visible {
  outline: none;
}

.range:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 0 0 4px rgba(255, 181, 46, 0.22),
    0 3px 8px rgba(0, 0, 0, 0.4);
}

.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--amber) 0%,
    var(--amber) var(--fill, 50%),
    rgba(255, 255, 255, 0.1) var(--fill, 50%),
    rgba(255, 255, 255, 0.1) 100%
  );
}

.range::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 4px solid var(--amber);
  border-radius: 50%;
  background: #fff8e8;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.38);
  appearance: none;
  -webkit-appearance: none;
}

.range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--amber) 0%,
    var(--amber) var(--fill, 50%),
    rgba(255, 255, 255, 0.1) var(--fill, 50%),
    rgba(255, 255, 255, 0.1) 100%
  );
}

.range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 4px solid var(--amber);
  border-radius: 50%;
  background: #fff8e8;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.38);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 1px;
  color: var(--dim);
  font-size: 9px;
  font-weight: 550;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stepper {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(4, 6, 9, 0.42);
}

.stepper button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.stepper button:hover:not(:disabled) {
  background: rgba(255, 181, 46, 0.09);
  color: var(--amber);
}

.stepper button:disabled {
  opacity: 0.28;
}

.stepper output {
  width: 28px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 650;
  text-align: center;
}

.primary-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 57px;
  margin-top: 9px;
  padding: 12px 18px;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffd675 0%, #ffb52e 46%, #f59a08 100%);
  color: #211503;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow:
    0 16px 34px rgba(245, 147, 0, 0.19),
    inset 0 1px 0 rgba(255, 255, 255, 0.58);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.18s ease,
    filter 0.18s ease;
}

.primary-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 25%, rgba(255, 255, 255, 0.36), transparent 62%);
  transform: translateX(-130%);
  transition: transform 0.6s ease;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 20px 42px rgba(245, 147, 0, 0.27),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.primary-button:hover:not(:disabled)::after {
  transform: translateX(130%);
}

.primary-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.995);
}

.primary-button:disabled {
  opacity: 0.34;
  filter: saturate(0.45);
  box-shadow: none;
}

.primary-button svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.button-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 80% at 50% 120%, rgba(255, 255, 255, 0.38), transparent 65%);
  pointer-events: none;
}

.micro-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 14px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.5;
}

.micro-note svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

.appstore-tip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 13px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 181, 46, 0.14);
  border-radius: 12px;
  background: rgba(255, 181, 46, 0.04);
  color: var(--muted);
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease;
}

.appstore-tip:hover {
  border-color: rgba(255, 181, 46, 0.3);
  background: rgba(255, 181, 46, 0.07);
}

.appstore-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 181, 46, 0.11);
  color: var(--amber);
}

.appstore-icon svg {
  width: 16px;
  height: 16px;
}

.appstore-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.appstore-title {
  color: var(--amber-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.appstore-title span {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border: 1px solid rgba(255, 181, 46, 0.17);
  border-radius: 4px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.05em;
  vertical-align: 1px;
}

.appstore-comment {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.appstore-arrow {
  flex: 0 0 auto;
  margin-left: auto;
  padding-top: 2px;
  color: var(--dim);
  font-size: 13px;
  line-height: 1;
}

/* ------------------------------------------------------------------
   Приём: камера
   ------------------------------------------------------------------ */

.camera-card {
  padding: 20px;
}

.camera-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--dim);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.camera-badge.is-live {
  border-color: rgba(75, 224, 165, 0.22);
  background: rgba(75, 224, 165, 0.075);
  color: var(--green);
}

.camera-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(75% 75% at 50% 42%, rgba(58, 64, 78, 0.42), transparent 72%),
    #050608;
  isolation: isolate;
}

.camera-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.38);
}

#cameraVideo {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.camera-stage.is-live #cameraVideo {
  opacity: 1;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 24px 70px;
  text-align: center;
  transform: translateY(-10px);
}

.camera-stage.is-live .camera-placeholder,
.camera-stage.is-live .stage-start {
  display: none;
}

.placeholder-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--dim);
}

.placeholder-icon svg {
  width: 29px;
  height: 29px;
}

.camera-placeholder strong {
  font-size: 14px;
  font-weight: 680;
}

.camera-placeholder > span:last-child {
  color: var(--dim);
  font-size: 11px;
}

.target {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  width: 50%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px dashed rgba(255, 255, 255, 0.26);
  border-radius: 23px;
  pointer-events: none;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease;
}

.target::before,
.target::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: rgba(255, 181, 46, 0.8);
  border-style: solid;
}

.target::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
  border-top-left-radius: 22px;
}

.target::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 2px 2px 0;
  border-bottom-right-radius: 22px;
}

.target-line {
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(255, 255, 255, 0.17);
  transform: translate(-50%, -50%);
}

.target-line-x {
  width: 16px;
  height: 1px;
}

.target-line-y {
  width: 1px;
  height: 16px;
}

.target-caption {
  position: absolute;
  bottom: -25px;
  left: 50%;
  color: rgba(255, 255, 255, 0.38);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateX(-50%);
}

.camera-stage.is-flashing .target {
  border-color: rgba(255, 181, 46, 0.72);
  background: rgba(255, 181, 46, 0.045);
  box-shadow:
    inset 0 0 60px rgba(255, 181, 46, 0.12),
    0 0 40px rgba(255, 181, 46, 0.08);
}

.camera-stage.is-flashing .target-line {
  background: rgba(255, 181, 46, 0.65);
}

.stage-top {
  position: absolute;
  top: 11px;
  right: 11px;
  left: 11px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 48%;
  padding: 5px 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(4, 6, 9, 0.55);
  color: rgba(255, 255, 255, 0.72);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.status-dot,
.quality-dot {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--dim);
}

.camera-stage.is-live .status-dot {
  background: var(--green);
  box-shadow: 0 0 8px rgba(75, 224, 165, 0.7);
}

.quality-badge[data-quality="low"] .quality-dot {
  background: var(--red);
}

.quality-badge[data-quality="mid"] .quality-dot {
  background: var(--amber);
}

.quality-badge[data-quality="high"] .quality-dot {
  background: var(--green);
  box-shadow: 0 0 8px rgba(75, 224, 165, 0.7);
}

.stage-bottom {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 42px 14px 12px;
  background: linear-gradient(transparent, rgba(2, 3, 5, 0.82));
  pointer-events: none;
}

.level-meter {
  position: relative;
  height: 5px;
  overflow: visible;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

.level-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #9b6a1a, var(--amber), #ffe4a3);
  transition: width 0.07s linear;
}

.level-threshold {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 2px;
  height: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  transition: left 0.1s linear;
}

.stage-hint {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.67);
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-stage.is-live .stage-bottom {
  padding-right: 116px;
}

.stage-start {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd675, #ffb52e);
  color: #211503;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(245, 147, 0, 0.25);
  transform: translate(-50%, 58px);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.stage-start:hover {
  transform: translate(-50%, 56px);
  box-shadow: 0 16px 36px rgba(245, 147, 0, 0.33);
}

.stage-start:disabled {
  opacity: 0.6;
  cursor: progress;
}

.stage-start svg {
  width: 18px;
  height: 18px;
}

.stage-stop {
  position: absolute;
  right: 11px;
  bottom: 10px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(4, 6, 9, 0.62);
  color: rgba(255, 255, 255, 0.8);
  font-size: 10px;
  font-weight: 650;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stage-stop:hover {
  border-color: rgba(255, 104, 116, 0.4);
  color: #ffc5c9;
}

.stop-square {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
}

.camera-live-text {
  display: none;
}

.scope {
  display: block;
  width: 100%;
  height: 82px;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 13px;
  background: #080a0e;
}

.camera-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.028);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  transition:
    color 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease;
}

.tool-button svg {
  width: 14px;
  height: 14px;
}

.tool-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}

.advanced {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.advanced summary {
  padding: 12px 0 3px;
  color: var(--dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  list-style: none;
  cursor: pointer;
  transition: color 0.16s ease;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::before {
  content: "+";
  display: inline-block;
  width: 15px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 13px;
  transition: transform 0.2s ease;
}

.advanced[open] summary::before {
  content: "−";
}

.advanced summary:hover {
  color: var(--ink);
}

.advanced-body {
  padding: 11px 0 2px;
}

.advanced-body .field-hint {
  margin-top: 4px;
}

/* ------------------------------------------------------------------
   Приём: декодированный текст
   ------------------------------------------------------------------ */

.decode-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.decode-head {
  margin-bottom: 13px;
}

.alphabet-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(4, 6, 9, 0.45);
}

.alphabet-switch button {
  min-width: 38px;
  padding: 5px 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.alphabet-switch button:hover {
  color: var(--ink);
}

.alphabet-switch button.is-active {
  background: rgba(255, 181, 46, 0.13);
  color: var(--amber-soft);
}

.decode-output {
  position: relative;
  min-height: 238px;
  max-height: 330px;
  overflow: auto;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 16px;
  background:
    linear-gradient(rgba(255, 181, 46, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 181, 46, 0.018) 1px, transparent 1px),
    rgba(4, 6, 9, 0.6);
  background-size: 28px 28px, 28px 28px, auto;
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(21px, 2.8vw, 28px);
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0.07em;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.decode-output::-webkit-scrollbar {
  width: 6px;
}

.decode-output::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.decode-empty {
  color: #5e626d;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 450;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.pending-char {
  color: var(--amber);
  opacity: 0.5;
}

.decode-cursor {
  display: none;
  width: 8px;
  height: 1.08em;
  margin-left: 3px;
  border-radius: 1px;
  background: var(--amber);
  vertical-align: -0.16em;
}

.decode-cursor.is-visible {
  display: inline-block;
  opacity: 0.8;
  animation: cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes cursor-blink {
  50% {
    opacity: 0.1;
  }
}

.live-code {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 9px;
  color: var(--dim);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.live-code code {
  color: var(--amber-soft);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: none;
}

.decode-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 17px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.decode-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat-label {
  color: var(--dim);
  font-size: 9px;
  font-weight: 550;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.decode-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

.secondary-button {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 43px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 181, 46, 0.18);
  border-radius: 12px;
  background: rgba(255, 181, 46, 0.075);
  color: var(--amber-soft);
  font-size: 11px;
  font-weight: 650;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    opacity 0.16s ease;
}

.secondary-button:hover:not(:disabled) {
  border-color: rgba(255, 181, 46, 0.32);
  background: rgba(255, 181, 46, 0.12);
}

.secondary-button.ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.028);
  color: var(--muted);
}

.secondary-button.ghost:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}

.secondary-button:disabled {
  opacity: 0.32;
}

.secondary-button svg {
  width: 15px;
  height: 15px;
}

.decode-note {
  margin-top: 13px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.55;
}

.decode-note code {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

/* ------------------------------------------------------------------
   Подвал
   ------------------------------------------------------------------ */

.footer {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 54px;
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 10px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.footer-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 181, 46, 0.65);
}

.footer-dim {
  color: #4f535d;
}

/* ------------------------------------------------------------------
   Экран передачи
   ------------------------------------------------------------------ */

.transmit-stage {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top, 0px)) 22px
    max(18px, env(safe-area-inset-bottom, 0px));
  background: #050608;
  color: #f7f5ee;
  transition: background-color 0.055s linear;
  overscroll-behavior: none;
}

.transmit-stage-inner {
  display: flex;
  flex-direction: column;
  width: min(100%, 860px);
  min-height: 100%;
}

.stage-topline {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.transmit-label {
  color: rgba(255, 255, 255, 0.42);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.transmit-stop {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.transmit-stop:hover {
  border-color: rgba(255, 104, 116, 0.4);
  background: rgba(255, 104, 116, 0.09);
  color: #ffc5c9;
}

.transmit-center {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 38px;
  padding: 20px 0;
}

.beam {
  position: relative;
  display: grid;
  place-items: center;
  width: 142px;
  height: 142px;
}

.beam-core {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #5a4518;
  box-shadow: 0 0 0 0 rgba(255, 181, 46, 0);
  transition:
    background-color 0.05s linear,
    box-shadow 0.08s linear,
    transform 0.08s linear;
}

.beam-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
}

.beam-ring::before,
.beam-ring::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 50%;
}

.beam-ring::before {
  inset: 16px;
}

.beam-ring::after {
  inset: 32px;
}

.transmit-stage.lit .beam-core {
  background: var(--amber);
  box-shadow:
    0 0 24px 5px rgba(255, 181, 46, 0.65),
    0 0 90px 24px rgba(255, 166, 26, 0.22);
  transform: scale(1.18);
}

.transmit-stage.lit .beam-ring {
  border-color: rgba(255, 181, 46, 0.2);
}

.transmit-symbol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  min-height: 100px;
}

.transmit-char {
  color: #f8f4e9;
  font-size: clamp(54px, 10vw, 88px);
  font-weight: 780;
  line-height: 1;
  letter-spacing: -0.04em;
}

.transmit-code {
  color: var(--amber);
  font-family: var(--mono);
  font-size: clamp(20px, 3.4vw, 30px);
  font-weight: 600;
  letter-spacing: 0.26em;
  line-height: 1;
  text-indent: 0.26em;
}

.transmit-stage.lit .transmit-code {
  text-shadow: 0 0 26px rgba(255, 181, 46, 0.35);
}

.transmit-bottom {
  flex: 0 0 auto;
  width: 100%;
  padding-bottom: 6px;
}

.transmit-progress {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.transmit-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b27613, var(--amber), #ffe2a0);
  transition: width 0.1s linear;
}

.transmit-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 10px;
  font-weight: 550;
}

.transmit-tip {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.26);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-align: center;
}

/* Экранный режим: белая вспышка на весь экран */
.transmit-stage.screen-mode {
  transition: none;
}

.transmit-stage.screen-mode.lit {
  background: #fff;
}

.transmit-stage.screen-mode.lit .transmit-center,
.transmit-stage.screen-mode.lit .transmit-bottom,
.transmit-stage.screen-mode.lit .transmit-label {
  opacity: 0;
}

.transmit-stage.screen-mode.lit .transmit-stop {
  border-color: rgba(0, 0, 0, 0.18);
  background: rgba(0, 0, 0, 0.08);
  color: #111;
}

.transmit-stage.screen-mode.lit .transmit-stop .stop-square {
  background: #111;
}

.transmit-stage.screen-mode:not(.lit) {
  background: #000;
}

.transmit-stage.screen-mode:not(.lit) .transmit-stop {
  border-color: rgba(255, 255, 255, 0.2);
}

/* ------------------------------------------------------------------
   Тост
   ------------------------------------------------------------------ */

.toast {
  position: fixed;
  bottom: calc(22px + var(--safe-bottom));
  left: 50%;
  z-index: 300;
  max-width: min(92vw, 460px);
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: rgba(24, 27, 34, 0.96);
  color: var(--ink);
  font-size: 12px;
  font-weight: 550;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-tone="error"] {
  border-color: rgba(255, 104, 116, 0.35);
  color: #ffd0d4;
}

.toast[data-tone="success"] {
  border-color: rgba(75, 224, 165, 0.28);
  color: #caffea;
}

/* ------------------------------------------------------------------
   Диалог
   ------------------------------------------------------------------ */

.help-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: min(88dvh, 760px);
  padding: 24px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 38%),
    #15181e;
  color: var(--ink);
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.7);
}

.help-dialog::backdrop {
  background: rgba(2, 3, 5, 0.76);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.help-dialog[open] {
  animation: dialog-in 0.22s ease both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-head h2 {
  font-size: 24px;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.dialog-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.dialog-close:hover {
  color: var(--ink);
}

.dialog-close svg {
  width: 18px;
  height: 18px;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 13px;
}

.steps li > span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid rgba(255, 181, 46, 0.24);
  border-radius: 9px;
  background: rgba(255, 181, 46, 0.09);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.steps strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 680;
}

.steps p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.dialog-tip,
.dialog-note {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid rgba(255, 181, 46, 0.14);
  border-radius: 14px;
  background: rgba(255, 181, 46, 0.045);
}

.dialog-tip strong {
  display: block;
  margin-bottom: 4px;
  color: var(--amber-soft);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.dialog-tip p,
.dialog-note p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.dialog-note {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.dialog-note p + p {
  margin-top: 8px;
}

.dialog-note strong {
  color: var(--ink);
}

.dialog-ok {
  margin-top: 20px;
}

/* ------------------------------------------------------------------
   Служебное
   ------------------------------------------------------------------ */

.hidden-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.noscript {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 400;
  padding: 14px;
  border: 1px solid rgba(255, 104, 116, 0.3);
  border-radius: 12px;
  background: #1b1113;
  color: #ffd0d4;
  font-size: 13px;
  text-align: center;
}

/* ------------------------------------------------------------------
   Адаптивность
   ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .transmit-layout,
  .receive-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-card {
    order: 2;
  }

  .decode-output {
    min-height: 180px;
  }

  .camera-live-text {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-top: 10px;
    padding: 8px 11px;
    border: 1px solid rgba(255, 181, 46, 0.14);
    border-radius: 12px;
    background: rgba(255, 181, 46, 0.045);
  }

  .camera-live-label {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    color: var(--amber);
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .camera-live-label span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 7px rgba(255, 181, 46, 0.7);
  }

  .camera-live-value {
    min-width: 0;
    overflow: hidden;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 680px) {
  .page {
    padding-right: 14px;
    padding-left: 14px;
  }

  .topbar {
    padding-top: 16px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .brand-mark svg {
    width: 22px;
    height: 22px;
  }

  .brand-name {
    font-size: 12px;
    letter-spacing: 0.14em;
  }

  .install-button span {
    display: none;
  }

  .install-button {
    width: 42px;
    padding: 0;
  }

  .intro {
    margin-top: 38px;
  }

  .intro h1 {
    font-size: clamp(2.75rem, 13.4vw, 4.2rem);
  }

  .intro-copy {
    margin-top: 14px;
    font-size: 13px;
  }

  .mode-tabs {
    top: 8px;
    display: flex;
    width: 100%;
    margin-top: 25px;
    border-radius: 18px;
  }

  .mode-tab {
    flex: 1;
    min-width: 0;
    padding: 7px 10px 7px 8px;
  }

  .mode-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .mode-icon svg {
    width: 18px;
    height: 18px;
  }

  .mode-copy strong {
    font-size: 12px;
  }

  .mode-copy small {
    font-size: 8px;
  }

  .transmit-layout,
  .receive-layout {
    gap: 13px;
    margin-top: 14px;
  }

  .card {
    padding: 17px;
    border-radius: 20px;
  }

  .card::before {
    left: 17px;
    right: 17px;
  }

  .card h2 {
    font-size: 19px;
  }

  .message-input {
    min-height: 132px;
    padding: 14px;
    font-size: 18px;
  }

  .composer-row {
    align-items: flex-start;
  }

  .morse-preview {
    max-height: 150px;
  }

  .field {
    margin-bottom: 18px;
  }

  .camera-card {
    padding: 14px;
  }

  .camera-stage {
    border-radius: 15px;
    aspect-ratio: 5 / 4;
  }

  .target {
    width: 58%;
  }

  .stage-top {
    top: 8px;
    right: 8px;
    left: 8px;
  }

  .stage-badge {
    padding: 4px 7px;
    font-size: 7px;
  }

  .stage-bottom {
    padding: 36px 11px 10px;
  }

  .camera-stage.is-live .stage-bottom {
    padding-right: 102px;
  }

  .stage-hint {
    font-size: 9px;
  }

  .stage-start {
    padding: 11px 15px;
    font-size: 11px;
  }

  .stage-stop {
    right: 8px;
    bottom: 8px;
    padding: 6px 9px;
    font-size: 9px;
  }

  .scope {
    height: 70px;
  }

  .decode-output {
    min-height: 174px;
    max-height: 280px;
    padding: 14px;
    font-size: 21px;
  }

  .decode-stats {
    margin-top: 14px;
    padding: 11px 0;
  }

  .stat-value {
    font-size: 14px;
  }

  .footer {
    margin-top: 38px;
  }

  .transmit-stage {
    padding-right: 16px;
    padding-left: 16px;
  }

  .beam {
    width: 112px;
    height: 112px;
  }

  .beam-core {
    width: 20px;
    height: 20px;
  }

  .transmit-center {
    gap: 26px;
  }

  .help-dialog {
    padding: 19px;
    border-radius: 20px;
  }
}

@media (max-width: 400px) {
  .mode-copy small {
    display: none;
  }

  .mode-tab {
    justify-content: center;
  }

  .quality-badge {
    display: none;
  }

  .decode-actions {
    flex-direction: column;
  }

  .secondary-button {
    flex: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .pulse-dot {
    animation: none;
  }
}
