﻿

:root {
  
  --bg:           #fafbfc;
  --bg-secondary: #f3f4f6;
  --surface:      #ffffff;
  --surface-alt:  #f8f9fa;
  --border:       #e5e7eb;
  --border-light: #f0f1f3;
  --accent:       #2563eb;
  --accent-light: #dbeafe;
  --accent-dim:   rgba(37, 99, 235, 0.08);
  --success:      #10b981;
  --warning:      #f59e0b;
  --error:        #ef4444;
  --text:         #1f2937;
  --text-2:       #4b5563;
  --text-3:       #9ca3af;
  --text-4:       #d1d5db;
  --shadow-sm:    0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --mono:         'JetBrains Mono', monospace;
  --sans:         'Inter', sans-serif;
}

html[data-theme="dark"] {
  
  --bg:           #0f172a;
  --bg-secondary: #1e293b;
  --surface:      #1e293b;
  --surface-alt:  #334155;
  --border:       #334155;
  --border-light: #475569;
  --accent:       #3b82f6;
  --accent-light: #1e40af;
  --accent-dim:   rgba(59, 130, 246, 0.12);
  --success:      #34d399;
  --warning:      #fbbf24;
  --error:        #f87171;
  --text:         #f1f5f9;
  --text-2:       #cbd5e1;
  --text-3:       #94a3b8;
  --text-4:       #64748b;
  --shadow-sm:    0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md:    0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg:    0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}





* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  transition: background-color 0.3s, color 0.3s;
}





#loading {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.load-logo {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.load-logo span {
  color: var(--accent);
}

.load-bar-bg {
  width: 280px;
  height: 3px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.load-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  width: 0;
  border-radius: 3px;
  animation: fillBar 3s ease-out forwards;
}

@keyframes fillBar {
  to {
    width: 100%;
  }
}

.load-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 320px;
  font-family: var(--mono);
  font-size: 12px;
}

.load-step {
  color: var(--text-3);
  padding: 6px 12px 6px 28px;
  position: relative;
  border-radius: 4px;
  transition: all 0.2s;
}

.load-step::before {
  content: '○';
  position: absolute;
  left: 8px;
  opacity: 0.5;
}

.load-step.done {
  color: var(--success);
}

.load-step.done::before {
  content: '✓';
  color: var(--success);
}

.load-step.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.load-step.active::before {
  content: '▶';
  color: var(--accent);
}





#app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  display: none;
}





.hdr {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.hdr-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.hdr-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.hdr-logo span {
  color: var(--accent);
}

.hdr-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--success);
}

.hdr-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hdr-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
  color: var(--text-2);
}

.theme-toggle:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
  color: var(--accent);
}





.info-banner {
  background: var(--accent-dim);
  border-bottom: 1px solid var(--accent);
  padding: 10px 24px;
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.info-banner a, .info-banner button {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  border: none;
  background: transparent;
  font-size: 12px;
}

.info-banner a:hover, .info-banner button:hover {
  text-decoration: underline;
}





.body-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}





.sidebar {
  width: 300px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

.sb-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sb-section:last-child {
  border-bottom: none;
  margin-top: auto;
}

.sb-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-3);
  margin-bottom: 14px;
  font-family: var(--mono);
}


.identity-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.identity-label {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.identity-value {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  word-break: break-all;
  line-height: 1.6;
  padding: 6px 0;
  user-select: all;
  cursor: copy;
  background: var(--surface);
  padding: 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.identity-ttl {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.ttl-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.ttl-fill {
  height: 100%;
  background: var(--accent);
  transition: width 1s linear;
  border-radius: 2px;
}

.ttl-text {
  color: var(--text-3);
  font-family: var(--mono);
  white-space: nowrap;
}


.connection-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.form-group input {
  flex: 1;
}

.form-group button {
  white-space: nowrap;
}





.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--text-3);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
}

.field:focus {
  border-color: var(--accent);
  background: var(--bg-secondary);
}

.field::placeholder {
  color: var(--text-3);
}





.security-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
}

.badge-blue {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-green {
  border-color: #10b98130;
  background: rgba(16, 185, 129, 0.08);
  color: var(--success);
}

.badge-warning {
  border-color: #f59e0b30;
  background: rgba(245, 158, 11, 0.08);
  color: var(--warning);
}





.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.chat-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chat-peer-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.peer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent);
  font-size: 14px;
}

.peer-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.peer-name {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.peer-status {
  font-size: 12px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
}

.peer-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.chat-actions {
  display: flex;
  gap: 8px;
}


.no-peer-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
}

.no-peer-icon {
  font-size: 56px;
  margin-bottom: 20px;
  opacity: 0.6;
}

.no-peer-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.no-peer-text {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 32px;
  max-width: 500px;
  line-height: 1.7;
}

.setup-steps {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  max-width: 500px;
  text-align: left;
}

