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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 28px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 500px;
  text-align: center;
}

h1 {
  font-size: 26px;
  margin-bottom: 4px;
  color: #333;
}

.subtitle {
  color: #666;
  margin-bottom: 28px;
  font-size: 14px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
}

input[type='text'],
input[type='password'] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 16px;
  transition: border-color 0.3s;
}

input[type='text']:focus,
input[type='password']:focus {
  outline: none;
  border-color: #667eea;
}

.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  margin-top: 32px;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-sm {
  width: auto;
  padding: 6px 14px;
  font-size: 12px;
  flex-shrink: 0;
}

.error {
  color: #e74c3c;
  margin-top: 16px;
  padding: 12px;
  background: #fee;
  border-radius: 8px;
  font-size: 14px;
  display: none;
}

.error-banner {
  background: #fee;
  color: #e74c3c;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}

/* Room page */
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.head h1 {
  font-size: 22px;
  margin: 0;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ccc;
}

.dot.online {
  background: #2ecc71;
  box-shadow: 0 0 6px #2ecc71;
}

#status-text {
  font-size: 13px;
  color: #666;
}

.save-dir {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 16px;
  padding: 8px 14px;
  background: #f0f7ff;
  border-radius: 8px;
  font-size: 12px;
  color: #555;
  word-break: break-all;
}

#save-dir-path {
  flex: 1;
  text-align: left;
}

.share-section {
  margin: 18px 0 20px;
}

.share-section .label {
  margin-bottom: 12px;
}

.share-row {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: center;
}

#qrcode {
  border: 1px solid #eee;
  border-radius: 8px;
  flex-shrink: 0;
}

.share-right {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  max-width: 300px;
}

.share-right .label {
  margin: 0;
  align-self: flex-start;
}

.link-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.link-box input {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 0;
}

.link-box .btn {
  width: 100%;
  padding: 8px;
  font-size: 13px;
}

.receive-section {
  margin-top: 18px;
  text-align: left;
}

.receive-section h3 {
  font-size: 15px;
  margin-bottom: 10px;
  color: #333;
}

/* Join page */
#waiting {
  margin: 20px 0;
}

#waiting p {
  margin: 8px 0;
}

#transfer-area {
  margin-top: 24px;
  display: none;
}

.drop-zone {
  border: 2px dashed #ccc;
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #fafafa;
}

.drop-zone:hover {
  border-color: #667eea;
  background: #f0f7ff;
}

.drop-zone p {
  color: #666;
  margin: 0;
}

.dir-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.dir-info {
  font-size: 13px;
  color: #667eea;
}

#progress-container {
  margin-top: 20px;
  display: none;
}

#progress-text {
  text-align: center;
  margin-top: 8px;
  color: #666;
}

#host-left {
  text-align: center;
  padding: 20px;
}

/* File list */
.file-item {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 6px;
}

.file-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.file-name {
  font-weight: 500;
  color: #333;
  word-break: break-all;
  font-size: 13px;
}

.file-size {
  color: #999;
  font-size: 11px;
  flex-shrink: 0;
  margin-left: 8px;
}

.file-status {
  font-size: 11px;
  color: #667eea;
  display: inline;
}

.file-speed {
  font-size: 10px;
  color: #aaa;
  margin-left: 8px;
  display: inline;
}

.text-link {
  color: #667eea;
  cursor: pointer;
  font-size: 11px;
  margin-left: 8px;
}

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

.progress-bar {
  height: 1px;
  margin-top: 3px;
  margin-bottom: 0;
  background: #e0e0e0;
  border-radius: 1px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  transition: width 0.2s;
  background: #667eea;
  border-radius: 1px;
}

.progress-fill.done {
  background: #2ecc71;
}

.progress-fill.error {
  background: #e74c3c;
}

#file-list {
  margin-top: 10px;
}

.empty {
  color: #999;
  text-align: center;
  padding: 16px;
  font-size: 13px;
}

@media (max-width: 480px) {
  .card {
    padding: 20px 18px;
  }
  h1 {
    font-size: 22px;
  }
}