/* === Hero === */

.hero {
  max-width: min(820px, 100%);
  margin: 0 auto var(--space-10);
  text-align: center;
}

.hero__title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -2px;
  margin-bottom: var(--space-3);
}

.hero__accent {
  color: var(--color-accent);
}

.hero__accent2 {
  color: var(--color-blue);
}

.hero__subtitle {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  letter-spacing: var(--tracking-wide);
}

/* === Onboarding steps (B1) === */

.onboarding-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  max-width: min(820px, 100%);
  margin: 0 auto var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: var(--tracking-wide);
}

.onboarding-step__arrow {
  color: var(--color-accent-dim);
}

/* === Specs (C8: обёрнуто в details) === */

.specs-details {
  max-width: min(820px, 100%);
  margin: var(--space-10) auto 0;
}

.specs-summary {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  letter-spacing: var(--tracking-wide);
  cursor: pointer;
  text-align: center;
  list-style: none;
  padding: var(--space-3) 0;
  transition: color var(--transition-fast);
}

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

.specs-summary::before {
  content: '▸ ';
  color: var(--color-accent-dim);
}

.specs-details[open] .specs-summary::before {
  content: '▾ ';
}

.specs-summary:hover {
  color: var(--color-text-2);
}

.specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.spec {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: border-color var(--transition-base);
}

.spec:hover {
  border-color: var(--color-border-hover);
}

.spec__icon {
  font-size: 18px;
  margin-bottom: var(--space-3);
  color: var(--color-accent);
}

.spec__title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.spec__desc {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

/* === Card === */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  display: flex;
  flex-direction: column;
}

.card:hover {
  border-color: var(--color-border-hover);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.card--highlight {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-accent);
}

.card__label {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-text);
  margin-bottom: var(--space-5);
}

.card__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.card__instruction {
  font-size: var(--text-sm);
  color: var(--color-text-2);
  line-height: var(--leading-loose);
  margin-bottom: var(--space-5);
}

.card__hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: auto;
  padding-top: var(--space-4);
  text-align: center;
}

/* === Button === */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--accent {
  background: var(--color-accent);
  color: var(--color-text-inverse);
}

.btn--accent:hover {
  background: #00ffb3;
  box-shadow: var(--shadow-accent);
}

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

.btn--ghost:hover {
  border-color: var(--color-text);
  color: var(--color-text);
}

.btn--danger {
  background: var(--color-error);
  color: #fff;
}

.btn--danger:hover {
  opacity: 0.85;
}

.btn--sm {
  min-height: 32px;
  padding: var(--space-1) var(--space-4);
  font-size: var(--text-xs);
}

.btn--lg {
  min-height: 52px;
  padding: var(--space-3) var(--space-8);
  font-size: var(--text-md);
}

.btn--full {
  width: 100%;
  justify-content: center;
}

/* === Input === */

.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.input::placeholder {
  color: var(--color-text-muted);
}

.input--code::placeholder {
  color: var(--color-border-hover);
  font-weight: 400;
}

.input:focus {
  border-color: var(--color-blue);
}

.input--code {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-align: center;
  color: var(--color-blue);
  padding: var(--space-4);
  min-width: 260px;
}

.input--code:focus {
  border-color: var(--color-accent);
}

/* C3: inline-валидация ошибки */
.input--error {
  border-color: var(--color-error);
  border-width: 2px;
  box-shadow: 0 0 12px rgba(255, 68, 85, 0.25);
  animation: shake 0.3s ease;
}

.input--error:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 16px rgba(255, 68, 85, 0.35);
}

.input-hint--error {
  color: var(--color-error);
  font-weight: 700;
  font-size: var(--text-sm);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* === Textarea === */

.textarea {
  width: 100%;
  padding: var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  color: var(--color-text);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  resize: none;
  min-height: 56px;
  max-height: 200px;
  transition: border-color var(--transition-fast);
}

.textarea::placeholder {
  color: var(--color-text-muted);
}

.textarea:focus {
  border-color: var(--color-accent-dim);
}

/* === Input group === */

.input-group {
  display: flex;
  gap: var(--space-3);
  align-items: stretch;
}

.input-group .input {
  flex: 1;
}

/* === Input hint === */

.input-hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* === Session code === */

.session-code {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  cursor: pointer;
  user-select: all;
  transition: opacity var(--transition-fast);
}

.session-code:hover { opacity: 0.75; }
.session-code:active { opacity: 0.5; }

.session-code__text {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--color-accent);
  text-shadow: 0 0 20px var(--color-accent-glow);
}

