/* ============================================================
   MCAE 联机 - 全局样式
   暗色主题: #0f0f1a 背景, #e0e0e0 文字
   主色: #4fc3f7 蓝色
   ============================================================ */

/* ====== 基础重置 & 全局 ====== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: #0f0f1a;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
}

a {
  color: #4fc3f7;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

input:focus, button:focus {
  outline: none;
}

img {
  max-width: 100%;
}

/* ====== 滚动条 ====== */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(79, 195, 247, 0.3);
  border-radius: 2px;
}

/* ====== 通用容器 ====== */
#app {
  min-height: 100vh;
  background-color: #0f0f1a;
}

.page-container {
  min-height: calc(100vh - 60px);
  padding-bottom: 20px;
}

/* ====== 通用按钮 ====== */
.btn-primary {
  background: linear-gradient(135deg, #4fc3f7, #29b6f6);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 40px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(79, 195, 247, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-primary:active {
  opacity: 0.85;
  transform: scale(0.97);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(79, 195, 247, 0.1);
  color: #4fc3f7;
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 12px;
  padding: 14px 40px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-secondary:active {
  background: rgba(79, 195, 247, 0.2);
}
.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger {
  background: linear-gradient(135deg, #ef5350, #e53935);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 40px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-danger:active {
  opacity: 0.85;
  transform: scale(0.97);
}

.btn-large {
  width: 100%;
  height: 48px;
  font-size: 16px;
  border-radius: 16px;
}

.btn-small {
  padding: 10px 20px;
  font-size: 13px;
  height: auto;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-tiny {
  padding: 4px 10px;
  font-size: 11px;
  height: 25px;
  border-radius: 8px;
  white-space: nowrap;
}

/* Spinner inside button */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* ====== 卡片 ====== */
.card {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 16px;
  padding: 15px;
  margin: 0 10px 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(79, 195, 247, 0.1);
}

/* ====== 输入框 ====== */
.input-field {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 15px;
  font-size: 14px;
  color: #e0e0e0;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-field:focus {
  border-color: #4fc3f7;
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.1);
}
.input-field::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
.input-field.input-code {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 4px;
  font-family: monospace;
}

/* ====== 标签 ====== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.tag-green {
  background: rgba(76, 217, 100, 0.15);
  color: #4cd964;
}
.tag-yellow {
  background: rgba(240, 173, 78, 0.15);
  color: #f0ad4e;
}
.tag-red {
  background: rgba(221, 82, 77, 0.15);
  color: #dd524d;
}
.tag-blue {
  background: rgba(79, 195, 247, 0.15);
  color: #4fc3f7;
}

/* ====== 加载 Spinner ====== */
.loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(79, 195, 247, 0.1);
  border-top-color: #4fc3f7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ====== Toggle Switch (替代 uni-app switch) ====== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 24px;
  transition: background 0.3s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--toggle-color, #4fc3f7);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ====== Toast 通知 ====== */
.toast-container {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  color: #fff;
  background: rgba(30, 30, 50, 0.95);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  animation: toastIn 0.25s ease;
}
.toast.toast-success {
  border-left: 3px solid #4cd964;
}
.toast.toast-error {
  border-left: 3px solid #dd524d;
}
.toast.toast-none {
  border-left: 3px solid #4fc3f7;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ====== Modal 弹窗 ====== */
.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: 10000;
  animation: fadeIn 0.2s ease;
}
.modal-box {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 16px;
  padding: 24px;
  width: 85%;
  max-width: 340px;
  border: 1px solid rgba(79, 195, 247, 0.15);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}
.modal-body {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 20px;
  line-height: 1.6;
}
.modal-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: #e0e0e0;
  font-size: 14px;
  margin-bottom: 16px;
  box-sizing: border-box;
}
.modal-input:focus {
  border-color: #4fc3f7;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-btn {
  padding: 8px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}
.modal-btn:active { opacity: 0.8; }
.modal-btn.primary {
  background: #4fc3f7;
  color: #fff;
}
.modal-btn.cancel {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ====== 顶部导航栏 ====== */
.app-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(15, 15, 26, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  height: 50px;
}
.header-back {
  font-size: 24px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  padding: 4px 8px;
  margin-left: -8px;
  margin-right: 8px;
  user-select: none;
}
.header-back:active {
  opacity: 0.6;
}
.header-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  flex: 1;
}

/* ====== 底部标签栏 ====== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(15, 15, 26, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-around;
  backdrop-filter: blur(10px);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 16px;
  border: none;
  background: none;
  color: rgba(255,255,255,0.4);
  transition: color 0.2s;
}
.nav-item.active {
  color: #4fc3f7;
}
.nav-item:active {
  opacity: 0.7;
}
.nav-icon {
  font-size: 22px;
  line-height: 1;
}
.nav-label {
  font-size: 10px;
}

/* ====== 首页 - 欢迎页 ====== */
.welcome {
  position: relative;
  min-height: 100vh;
}
.welcome-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 50%, #0f0f1a 100%);
  z-index: 0;
}
.bg-grid {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(79, 195, 247, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 195, 247, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}
.welcome-content {
  position: relative;
  z-index: 1;
  padding: 60px 20px 30px;
}
.logo-section {
  text-align: center;
  margin-bottom: 40px;
}
.logo-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #4fc3f7, #0288d1);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
  box-shadow: 0 8px 40px rgba(79, 195, 247, 0.3);
}
.logo-text {
  font-size: 40px;
  font-weight: 800;
  color: #fff;
}
.app-name {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 8px;
}
.app-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}
.feature-list {
  margin-bottom: 30px;
}
.feature-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.feature-icon {
  font-size: 24px;
  margin-right: 12px;
}
.feature-info {
  flex: 1;
}
.feature-title {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
  display: block;
  margin-bottom: 2px;
}
.feature-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}
.action-buttons {
  padding: 0 10px;
}
.btn-icon {
  margin-right: 6px;
  font-size: 18px;
}
.agreement {
  text-align: center;
  margin-top: 15px;
  font-size: 12px;
}
.agree-text {
  color: rgba(255, 255, 255, 0.3);
}
.agree-link {
  color: #4fc3f7;
  margin: 0 2px;
}

