:root {
  --primary-bg: #F7F9FA;
  --secondary-bg: #FFFFFF;
  --accent: #1D9BF0;
  --accent-hover: #1A8CD8;
  --text-primary: #0F1419;
  --text-secondary: #536471;
  --border: #EFF3F4;
  --danger: #F4212E;
  --success: #00BA7C;
  --shadow: rgba(0, 0, 0, 0.08);
}

.dark {
  --primary-bg: #15202B;
  --secondary-bg: #192734;
  --accent: #1D9BF0;
  --accent-hover: #1A8CD8;
  --text-primary: #E7E9EA;
  --text-secondary: #71767B;
  --border: #38444D;
  --danger: #F4212E;
  --success: #00BA7C;
  --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--primary-bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s, color 0.2s;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--secondary-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}

.header-content {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 53px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.icon-btn:hover {
  background-color: var(--border);
}

.icon {
  width: 20px;
  height: 20px;
}

.main {
  flex: 1;
  padding: 24px 16px;
}

.container {
  max-width: 600px;
  margin: 0 auto;
}

.hero {
  text-align: center;
  margin-bottom: 32px;
}

.title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

.card {
  background-color: var(--secondary-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

.format-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.radio-label:has(input:checked) {
  background-color: var(--accent);
  border-color: var(--accent);
  color: white;
}

.radio-label input {
  display: none;
}

.code-display {
  margin-bottom: 16px;
}

.code-box {
  background-color: var(--primary-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.code-text {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 14px;
  word-break: break-all;
  line-height: 1.5;
}

.code-actions {
  display: flex;
  gap: 8px;
}

.warning-text {
  margin-top: 8px;
  font-size: 13px;
  color: var(--danger);
}

.divider {
  text-align: center;
  margin: 24px 0;
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background-color: var(--border);
}

.divider span {
  background-color: var(--primary-bg);
  padding: 0 16px;
  color: var(--text-secondary);
  font-size: 14px;
  position: relative;
}

.input-group {
  margin-bottom: 16px;
}

.input, .textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--primary-bg);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  resize: none;
}

.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

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

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--text-secondary);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
}

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

.btn-lg {
  width: 100%;
  padding: 12px 24px;
  font-size: 16px;
}

.btn-sm {
  padding: 6px 16px;
  font-size: 14px;
}

.status-card {
  text-align: center;
  padding: 48px 24px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.status-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.status-text {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.error-icon {
  width: 48px;
  height: 48px;
  color: var(--danger);
  margin-bottom: 16px;
}

.status-card.error .status-title {
  color: var(--danger);
}

.connection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

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

.file-section {
  margin-bottom: 20px;
}

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.file-drop:hover, .file-drop.drag-over {
  border-color: var(--accent);
  background-color: rgba(29, 155, 240, 0.05);
}

.file-input {
  display: none;
}

.upload-icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
  margin-bottom: 12px;
}

.drop-text {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

.drop-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

.file-queue, .received-section {
  margin-top: 20px;
}

.queue-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: var(--primary-bg);
  border-radius: 8px;
  margin-bottom: 8px;
}

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

.file-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  font-size: 13px;
  color: var(--text-secondary);
}

.file-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background-color: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--accent);
  transition: width 0.3s;
}

.progress-text {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: right;
}

.file-status {
  font-size: 16px;
}

.file-status.complete {
  color: var(--success);
}

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

.file-item.received {
  justify-content: space-between;
}

.footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.link {
  color: var(--accent);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.hint-text {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 12px;
}

.listening-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

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

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal {
  background: var(--secondary-bg);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  position: relative;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}

.modal-text {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.qr-modal {
  text-align: center;
}

.qr-container {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.qr-container img {
  border-radius: 8px;
}

.link-box {
  margin-bottom: 16px;
}

.link-box .input {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
}

.warning-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #f59e0b;
  color: #000;
  padding: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
}

.relay-badge {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 4px;
}

.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

@media (max-width: 480px) {
  .title {
    font-size: 24px;
  }
  
  .format-options {
    flex-direction: column;
  }
  
  .radio-label {
    justify-content: center;
  }
  
  .modal-actions {
    flex-direction: column;
  }
}