.session-code__dot {
  color: var(--color-text-muted);
  text-shadow: none;
}

.session-code__lock {
  margin-left: var(--space-3);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: 0.4;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.session-code__lock:hover {
  opacity: 0.8;
}

.session-code__lock--active {
  opacity: 1;
}


/* === QR canvas === */

/* A1: border-radius убран — обрезал finder patterns QR-кода */
.qr-canvas {
  display: block;
  width: 220px;
  height: 220px;
  margin: 0 auto var(--space-5);
  border: 1px solid var(--color-accent-glow);
  image-rendering: pixelated;
  box-shadow: 0 0 24px rgba(0, 229, 160, 0.1);
}

/* === Timer === */

.timer {
  margin-bottom: var(--space-6);
}

.timer__bar {
  height: 3px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.timer__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-blue));
  border-radius: var(--radius-full);
  width: 100%;
  transition: width 1s linear;
}

.timer__text {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: var(--tracking-wide);
  text-align: center;
}

.timer--warning .timer__fill {
  background: linear-gradient(90deg, var(--color-warn), var(--color-error));
}

.timer--warning .timer__text {
  color: var(--color-warn);
}

/* === Connection status === */

.connection-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.connection-status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-muted);
  flex-shrink: 0;
  transition: background-color var(--transition-fast);
}

.connection-status--connecting .connection-status__dot {
  background: var(--color-warn);
  animation: pulseGlow 1s ease infinite;
}

.connection-status--connecting .connection-status__text {
  color: var(--color-warn);
}

.connection-status--connected .connection-status__dot {
  background: var(--color-accent);
  animation: pulseGlow 2s ease infinite;
}

.connection-status--connected .connection-status__text {
  color: var(--color-accent);
}

.connection-status--disconnected .connection-status__dot {
  background: var(--color-error);
}

.connection-status--disconnected .connection-status__text {
  color: var(--color-error);
}

/* === Security note === */

.security-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: var(--leading-loose);
  letter-spacing: var(--tracking-wide);
  margin-top: auto;
  padding-top: var(--space-3);
}

.security-note__icon {
  color: var(--color-accent);
  flex-shrink: 0;
}

/* === Transfer wrapper (desktop) === */

@media (min-width: 769px) {
  .transfer-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
  }
}

/* === Transfer panel (единая) === */

.transfer-panel {
  animation: fadeInUp 0.25s ease;
}

.transfer-panel[hidden] {
  display: none;
}

/* === Compose area (поле ввода + инструменты) === */

.compose-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  max-width: 100%;
  overflow: hidden;
}

.compose-area .textarea {
  margin-bottom: 0;
}

.compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.compose-tools {
  display: flex;
  gap: var(--space-1);
}

.btn--icon {
  min-width: 36px;
  padding: var(--space-1) var(--space-2);
  font-size: 16px;
  line-height: 1;
}

.compose-actions .btn--accent {
  min-width: 44px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-lg);
}

/* === Drop zone компактная === */

.drop-zone--compact {
  padding: var(--space-4) var(--space-5);
  flex-direction: row;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.drop-zone--compact .drop-zone__icon {
  font-size: 20px;
  margin-bottom: 0;
}

.drop-zone--compact .drop-zone__text {
  flex-direction: column;
  gap: var(--space-1);
}

/* === File send bar (полоса с именем файла + кнопка) === */

.file-send-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-blue-glow);
  border: 1px solid var(--color-blue);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  animation: fadeInUp 0.2s ease;
}

.file-send-bar[hidden] {
  display: none;
}

.file-send-bar__name {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-2);
  letter-spacing: var(--tracking-wide);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* === Transfer header === */

.transfer-header {
  margin-bottom: var(--space-5);
}

/* === Panel actions (legacy, для обратной совместимости) === */

.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}

/* === Peer info === */

.peer-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-accent);
}

.peer-info__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 8px var(--color-accent);
  animation: pulseGlow 1.5s ease infinite;
}

.peer-info--lost {
  color: var(--color-error);
}

.peer-info--lost .peer-info__dot {
  background: var(--color-error);
  box-shadow: 0 0 8px var(--color-error);
  animation: pulseGlow 0.8s ease infinite;
}

/* === Drop zone === */

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10) var(--space-8);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
  position: relative;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--color-accent);
  background: var(--color-accent-glow);
  outline: none;
}