.step-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.6;
}

.step-item:last-child {
  border-bottom: none;
}

.step-number {
  font-weight: 700;
  color: var(--accent);
  min-width: 24px;
  font-family: var(--mono);
}





.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.message {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.message.own {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 70%;
  padding: 12px 14px;
  border-radius: 10px;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
}

.message:not(.own) .message-bubble {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
}

.message.own .message-bubble {
  background: var(--accent);
  color: white;
  border-radius: 10px 10px 2px 10px;
}

.message-time {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  font-family: var(--mono);
}





.input-area {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 20px;
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.msg-input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  transition: border-color 0.2s;
}

.msg-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.msg-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.msg-input::placeholder {
  color: var(--text-3);
}

.btn-send {
  height: 40px;
  padding: 0 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-send:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-send:disabled {
  background: var(--border);
  color: var(--text-3);
  cursor: not-allowed;
}

.btn-media {
  height: 40px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-media:hover:not(:disabled) {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-media:disabled {
  background: var(--border);
  color: var(--text-3);
  cursor: not-allowed;
}

.media-preview {
  display: block;
  margin-top: 4px;
}

#media-preview-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
}

#media-preview-content {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

#media-preview-cancel {
  height: 32px;
  width: 32px;
  background: var(--error);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

#media-preview-send {
  height: 32px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

#media-preview-send:hover {
  background: #1d4ed8;
}





#overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

#overlay.on {
  display: flex;
}

.popup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.popup-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.popup-body {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 20px;
  line-height: 1.7;
}

.popup-id {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 16px;
  word-break: break-all;
}

.fp-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.fp-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 8px;
  font-weight: 600;
}

.fp-value {
  background: var(--surface);
  padding: 10px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  word-break: break-all;
  margin-bottom: 12px;
  padding: 10px;
}

.fp-verify {
  width: 100%;
}

.popup-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}





.notif {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  max-width: 350px;
  animation: slideIn 0.3s ease-out;
  display: none;
}

.notif.show {
  display: block;
}

.notif.success {
  border-left: 4px solid var(--success);
  color: var(--success);
}

.notif.error {
  border-left: 4px solid var(--error);
  color: var(--error);
}

.notif.info {
  border-left: 4px solid var(--accent);
  color: var(--accent);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}





::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}





@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: auto;
    max-height: 45%;
    overflow-y: auto;
  }

  .body-layout {
    flex-direction: column-reverse;
  }

  .message-bubble {
    max-width: 90%;
  }

  .chat-header {
    padding: 12px 16px;
  }

  .chat-main {
    flex: 1.5;
  }

  .hdr {
    padding: 0 16px;
    height: 48px;
    flex-wrap: wrap;
  }

  .hdr-logo {
    font-size: 14px;
  }

  .hdr-right {
    flex: 1;
    justify-content: flex-end;
  }

  .btn {
    padding: 12px 18px;
    font-size: 14px;
    min-height: 44px;
  }

  .field {
    padding: 12px 14px;
    font-size: 16px;
    min-height: 44px;
  }

  .msg-input {
    font-size: 15px;
    padding: 10px 12px;
    min-height: 40px;
  }

  .btn-send {
    min-height: 44px;
    min-width: 44px;
    padding: 0 16px;
  }

  .popup {
    padding: 24px;
    width: 95%;
  }

  .no-peer-state {
    padding: 40px 20px;
  }

  .setup-steps {
    max-width: 100%;
    padding: 16px;
  }
}





