/* 移动端全局适配样式 */

/* 基础移动端设置 */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 允许文本选择 */
p, span, div, h1, h2, h3, h4, h5, h6, label, input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* 移动端视口优化 */
@media (max-width: 768px) {
  /* 容器适配 */
  .container {
    padding: 0 15px;
    max-width: 100%;
  }
  
  /* 头部适配 */
  header .container {
    flex-direction: column;
    gap: 15px;
    padding: 15px 0;
  }
  
  .site-title {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  
  .site-logo {
    height: 60px;
  }
  
  .title-text h1 {
    font-size: 1.5rem;
    margin: 0;
  }
  
  .site-subtitle {
    font-size: 0.9rem;
  }
  
  /* 导航适配 */
  nav {
    width: 100%;
  }
  
  .user-info-container {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .user-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .guest-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  /* 按钮适配 */
  .gold-button, .nav-btn, .task-btn, .points-btn, .location-btn, .avatar-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 8px;
    margin: 5px 0;
  }
  
  /* 表单适配 */
  input, textarea, select {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border-radius: 8px;
    margin: 10px 0;
  }
  
  /* 卡片适配 */
  .card {
    margin: 15px 0;
    padding: 20px;
  }
  
  /* 网格布局适配 */
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  /* 任务大厅适配 - 注释掉避免覆盖新布局 */
  /* .hall-toolbar {
    flex-direction: column;
    gap: 15px;
  }
  
  .hall-left, .hall-right {
    width: 100%;
    justify-content: center;
  }
  
  .hall-title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 15px;
  } */
  
  /* 表格适配 */
  .post-table {
    font-size: 14px;
  }
  
  .post-table th,
  .post-table td {
    padding: 8px 4px;
  }
  
  /* 帖子卡片适配 */
  .post-card {
    margin: 10px 0;
    padding: 15px;
  }
  
  .post-card .actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .post-card .actions .btn {
    width: 100%;
  }
  
  /* 弹窗适配 */
  dialog {
    width: 95vw;
    max-width: none;
    margin: 10px;
  }
  
  .dlg-header, .dlg-body, .dlg-footer {
    padding: 15px;
  }
  
  /* 悬浮按钮适配 */
  .fab {
    right: 15px;
    bottom: 20px;
    padding: 18px 22px;
    font-size: 18px;
  }
}

/* 小屏幕手机适配 */
@media (max-width: 480px) {
  .container {
    padding: 0 10px;
  }
  
  .site-logo {
    height: 50px;
  }
  
  .title-text h1 {
    font-size: 1.3rem;
  }
  
  .site-subtitle {
    font-size: 0.8rem;
  }
  
  .card {
    padding: 15px;
    margin: 10px 0;
  }
  
  /* .hall-title {
    font-size: 1.3rem;
  } */
  
  .post-table {
    font-size: 12px;
  }
  
  .post-table th,
  .post-table td {
    padding: 6px 2px;
  }
  
  .post-card {
    padding: 12px;
  }
  
  .fab {
    right: 10px;
    bottom: 15px;
    padding: 16px 20px;
    font-size: 16px;
  }
  
  /* 按钮文字适配 */
  .btn, .gold-button, .nav-btn {
    font-size: 14px;
    padding: 10px 16px;
  }
  
  /* 输入框适配 */
  input, textarea, select {
    padding: 12px;
    font-size: 14px;
  }
  
  /* 公会区域小屏幕适配 */
  #guild-section {
    padding: 0.8rem;
  }
  
  .guild-header h2 {
    font-size: 1.3rem;
  }
  
  .guild-description {
    font-size: 0.9rem;
  }
  
  .honor-levels li {
    margin: 0.6rem 0;
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* 横屏适配 */
@media (max-width: 768px) and (orientation: landscape) {
  header .container {
    flex-direction: row;
    gap: 20px;
  }
  
  .site-title {
    flex-direction: row;
    text-align: left;
  }
  
  .user-info-container {
    flex-direction: row;
    gap: 20px;
  }
  
  .user-actions {
    flex-direction: row;
    gap: 10px;
  }
  
  .guest-actions {
    flex-direction: row;
    gap: 10px;
  }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
  /* 触摸友好的按钮大小 */
  .btn, .gold-button, .nav-btn, .task-btn, .points-btn, .location-btn, .avatar-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 触摸友好的输入框 */
  input, textarea, select {
    min-height: 44px;
  }
  
  /* 触摸友好的链接 */
  a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  
  /* 触摸友好的表格行 */
  .post-table tr {
    min-height: 44px;
  }
  
  /* 触摸友好的卡片 */
  .post-card {
    min-height: 44px;
  }
  
  /* 公会区域移动端适配 */
  #guild-section {
    padding: 1rem;
    margin: 1rem 0;
  }
  
  .guild-content {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .guild-description {
    font-size: 1rem;
  }
  
  .guild-description p {
    margin-bottom: 1rem;
    line-height: 1.6;
  }
  
  .honor-levels li {
    margin: 0.8rem 0;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
  
  .guild-rank-image {
    max-width: 100%;
    height: auto;
  }
}

/* 高分辨率屏幕适配 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .site-logo {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  /* 保持现有的深色主题 */
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .btn, .gold-button, .nav-btn {
    border-width: 2px;
  }
  
  .card {
    border-width: 2px;
  }
}

/* 打印样式 */
@media print {
  .fab, .nav, .user-actions, .guest-actions {
    display: none !important;
  }
  
  .container {
    max-width: none;
    padding: 0;
  }
  
  body {
    background: white;
    color: black;
  }
}