.drop-zone--dragging {
  border-color: var(--color-accent);
  background: var(--color-accent-glow);
  box-shadow: var(--shadow-accent);
}

.drop-zone--has-file {
  border-style: solid;
  border-color: var(--color-blue);
  background: var(--color-blue-glow);
}

.drop-zone__icon {
  font-size: 32px;
  margin-bottom: var(--space-3);
  line-height: 1;
  color: var(--color-text-muted);
  transition: color var(--transition-base);
}

.drop-zone:hover .drop-zone__icon,
.drop-zone--dragging .drop-zone__icon {
  color: var(--color-accent);
}

.drop-zone__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-2);
}

.drop-zone__text strong {
  color: var(--color-text);
}

.drop-zone__hint {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: var(--tracking-wide);
  margin-top: var(--space-2);
}

/* === Progress === */

.progress {
  margin-top: var(--space-5);
}

.progress__info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.progress__name {
  color: var(--color-text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.progress__right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.progress__pct {
  color: var(--color-accent);
  font-weight: 700;
}

.progress__cancel {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.progress__cancel:hover {
  color: var(--color-error);
  border-color: var(--color-error);
}

.progress--done .progress__cancel {
  display: none;
}

.progress__bar {
  height: 6px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-blue));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  width: 0%;
}

.progress--done .progress__fill {
  background: var(--color-accent);
}

/* === Received list === */

.received-list {
  margin-top: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scroll-behavior: smooth;
}

.received-list__empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: var(--tracking-wide);
}

.received-list__empty[hidden] { display: none; }

.received-item {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-blue);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  position: relative;
  word-break: break-word;
  animation: fadeInUp var(--transition-base);
  font-size: var(--text-sm);
  line-height: var(--leading-loose);
}

.received-item--sent {
  border-left-color: var(--color-accent);
  background: rgba(0, 229, 160, 0.04);
  margin-left: var(--space-6);
}

.received-item:not(.received-item--sent) {
  margin-right: var(--space-6);
}

.received-item__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-blue);
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
}

.received-item--sent .received-item__label {
  color: var(--color-accent);
}

.received-item__content {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

.received-item__time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
  letter-spacing: var(--tracking-wide);
  margin-top: var(--space-2);
}

.received-item__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.received-item__delete {
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-2);
  font-size: 14px;
  min-height: auto;
}

.received-item__delete:hover {
  color: var(--color-error);
  border-color: var(--color-error);
}

.received-item__copy {
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: var(--tracking-wide);
}

.received-item__copy:hover {
  color: var(--color-text-2);
  border-color: var(--color-border-hover);
}

/* === File message === */

.received-item--file .received-item__file {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.received-item__file-icon { font-size: 24px; flex-shrink: 0; }

.received-item__file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.received-item__file-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.received-item__file-size {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: var(--tracking-wide);
}

/* === Location message === */

.received-item__location {
  margin-top: var(--space-2);
}

.location__coords {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-1);
}

.location__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-3);
}

.location__actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* === Photo message === */

.received-item__photo {
  display: block;
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  margin: var(--space-3) 0;
  object-fit: contain;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  cursor: zoom-in;
  transition: opacity var(--transition-fast);
}

.received-item__photo:hover {
  opacity: 0.85;
}

.received-item--photo .location__meta {
  margin-top: var(--space-2);
}

.received-item--photo .location__actions {
  margin-top: var(--space-2);
  margin-bottom: var(--space-1);
}

/* === Photo fullscreen overlay === */

.photo-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.photo-overlay--closing {
  animation: fadeOut 0.2s ease forwards;
}

@keyframes fadeOut {
  to { opacity: 0; }
}

.photo-overlay__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-user-select: none;
}

.photo-overlay__close {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 201;
}

.photo-overlay__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.photo-overlay__download {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-8);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 201;
}

.photo-overlay__download:hover {
  background: #00ffb3;
  box-shadow: var(--shadow-accent);
}

/* === QR Scanner === */

.join-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.qr-scanner {
  position: relative;
  margin-top: var(--space-4);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  aspect-ratio: 1;
  max-height: 280px;
}

.qr-scanner[hidden] { display: none; }

.qr-scanner__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-scanner__overlay {
  position: absolute;
  inset: 20%;
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  animation: pulseGlow 2s ease infinite;
}

.qr-scanner__close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 1;
}

/* === Transfer header layout === */

.transfer-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.transfer-header__actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