/* ====== 首页 - 已登录 ====== */
.dashboard {
  padding: 15px;
}
.user-header {
  display: flex;
  align-items: center;
  padding: 15px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 20px;
  margin-bottom: 10px;
  border: 1px solid rgba(79, 195, 247, 0.1);
}
.user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #4fc3f7, #0288d1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
}
.avatar-text {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.user-info-text {
  flex: 1;
  min-width: 0;
}
.user-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  display: block;
  margin-bottom: 2px;
}
.user-status {
  font-size: 11px;
  color: #4cd964;
}
.user-level {
  padding: 4px 10px;
  background: rgba(79, 195, 247, 0.15);
  border-radius: 20px;
  cursor: pointer;
}
.level-text {
  font-size: 12px;
  color: #4fc3f7;
  font-weight: 600;
}

/* 跑马灯 */
.marquee {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: rgba(79, 195, 247, 0.05);
  border-radius: 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(79, 195, 247, 0.1);
}
.marquee-icon {
  font-size: 14px;
  margin-right: 6px;
  flex-shrink: 0;
}
.marquee-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 快捷入口 */
.quick-actions {
  display: flex;
  gap: 8px;
}
.action-card {
  flex: 1;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 16px;
  padding: 15px 10px;
  text-align: center;
  border: 1px solid rgba(79, 195, 247, 0.1);
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.action-card:active {
  transform: scale(0.97);
  opacity: 0.9;
}
.action-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}
.lan-icon { background: rgba(79, 195, 247, 0.15); }
.create-icon { background: rgba(76, 217, 100, 0.15); }
.join-icon { background: rgba(240, 173, 78, 0.15); }
.action-icon-text { font-size: 20px; }
.action-label {
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e0;
  display: block;
  margin-bottom: 2px;
}
.action-desc {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
}

/* 当前房间 */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
}
.room-mini-info {
  margin-bottom: 4px;
}
.room-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  display: block;
  margin-bottom: 2px;
}
.room-code {
  font-size: 12px;
  color: #4fc3f7;
  font-family: monospace;
}
.room-mini-players {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

/* ====== 登录页 ====== */
.login-page {
  padding: 30px 20px;
}
.login-header {
  margin-bottom: 30px;
}
.login-title {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 6px;
}
.login-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.4);
}

.login-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 3px;
  margin-bottom: 20px;
}
.tab-item {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s;
  user-select: none;
}
.tab-item:active { opacity: 0.7; }
.tab-item.active {
  background: #4fc3f7;
  color: #fff;
  font-weight: 600;
}

.login-form {
  margin-bottom: 20px;
}
.form-group {
  margin-bottom: 15px;
}
.form-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  display: block;
  margin-bottom: 6px;
}
.form-group-code {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.code-input-wrap {
  flex: 1;
}
.code-btn {
  height: 44px;
  padding: 0 12px;
  font-size: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.form-links {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}
.link {
  font-size: 13px;
  color: #4fc3f7;
  cursor: pointer;
}
.link:active { opacity: 0.7; }

.divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
}
.divider-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}
.divider-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
  padding: 0 12px;
}

