:root {
  --primary: #4285F4;
  --text: #1d212b;
  --text-secondary: #565c6b;
  --text-light: #8a8f9f;
  --bg-message-self: #4285F4;
  --bg-message-other: #ffffff;
  --transition-duration: 0.25s;
  --transition-easing: cubic-bezier(0.2, 0.9, 0.4, 1.1);
  --card-animation: fadeSlideUp 0.35s var(--transition-easing);
  --form-switch-animation: fadeSlide 0.3s var(--transition-easing);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Microsoft YaHei", sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: #f5f7fa;
  font-size: 13px;
}

.page {
  display: none;
  width: 100%;
  height: 100%;
}

.show {
  display: block !important;
}

.video-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

#auth-page {
  position: relative;
  background: transparent;
}

#auth-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: -1;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateX(15px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes gentleShake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

.announcement-toast {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: white;
  padding: 8px 20px;
  border-radius: 40px;
  font-size: 13px;
  z-index: 101;
  white-space: normal;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  animation: slideDownFade 0.3s ease forwards;
}

@keyframes slideDownFade {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.auth-container {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  animation: var(--card-animation);
}

.auth-banner {
  width: 100%;
  display: block;
}

.auth-banner img {
  width: 100%;
  height: auto;
  display: block;
}

.auth-title-img {
  width: 100%;
  padding: 16px 20px 8px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: white;
}

.auth-title-img img {
  max-width: 100%;
  height: auto;
  max-height: 50px;
  object-fit: contain;
}

.auth-form-container {
  padding: 0 20px 20px 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form.switch-out {
  animation: fadeSlideOut 0.2s forwards;
}

.auth-form.switch-in {
  animation: var(--form-switch-animation);
}

@keyframes fadeSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-15px);
    display: none;
  }
}

.form-subtitle {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
  text-align: left;
  padding-left: 4px;
  font-weight: 400;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.input-group input {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}

.toggle-pwd {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 24px;
  height: 24px;
  transition: transform 0.15s;
  color: #888;
  font-size: 18px;
}

.toggle-pwd:active {
  transform: scale(0.9);
}

.toggle-pwd i {
  font-size: 18px;
}

.toggle-pwd .eye-closed {
  display: none;
}

.auth-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 4px;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}

.auth-btn:hover {
  background: #2b6ed7;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.auth-btn:active {
  transform: translateY(1px);
}

.switch-link {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 8px;
}

.switch-link a {
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}

.switch-link a:hover {
  color: #2b6ed7;
  text-decoration: underline;
}

.error-msg {
  color: #d32f2f;
  font-size: 11px;
  text-align: center;
  margin-top: 4px;
  animation: gentleShake 0.3s ease;
}

.hidden-form {
  display: none;
}

.header {
  width: 100%;
  height: 48px;
  background: #4285F4;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.title {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.online-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.online-count:hover {
  background: rgba(255, 255, 255, 0.3);
}

.online-count i {
  font-size: 14px;
}

.btn {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.sidebar {
  position: fixed;
  top: 48px;
  left: -260px;
  width: 260px;
  height: calc(100% - 48px);
  background: #ffffff;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.06);
  z-index: 99;
  transition: left 0.25s var(--transition-easing);
  padding: 20px 16px;
}

.sidebar.show {
  left: 0;
}

.sidebar h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 12px;
}

.sidebar h3 i {
  font-size: 18px;
  color: var(--primary);
}

.sidebar .menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 8px 0;
  padding: 10px 12px;
  background: #f8f9fc;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 450;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  text-align: left;
}

.sidebar .menu-item i {
  font-size: 18px;
  color: var(--primary);
  width: 22px;
  text-align: center;
}

.sidebar .menu-item:hover {
  background: #eef2f7;
  color: var(--text);
  transform: translateX(2px);
}

.sidebar .menu-item:active {
  transform: scale(0.98);
}

.sidebar .footer-note {
  margin-top: 32px;
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  border-top: 1px solid #f0f0f0;
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sidebar .footer-note i {
  font-size: 12px;
}

.online-sidebar {
  position: fixed;
  top: 48px;
  left: -280px;
  width: 280px;
  height: calc(100% - 48px);
  background: #ffffff;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.06);
  z-index: 98;
  transition: left 0.25s var(--transition-easing);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
}

.online-sidebar.show {
  left: 0;
}

.online-sidebar h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 12px;
}

.online-sidebar h3 i {
  font-size: 18px;
  color: var(--primary);
}

.online-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 16px;
}

.online-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  margin: 4px 0;
  transition: background 0.2s;
}

.online-user i {
  font-size: 18px;
  color: var(--primary);
  width: 24px;
  text-align: center;
}

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

.online-user.self .username {
  color: var(--primary);
  font-weight: 500;
}

.online-footer {
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
}

.chat-bg {
  position: fixed;
  top: 48px;
  left: 0;
  width: 100%;
  bottom: 0;
  z-index: -1;
  overflow: hidden;
}

.chat-bg img, .chat-bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-box {
  position: absolute;
  left: 0;
  right: 0;
  top: 48px;
  bottom: 110px;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  padding: 0 12px;
  background: transparent;
}

.reply-card-wrapper {
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e9ecef;
  padding: 8px 12px;
  transition: transform 0.2s;
  z-index: 97;
}