/* === Session timer bar (в transfer view) === */

.session-timer-bar {
  height: 4px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-3);
}

.session-timer-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-blue));
  border-radius: var(--radius-full);
  width: 100%;
  transition: width 1s linear;
}

.session-timer-bar--warning .session-timer-bar__fill {
  background: linear-gradient(90deg, var(--color-warn), var(--color-error));
}

/* === Peer status indicator (печатает / голос / файл / фото) === */

.peer-status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: var(--tracking-wide);
  animation: fadeIn 0.2s ease;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.peer-status-indicator[hidden] { display: none; }

.peer-status-indicator__dots {
  display: inline-flex;
}

.peer-status-indicator__dots::before {
  content: '···';
  animation: typingDots 1.2s steps(4, end) infinite;
  letter-spacing: 2px;
  font-size: 16px;
  line-height: 1;
  color: var(--color-accent);
}

.peer-status-indicator--voice .peer-status-indicator__dots::before {
  content: '🎤';
  animation: pulseGlow 1s ease infinite;
  font-size: 14px;
  letter-spacing: 0;
}

.peer-status-indicator--file .peer-status-indicator__dots::before {
  content: '📎';
  animation: pulseGlow 1.5s ease infinite;
  font-size: 14px;
  letter-spacing: 0;
}

.peer-status-indicator--photo .peer-status-indicator__dots::before {
  content: '📷';
  animation: pulseGlow 1.5s ease infinite;
  font-size: 14px;
  letter-spacing: 0;
}

@keyframes typingDots {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

/* === Photo picker (action sheet) === */

.photo-picker {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.photo-picker[hidden] { display: none; }

.photo-picker__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.photo-picker__sheet {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: var(--space-3);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.photo-picker__option {
  width: 100%;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.photo-picker__option:hover {
  background: var(--color-surface-2);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.photo-picker__cancel {
  width: 100%;
  padding: var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  margin-top: var(--space-1);
}

.photo-picker__cancel:hover {
  color: var(--color-text-2);
  border-color: var(--color-border-hover);
}

/* === Drag overlay === */

.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 229, 160, 0.08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px dashed var(--color-accent);
  animation: fadeIn 0.15s ease;
}

.drag-overlay[hidden] { display: none; }

.drag-overlay__content {
  text-align: center;
}

.drag-overlay__icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  color: var(--color-accent);
  animation: floatUp 1s ease infinite alternate;
}

@keyframes floatUp {
  from { transform: translateY(4px); }
  to { transform: translateY(-4px); }
}

.drag-overlay__text {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: var(--tracking-wide);
}

/* === Voice recording === */

.btn--recording {
  background: var(--color-error) !important;
  color: #fff !important;
  border-color: var(--color-error) !important;
  animation: pulseGlow 1s ease infinite;
}

/* === Audio/video preview === */

.received-item__media {
  display: block;
  width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  margin: var(--space-3) 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.received-item__audio {
  display: block;
  width: 100%;
  margin: var(--space-3) 0;
  height: 44px;
  border-radius: var(--radius-md);
  filter: invert(1) hue-rotate(180deg);
}

[data-theme="light"] .received-item__audio {
  filter: none;
}

/* === Markdown в сообщениях === */

.received-item__content a {
  color: var(--color-blue);
  text-decoration: underline;
  text-decoration-color: rgba(99, 136, 255, 0.3);
  transition: text-decoration-color var(--transition-fast);
  word-break: break-all;
}

.received-item__content a:hover {
  text-decoration-color: var(--color-blue);
}

.received-item__content .md-code {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--color-accent);
  word-break: break-all;
}

.received-item__content .md-code-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-2) 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.received-item__content .md-code-block code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text);
  line-height: var(--leading-loose);
  white-space: pre;
}

.received-item__content strong {
  font-weight: 700;
  color: var(--color-text);
}

.received-item__content em {
  font-style: italic;
  color: var(--color-text-2);
}

.received-item__content s {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

/* === Toast === */

.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 320px;
  width: calc(100vw - var(--space-8));
}

.toast {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  box-shadow: var(--shadow-md);
  animation: toastIn var(--transition-spring);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.toast::before {
  flex-shrink: 0;
  font-size: 14px;
}

.toast--success {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.toast--success::before { content: '✓'; }

.toast--error {
  border-color: var(--color-error);
  color: var(--color-error);
}

.toast--error::before { content: '✕'; }

.toast--info {
  border-color: var(--color-border-hover);
  color: var(--color-text-2);
}

.toast--info::before { content: '·'; }

.toast--warning {
  border-color: var(--color-warn);
  color: var(--color-warn);
}

.toast--warning::before { content: '⚠'; }

.toast--closing {
  animation: toastOut 0.2s ease forwards;
}

/* === Overlay + Spinner === */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.85);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn var(--transition-base);
}

