* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  height: 100vh;
  overflow: hidden;
}
.screen { display: none; padding: 20px; height: 100vh; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

#landing h1 { margin-bottom: 10px; color: #333; }
#landing .subtitle { color: #666; font-size: 15px; margin-bottom: 30px; }
#landing .buttons { display: flex; gap: 20px; }

button {
  padding: 12px 28px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background: #007bff;
  color: white;
  cursor: pointer;
}
button:hover { background: #0056b3; }
button:disabled { background: #ccc; cursor: not-allowed; }
button.primary { background: #28a745; }
button.primary:hover { background: #218838; }

.link-btn {
  background: none;
  color: #666;
  font-size: 14px;
  padding: 8px 16px;
}
.link-btn:hover { background: none; color: #333; text-decoration: underline; }

.icon-btn {
  background: #e9ecef;
  color: #333;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
}
.icon-btn:hover { background: #dee2e6; }

.room-id-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}
.room-id {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 4px;
  color: #333;
  background: #fff;
  border: 2px dashed #007bff;
  border-radius: 8px;
  padding: 10px 24px;
}

.input-group {
  width: 100%;
  max-width: 300px;
}
.input-group input {
  width: 100%;
  padding: 12px 16px;
  font-size: 18px;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 2px solid #ddd;
  border-radius: 8px;
  outline: none;
}
.input-group input:focus { border-color: #007bff; }

.code-box {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  font-family: monospace;
  font-size: 13px;
  word-break: break-all;
  max-width: 500px;
  width: 100%;
  margin: 10px 0;
  max-height: 120px;
  overflow-y: auto;
}
textarea {
  width: 100%;
  max-width: 500px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
}
.status { margin-top: 10px; color: #666; font-size: 14px; }
.status.error { color: #dc3545; }
.status.success { color: #28a745; }

#create-room, #join-room { gap: 10px; }
#create-room h2, #join-room h2 { margin-bottom: 10px; }

#chat-room { padding: 0; }
#chat-room header {
  background: #007bff;
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#chat-layout { display: flex; flex: 1; overflow: hidden; }
#member-list {
  width: 180px;
  background: #fff;
  border-right: 1px solid #ddd;
  padding: 15px;
  overflow-y: auto;
}
#member-list h3 { font-size: 14px; margin-bottom: 10px; color: #666; }
#member-list ul { list-style: none; }
#member-list li {
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
}
#chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #fafafa;
}
#input-area {
  display: flex;
  padding: 12px 15px;
  background: #fff;
  border-top: 1px solid #ddd;
  gap: 8px;
}
#msg-input { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
#btn-attach { background: #6c757d; padding: 10px 14px; }
#btn-send { padding: 10px 24px; }

.msg {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 70%;
  word-break: break-word;
}
.msg.me { background: #007bff; color: white; margin-left: auto; }
.msg.other { background: white; border: 1px solid #e0e0e0; }
.msg .sender { font-size: 12px; opacity: 0.7; margin-bottom: 4px; }
.msg .time { font-size: 11px; opacity: 0.5; margin-top: 4px; text-align: right; }

.file-msg {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  max-width: 70%;
}
.file-msg.me { margin-left: auto; background: #e3f2fd; }
.file-msg .filename { font-weight: 500; margin-bottom: 6px; }
.file-msg .filesize { font-size: 12px; color: #666; margin-bottom: 8px; }
.file-msg .progress-bar {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}
.file-msg .progress-bar .fill {
  height: 100%;
  background: #007bff;
  transition: width 0.3s;
}
.file-msg .actions { margin-top: 8px; }
.file-msg .actions a, .file-msg .actions button {
  font-size: 13px;
  padding: 4px 12px;
  text-decoration: none;
  display: inline-block;
}

#qrcode { margin: 10px 0; padding: 10px; background: white; border-radius: 8px; }
.hidden { display: none !important; }