@media (max-width: 480px) {
  * {
    -webkit-user-select: none;
    user-select: none;
  }

  input, textarea {
    -webkit-user-select: text;
    user-select: text;
  }

  body {
    font-size: 15px;
  }

  #app {
    height: 100vh;
  }

  .hdr {
    padding: 0 12px;
    height: 44px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .hdr-left {
    gap: 8px;
  }

  .hdr-logo {
    font-size: 12px;
    letter-spacing: 0.08em;
  }

  .hdr-status {
    font-size: 12px;
    gap: 4px;
  }

  .hdr-time {
    font-size: 11px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    font-size: 16px;
    padding: 0;
  }

  .sidebar {
    max-height: 50%;
    overflow-y: auto;
    order: 2;
  }

  .chat-main {
    flex: 1;
    order: 1;
  }

  .body-layout {
    gap: 0;
    padding: 0;
  }

  .sb-section {
    padding: 14px;
  }

  .sb-title {
    font-size: 10px;
    margin-bottom: 10px;
  }

  .identity-section, .connection-panel {
    padding: 12px;
  }

  .identity-value {
    font-size: 10px;
    padding: 6px;
  }

  .btn {
    padding: 12px 14px;
    font-size: 13px;
    min-height: 44px;
    min-width: 44px;
    border-radius: 6px;
  }

  .btn-primary, .btn-secondary, .btn-danger {
    width: 100%;
  }

  .field {
    padding: 12px 12px;
    font-size: 16px;
    min-height: 44px;
    border-radius: 6px;
  }

  .msg-input {
    font-size: 16px;
    padding: 10px 12px;
    min-height: 40px;
    border-radius: 6px;
  }

  .msg-input::placeholder {
    font-size: 14px;
  }

  .btn-send {
    min-height: 44px;
    min-width: 44px;
    padding: 0 14px;
    border-radius: 6px;
  }

  .input-area {
    padding: 12px 12px;
    gap: 8px;
  }

  .chat-header {
    padding: 12px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .chat-peer-info {
    gap: 10px;
    width: 100%;
  }

  .peer-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .peer-name {
    font-size: 13px;
  }

  .peer-status {
    font-size: 11px;
  }

  .chat-actions {
    width: 100%;
  }

  .messages {
    padding: 12px;
    gap: 8px;
  }

  .message-bubble {
    max-width: 85%;
    padding: 10px 12px;
    font-size: 13px;
  }

  .message-time {
    font-size: 10px;
  }

  .no-peer-state {
    padding: 30px 16px;
  }

  .no-peer-icon {
    font-size: 40px;
    margin-bottom: 16px;
  }

  .no-peer-title {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .no-peer-text {
    font-size: 13px;
    margin-bottom: 20px;
  }

  .setup-steps {
    max-width: 100%;
    padding: 14px;
  }

  .step-item {
    padding: 10px 0;
    font-size: 13px;
    gap: 8px;
  }

  .popup {
    padding: 20px;
    width: 96%;
    border-radius: 12px;
    max-width: 100%;
  }

  .popup-title {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .popup-body {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .popup-id {
    font-size: 11px;
    padding: 10px;
  }

  .fp-section {
    padding: 12px;
  }

  .fp-label {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .fp-value {
    font-size: 10px;
    padding: 8px;
  }

  .popup-actions {
    flex-direction: column;
    gap: 10px;
  }

  .popup-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .notif {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
    font-size: 12px;
    padding: 12px 14px;
  }

  #loading {
    gap: 24px;
  }

  .load-logo {
    font-size: 20px;
  }

  .load-bar-bg {
    width: 200px;
    height: 2px;
  }

  .load-steps {
    min-width: 280px;
    font-size: 11px;
  }

  .load-step {
    padding: 6px 10px 6px 24px;
    font-size: 12px;
  }

  #captcha {
    padding: 20px;
  }

  #captcha-canvas {
    width: 100% !important;
    height: auto !important;
    max-width: 280px;
    border-radius: 6px;
  }

  #cap-input {
    width: 100% !important;
    max-width: 280px;
    font-size: 16px;
    padding: 12px;
    min-height: 44px;
  }

  .badge {
    font-size: 9px;
    padding: 3px 8px;
  }

  .security-badges {
    gap: 4px;
  }
}





@media (max-width: 360px) {
  .hdr {
    height: 40px;
    padding: 0 8px;
  }

  .hdr-logo {
    font-size: 11px;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .popup {
    padding: 16px;
  }

  .btn {
    padding: 10px 12px;
    font-size: 12px;
  }

  .field, .msg-input {
    padding: 10px 10px;
    font-size: 16px;
  }
}





@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --accent: #0033cc;
    --success: #008000;
    --error: #cc0000;
  }
}





.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


.btn-file {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-file:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.btn-file:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-sm:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.btn-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#file-preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
}

#file-preview-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

#file-preview-cancel,
#file-preview-send {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

#file-preview-send {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.file-preview-icon {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
}

.file-msg-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  min-width: 220px;
}

.file-msg-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mono);
  flex-shrink: 0;
}

.file-msg-info {
  flex: 1;
  min-width: 0;
}

.file-msg-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-msg-size {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

.btn-file-dl {
  padding: 5px 12px;
  font-size: 11px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  flex-shrink: 0;
}

.btn-file-dl:hover {
  opacity: 0.85;
}

.snowflake-status {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
}

.snowflake-status.active {
  color: var(--success, #22c55e);
}

.blind-indicator,
.pow-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success, #22c55e);
  flex-shrink: 0;
}
.tuto-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 15px;
  font-weight: bold;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}
.tuto-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
#tuto-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
#tuto-overlay.on {
  display: flex;
}
.tuto-popup {
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}
.tuto-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}
.tuto-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.tuto-num {
  background: var(--accent);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.tuto-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.tuto-step-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.65;
}

.tuto-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 15px;
  font-weight: bold;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}
.tuto-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
#tuto-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
#tuto-overlay.on {
  display: flex;
}
.tuto-popup {
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}
.tuto-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}
.tuto-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.tuto-num {
  background: var(--accent);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.tuto-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.tuto-step-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.65;
}