.overlay[hidden] {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* === Мобильная адаптация компонентов === */

/* Tablet (481–768px) */
@media (max-width: 768px) {
  .specs {
    grid-template-columns: 1fr;
    max-width: 480px;
  }

  .onboarding-steps {
    flex-direction: column;
    gap: var(--space-1);
  }

  .onboarding-step__arrow {
    transform: rotate(90deg);
  }

  .hero {
    margin-bottom: var(--space-6);
  }

  .hero__subtitle {
    font-size: var(--text-xs);
  }

  .qr-canvas {
    width: 180px;
    height: 180px;
  }

  .card__actions {
    flex-wrap: wrap;
    justify-content: center;
  }

  .transfer-header__top {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .panel-actions .btn {
    width: 100%;
  }

  .connection-status__text {
    font-size: 10px;
  }
}

/* Mobile (<= 480px) */
@media (max-width: 480px) {
  .hero__title {
    font-size: 28px;
    letter-spacing: -1px;
  }

  /* B2: сжать hero на мобильном — subtitle убираем, отступ уменьшаем */
  .hero {
    margin-bottom: var(--space-3);
  }

  .hero__subtitle {
    display: none;
  }

  .card__instruction {
    display: none;
  }

  .input-group {
    flex-direction: column;
  }

  .input-group .btn {
    width: 100%;
  }

  .input--code {
    font-size: var(--text-lg);
    letter-spacing: var(--tracking-wider);
    padding: var(--space-3);
  }

  .card {
    padding: var(--space-5);
  }

  .card__actions {
    gap: var(--space-1);
  }

  .card__actions .btn--sm {
    padding: var(--space-1) var(--space-3);
    font-size: 10px;
  }

  .session-code__text {
    font-size: var(--text-xl);
    letter-spacing: 4px;
  }

  .qr-canvas {
    width: 160px;
    height: 160px;
  }

  .received-item--file .received-item__file { flex-wrap: wrap; }
  .received-item--file .btn { width: 100%; justify-content: center; margin-top: var(--space-2); }

  .drop-zone {
    padding: var(--space-6) var(--space-4);
  }

  .drop-zone__icon {
    font-size: 24px;
  }

  .textarea {
    min-height: 80px;
    font-size: var(--text-sm);
  }

  .spec {
    padding: var(--space-4);
  }

  .spec__desc {
    font-size: 9px;
  }

  .security-note {
    font-size: 10px;
    padding: var(--space-2) var(--space-3);
  }

  .timer__text {
    font-size: 10px;
  }

  .app-footer {
    flex-direction: column;
    gap: var(--space-1);
    font-size: 10px;
  }

  .toast-container {
    bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
    right: var(--space-3);
    left: var(--space-3);
    max-width: 100%;
  }

  .peer-info {
    font-size: 10px;
  }

  .received-item--sent { margin-left: var(--space-3); }
  .received-item:not(.received-item--sent) { margin-right: var(--space-3); }

  .received-item__photo {
    max-height: 200px;
  }

  .photo-overlay {
    padding: var(--space-3);
  }

  .photo-overlay__download {
    bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  }

  .photo-overlay__close {
    top: calc(var(--space-4) + env(safe-area-inset-top, 0px));
  }

  .panel-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .panel-actions .btn--accent {
    width: 100%;
    order: -1;
    margin-left: 0;
  }

}

/* Very small screens (<= 360px) */
@media (max-width: 360px) {
  .hero__title {
    font-size: 24px;
  }

  .session-code__text {
    font-size: var(--text-lg);
    letter-spacing: 3px;
  }

  .card__actions {
    flex-direction: column;
  }

  .card__actions .btn--sm {
    width: 100%;
  }
}

/* C6: увеличить touch target на тач-устройствах */
@media (hover: none) and (pointer: coarse) {
  .card__actions .btn--sm {
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
  }

  .btn--icon {
    min-width: 44px;
    min-height: 44px;
    font-size: 18px;
  }

  .compose-actions .btn--accent {
    min-width: 48px;
    min-height: 44px;
  }
}