.reply-card {
  background: #f8f9fc;
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reply-content {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reply-content strong {
  font-weight: 500;
  color: var(--primary);
}

.reply-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #a0a8b5;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.reply-close:hover {
  background: #e9ecef;
}

.reply-close:active {
  transform: scale(0.9);
}

.msg {
  margin: 8px 0;
  max-width: 80%;
}

.msg.left {
  align-self: flex-start;
}

.msg.right {
  align-self: flex-end;
  text-align: right;
  margin-left: auto;
}

.msg .tag {
  font-size: 9px;
  margin: 0 4px;
  line-height: 1;
  font-weight: bold;
}

.tag.official {
  color: #ffc107;
}

.tag.normal {
  color: #4285F4;
}

.reply-block {
  background: rgba(0, 0, 0, 0.05);
  border-left: 3px solid var(--primary);
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  font-size: 11px;
  color: #6c757d;
  text-align: left;
}

.reply-header {
  font-weight: 500;
  margin-bottom: 2px;
  color: var(--text-secondary);
}

.reply-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg.right .reply-block {
  text-align: left;
  background: rgba(255, 255, 255, 0.2);
  border-left-color: #ffd966;
}

.msg.right .reply-header {
  color: #e0e0e0;
}

.message-sender {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0 3px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 5px;
}

.msg.right .message-sender {
  color: var(--primary);
  justify-content: flex-end;
}

.user-title-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.3;
  color: #fff;
  white-space: nowrap;
  cursor: default;
  vertical-align: middle;
}

.user-title-badge.clickable {
  cursor: pointer;
  transition: transform 0.1s;
}

.user-title-badge.clickable:active {
  transform: scale(0.96);
}

.msg .content {
  padding: 8px 12px;
  border-radius: 10px;
  display: inline-block;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  font-size: 13px;
  line-height: 1.45;
}

.msg.right .content {
  background: #4285F4;
  color: white;
}

.msg .time {
  font-size: 10px;
  color: #999;
  margin: 3px 6px;
  line-height: 1;
}

.msg.system {
  max-width: 90%;
  text-align: center;
  margin: 8px auto;
}

.msg.system .system-content {
  display: inline-block;
  background: #f0f2f5;
  color: #6c757d;
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 20px;
  line-height: 1.4;
  box-shadow: none;
}

.send-box {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: white;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-top: 1px solid #e0e0e0;
  gap: 8px;
}

.send-box input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  transition: border 0.2s, box-shadow 0.2s;
}

.send-box input:focus {
  border-color: #4285F4;
  outline: none;
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}

.send-box button {
  flex-shrink: 0;
  width: 60px;
  height: 40px;
  background: #4285F4;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.send-box button:hover {
  background: #2b6ed7;
}

.send-box button:active {
  transform: scale(0.96);
}

.send-box button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.fb-box, .about-box {
  width: 90%;
  max-width: 300px;
  background: white;
  padding: 20px;
  border-radius: 12px;
  animation: fadeSlideUp 0.25s ease;
}

.fb-box h3, .about-box h3 {
  color: #4285F4;
  margin-bottom: 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fb-box p, .about-box p {
  color: #666;
  font-size: 12px;
  margin-bottom: 12px;
}

.fb-box textarea {
  width: 100%;
  height: 80px;
  margin: 8px 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  resize: none;
  transition: border 0.2s;
}

.fb-box textarea:focus {
  border-color: #4285F4;
  outline: none;
}

#fb-tip {
  color: #d32f2f;
  font-size: 11px;
  margin: 5px 0;
}

.fb-log {
  margin-top: 16px;
  font-size: 12px;
  max-height: 160px;
  overflow-y: auto;
  border-top: 1px solid #eee;
  padding-top: 10px;
}

.tag-box, .about-box {
  width: 90%;
  max-width: 300px;
  background: white;
  padding: 20px;
  border-radius: 12px;
  animation: fadeSlideUp 0.25s ease;
}

.tag-box h3, .about-box h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #4285F4;
  margin-bottom: 10px;
  font-size: 16px;
}

.tag-box input {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  transition: border 0.2s;
}

.tag-box input:focus {
  border-color: #4285F4;
  outline: none;
}

#tag-tip {
  color: #d32f2f;
  font-size: 11px;
  margin: 5px 0;
}

.about-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 8px;
}

.about-item {
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.about-item i {
  font-size: 16px;
  color: var(--primary);
  width: 24px;
  text-align: center;
  margin-top: 2px;
}

.about-item span {
  flex: 1;
}

.version {
  text-align: center;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-light);
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
}

.level-progress-popup {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 300;
  display: none;
  padding: 12px 18px;
  min-width: 220px;
  max-width: 280px;
  animation: popupSlideUp 0.2s ease;
}

.level-progress-popup.open {
  display: block;
}

@keyframes popupSlideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.level-progress-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.level-progress-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: white;
}

.level-progress-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.level-progress-bar-wrap {
  height: 6px;
  background: #e8ecf1;
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
}

.level-progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}

.level-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-light);
  margin-top: 4px;
}

.level-progress-arrow {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
  animation: bounceArrow 1s infinite;
}

@keyframes bounceArrow {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(3px);
  }
}

@media (max-width: 480px) {
  .msg {
    max-width: 88%;
  }
  .user-title-badge {
    font-size: 8px;
    padding: 1px 5px;
  }
  .auth-title-img img {
    max-height: 40px;
  }
  .sidebar, .online-sidebar {
    width: 240px;
  }
  .chat-box {
    bottom: 110px;
  }
}