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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  background: #fff;
  padding: 12px 16px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-username {
  font-size: 0.8rem;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.logout-btn {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: none;
  border: 1px solid #ccc;
  border-radius: 8px;
  cursor: pointer;
  color: #555;
  white-space: nowrap;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: #f5f5f5;
}

#connection-status {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

#connection-status.connected {
  background: #d4edda;
  color: #155724;
}

#connection-status.disconnected {
  background: #f8d7da;
  color: #721c24;
}

#message-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message {
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.message .message-username {
  font-size: 0.75rem;
  font-weight: 600;
  color: #007bff;
  margin-bottom: 2px;
}

.message .content {
  font-size: 0.95rem;
  word-break: break-word;
}

.message .timestamp {
  font-size: 0.75rem;
  color: #888;
  margin-top: 4px;
}

.error-message {
  color: #721c24;
  background: #f8d7da;
  padding: 12px 14px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.9rem;
}

#input-area {
  background: #fff;
  padding: 12px 16px;
  border-top: 1px solid #ddd;
  flex-shrink: 0;
}

#input-area form {
  display: flex;
  gap: 8px;
}

#input-area input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
}

#input-area input[type="text"]:focus {
  border-color: #007bff;
}

#input-area button {
  padding: 10px 20px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
}

#input-area button:active {
  background: #0056b3;
}

/* ============================================================
   SUPER ADMIN PANEL
   ============================================================ */

.admin-toggle {
  position: fixed;
  bottom: 70px;
  right: 16px;
  font-size: 0.7rem;
  color: #aaa;
  text-decoration: none;
  z-index: 10;
}

.admin-toggle.hidden {
  display: none;
}

.admin-toggle:hover {
  color: #666;
}

.admin-panel {
  position: fixed;
  bottom: 90px;
  right: 16px;
  left: 16px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 20;
}

.admin-panel.hidden {
  display: none;
}

.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.admin-panel h2 {
  font-size: 0.95rem;
}

.admin-close {
  background: none;
  border: none;
  font-size: 1rem;
  color: #888;
  cursor: pointer;
  line-height: 1;
}

.admin-close:hover {
  color: #333;
}

.wipe-btn {
  width: 100%;
  padding: 10px 14px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.wipe-btn:active {
  background: #a71d2a;
}

.admin-status {
  font-size: 0.8rem;
  margin-top: 8px;
  min-height: 18px;
}

.admin-status.success {
  color: #155724;
}

.admin-status.error {
  color: #721c24;
}