.social-login {
  display: flex;
  justify-content: center;
}
.social-btn {
  display: flex;
  align-items: center;
  padding: 12px 30px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  color: #e0e0e0;
  cursor: pointer;
  transition: background 0.2s;
}
.social-btn:active { background: rgba(255,255,255,0.1); }
.social-btn.qq {
  border-color: rgba(79, 195, 247, 0.3);
}
.social-icon {
  font-size: 18px;
  margin-right: 6px;
}

/* ====== 个人中心 ====== */
.profile {
  padding: 15px;
}
.user-card {
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 20px;
  margin-bottom: 15px;
  border: 1px solid rgba(79, 195, 247, 0.1);
}
.user-avatar-lg {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #4fc3f7, #0288d1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  box-shadow: 0 4px 20px rgba(79, 195, 247, 0.3);
}
.user-name-lg {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 10px;
}
.user-level-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.level-tag {
  padding: 2px 8px;
  background: rgba(79, 195, 247, 0.15);
  color: #4fc3f7;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}
.exp-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}
.exp-fill {
  height: 100%;
  background: linear-gradient(90deg, #4fc3f7, #0288d1);
  border-radius: 4px;
  transition: width 0.3s;
}
.exp-text {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
}
.user-stats {
  display: flex;
  gap: 10px;
}
.stat-item {
  flex: 1;
  text-align: center;
}
.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 2px;
}
.stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

/* 菜单 */
.menu-section {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 16px;
  margin-bottom: 10px;
  border: 1px solid rgba(79, 195, 247, 0.1);
  overflow: hidden;
}
.menu-item {
  display: flex;
  align-items: center;
  padding: 14px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background 0.15s;
}
.menu-item:active { background: rgba(255,255,255,0.03); }
.menu-item:last-child { border-bottom: none; }
.menu-icon {
  font-size: 16px;
  margin-right: 10px;
}
.menu-text {
  flex: 1;
  font-size: 14px;
  color: #e0e0e0;
}
.menu-arrow {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.2);
}
.menu-left {
  display: flex;
  align-items: center;
  flex: 1;
}

.logout-section {
  text-align: center;
  padding: 20px 0;
}
.logout-btn {
  width: 60%;
  height: 40px;
  font-size: 14px;
  border-radius: 14px;
  margin-bottom: 10px;
}
.version-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.2);
  display: block;
}

/* ====== 联机大厅 ====== */
.lobby {
  padding: 10px;
}
.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.header-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.header-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.header-count {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}
.header-actions {
  display: flex;
  gap: 8px;
}
.refresh-icon {
  font-size: 14px;
  display: inline-block;
}
.refresh-icon.spinning {
  animation: spin 0.8s linear infinite;
}

/* 中继节点 */
.relay-bar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: rgba(79, 195, 247, 0.05);
  border-radius: 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(79, 195, 247, 0.1);
  cursor: pointer;
  user-select: none;
}
.relay-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-right: 8px;
}
.relay-status {
  margin-right: auto;
}
.relay-arrow {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  margin-left: 6px;
}
.relay-detail {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  margin: -4px 0 8px;
}
.relay-node {
  display: flex;
  align-items: center;
  padding: 4px 0;
  font-size: 11px;
}
.node-name {
  color: #4fc3f7;
  width: 60px;
}
.node-ping {
  color: #4cd964;
  width: 40px;
  text-align: right;
}
.node-location {
  color: rgba(255, 255, 255, 0.4);
  margin-left: 8px;
}

/* 搜索/过滤 */
.filter-bar {
  margin-bottom: 10px;
}
.search-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #e0e0e0;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
}
.search-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
.filter-tabs {
  display: flex;
  gap: 6px;
}
.filter-tab {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}
.filter-tab:active { opacity: 0.7; }
.filter-tab.active {
  background: #4fc3f7;
  color: #fff;
  font-weight: 600;
}

/* 房间列表 */
.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.room-card {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 16px;
  padding: 12px;
  border: 1px solid rgba(79, 195, 247, 0.1);
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.room-card:active {
  transform: scale(0.98);
  opacity: 0.9;
}
.room-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.room-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.room-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-players {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}
.room-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.room-host {
  display: flex;
  align-items: center;
  gap: 4px;
}
.host-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
}
.host-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}
.room-info {
  display: flex;
  gap: 6px;
}
.room-mode {
  font-size: 11px;
  color: #f0ad4e;
  background: rgba(240, 173, 78, 0.1);
  padding: 2px 6px;
  border-radius: 6px;
}
.room-version {
  font-size: 11px;
  color: #4fc3f7;
  background: rgba(79, 195, 247, 0.1);
  padding: 2px 6px;
  border-radius: 6px;
}
.room-card-footer {
  display: flex;
  justify-content: space-between;
}
.room-invite {
  font-size: 11px;
  color: #4fc3f7;
  font-family: monospace;
}
.room-created {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
}

/* 空状态 & 加载状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 0;
}
.empty-icon {
  font-size: 50px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-text {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 4px;
}
.empty-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
}
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 0;
}
.loading-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 10px;
}
.load-more {
  text-align: center;
  padding: 15px;
  cursor: pointer;
}
.load-more-text {
  font-size: 13px;
  color: #4fc3f7;
}

/* ====== 创建房间 ====== */
.create-room {
  padding: 15px;
}
.form-section {
  margin-bottom: 20px;
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #4fc3f7;
  display: block;
  margin-bottom: 12px;
  padding-left: 4px;
  border-left: 3px solid #4fc3f7;
  padding-left: 8px;
}
.form-tip {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 4px;
  display: block;
}
.select-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.select-item {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}
.select-item:active { opacity: 0.7; }
.select-item.active {
  background: rgba(79, 195, 247, 0.15);
  border-color: #4fc3f7;
  color: #4fc3f7;
  font-weight: 600;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.switch-row .form-label {
  margin-bottom: 0;
}

.form-actions {
  padding: 0 10px;
  margin-top: 30px;
}

/* ====== 房间详情 ====== */
.room-detail {
  padding: 10px;
  padding-bottom: 70px;
}

.room-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.room-title-wrap {
  flex: 1;
  min-width: 0;
}
.room-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 2px;
}
.room-code {
  font-size: 12px;
  color: #4fc3f7;
  font-family: monospace;
}
.room-status {
  flex-shrink: 0;
  margin-left: 8px;
}

.room-meta {
  display: flex;
  gap: 8px;
}
.meta-item {
  flex: 1;
  text-align: center;
  padding: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}
.meta-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  display: block;
  margin-bottom: 2px;
}
.meta-value {
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e0;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
}
.invite-hint {
  font-size: 12px;
  color: #4fc3f7;
  cursor: pointer;
}
.invite-hint:active { opacity: 0.7; }

/* VPN 详情 */
.vpn-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vpn-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vpn-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}
.vpn-value {
  font-size: 12px;
  color: #e0e0e0;
  font-family: monospace;
}

.vpn-progress {
  margin-top: 8px;
}
.progress-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4fc3f7, #0288d1);
  border-radius: 3px;
  transition: width 0.3s;
}
.progress-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

/* 玩家列表 */
.player-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.player-item {
  display: flex;
  align-items: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
}
.player-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  flex-shrink: 0;
}
.player-avatar-text {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.player-info {
  flex: 1;
  min-width: 0;
}
.player-name {
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e0;
  display: block;
  margin-bottom: 1px;
}
.player-ip {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  font-family: monospace;
}
.player-status {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-right: 6px;
  flex-shrink: 0;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}
.status-dot.online {
  background: #4cd964;
}
.status-text {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
}
.player-tag {
  font-size: 9px;
  padding: 1px 6px;
  margin-left: 4px;
}

/* MC 连接信息 */
.mc-connect-info {
  background: rgba(79, 195, 247, 0.05);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(79, 195, 247, 0.15);
}
.mc-title {
  font-size: 13px;
  font-weight: 600;
  color: #4fc3f7;
  display: block;
  margin-bottom: 8px;
}
.mc-address {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.mc-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}
.mc-value {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  font-family: monospace;
  cursor: pointer;
}
.mc-value:active { opacity: 0.7; }
.mc-tip {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  display: block;
  margin-top: 6px;
}

/* 操作按钮栏 */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 15px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: #0f0f1a;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 8px;
  z-index: 50;
}
.action-btn {
  flex: 1;
  height: 40px;
  font-size: 14px;
  border-radius: 14px;
}

.ping-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 10px;
}
.ping-value {
  color: #4cd964;
  font-weight: 600;
}

/* ====== 加入房间 ====== */
.invite-page {
  padding: 15px;
}
.invite-header {
  text-align: center;
  padding: 15px 0 20px;
}
.invite-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}
.invite-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 4px;
}
.invite-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
}

/* 房间预览 */
.room-preview {
  margin-top: 15px;
}
.preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.preview-item:last-child { border-bottom: none; }
.preview-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}
.preview-value {
  font-size: 13px;
  color: #e0e0e0;
  font-weight: 500;
}

/* ====== Loading 全屏遮罩 ====== */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 26, 0.7);
  z-index: 9998;
}
.loading-overlay .loading-spinner {
  width: 40px;
  height: 40px;
  border-width: 4px;
}
.loading-overlay .loading-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 12px;
}

/* ====== 响应式调整 ====== */
@media (max-width: 360px) {
  .room-name { max-width: 140px; }
  .action-card { padding: 10px 6px; }
}
