/* 
 * 版本: 1.4.1 - 移动端适配优化
 * 移动端专用响应式样式
 */
/* 移动端适配样式 */
/* 基础移动端设置 */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* 移动端视口优化 */
@media screen and (max-width: 768px) {
  /* 基础布局调整 */
  .wrap {
    max-width: 100%;
    margin: 8px auto;
    padding: 0 8px;
  }
  
  /* 卡片样式优化 */
  .card {
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
  }
  
  /* 标题优化 */
  h1, h2, h3 {
    font-size: 1.2em;
    margin: 0 0 8px 0;
  }
  
  /* 网格布局改为单列 */
  .row {
    display: block;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .grid2 {
    display: block;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  /* 图片轮播优化 */
  #slider {
    margin-bottom: 12px;
  }
  
  #slider img {
    height: 200px;
    border-radius: 8px;
  }
  
  #slider .nav button {
    padding: 12px 16px;
    font-size: 24px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* 输入框和按钮优化 */
  input, button, textarea {
    font-size: 16px; /* 防止iOS缩放 */
    padding: 12px;
    border-radius: 8px;
    min-height: 44px; /* 触摸友好 */
  }
  
  button {
    min-width: 60px;
    font-weight: 600;
  }
  
  /* 弹性布局优化 */
  .flex {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  
  .flex > * {
    width: 100%;
  }
  
  /* 聊天和播报区域优化 */
  .box {
    height: 200px;
    font-size: 14px;
    padding: 8px;
  }
  
  /* 播报行样式优化 */
  .feed-line {
    font-size: 12px;
    padding: 6px 0;
  }
  
  .feed-line .time {
    font-size: 10px;
    min-width: 50px;
  }
  
  .feed-line .type {
    min-width: 50px;
  }
  
  /* 模态框优化 */
  #modalBack .card {
    width: 95vw;
    max-width: 95vw;
    margin: 20px auto;
  }
  
  /* 图片模态框优化 */
  #imageModalBack {
    background: rgba(0,0,0,0.95);
  }
  
  .image-modal-nav {
    padding: 0 10px;
  }
  
  .modal-nav-btn {
    width: 60px;
    height: 60px;
    font-size: 28px;
    padding: 0;
  }
  
  .image-modal-close {
    width: 50px;
    height: 50px;
    font-size: 24px;
    padding: 0;
    top: 10px;
    right: 10px;
  }
  
  .image-modal-info {
    top: 10px;
    gap: 8px;
  }
  
  .counter-badge, .zoom-badge {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* 小屏幕手机优化 */
@media screen and (max-width: 480px) {
  .wrap {
    padding: 0 4px;
    margin: 4px auto;
  }
  
  .card {
    padding: 8px;
    border-radius: 8px;
  }
  
  h1, h2, h3 {
    font-size: 1.1em;
  }
  
  #slider img {
    height: 160px;
  }
  
  input, button, textarea {
    font-size: 16px;
    padding: 10px;
    min-height: 40px;
  }
  
  .box {
    height: 180px;
    font-size: 13px;
  }
  
  /* 管理端布局优化 */
  .admin-layout {
    display: block;
  }
  
  .left-panel, .right-panel {
    width: 100%;
  }
  
  .right-top {
    display: block;
  }
  
  .right-top .card {
    margin-bottom: 12px;
  }
  
  /* 在线用户监控优化 */
  .online-stats {
    flex-direction: column;
    gap: 10px;
    padding: 8px;
  }
  
  .stat-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .user-list {
    max-height: 300px;
  }
  
  .user-item {
    padding: 8px;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  
  .user-name {
    font-size: 13px;
  }
  
  .user-role {
    font-size: 11px;
  }
}

/* 超小屏幕优化 */
@media screen and (max-width: 360px) {
  .wrap {
    padding: 0 2px;
  }
  
  .card {
    padding: 6px;
  }
  
  #slider img {
    height: 140px;
  }
  
  input, button, textarea {
    padding: 8px;
    min-height: 36px;
  }
  
  .box {
    height: 160px;
    font-size: 12px;
  }
  
  .feed-line {
    font-size: 11px;
  }
  
  .feed-line .time {
    font-size: 9px;
    min-width: 45px;
  }
  
  .feed-line .type {
    min-width: 45px;
  }
}

/* 横屏模式优化 */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .wrap {
    margin: 4px auto;
  }
  
  .card {
    padding: 8px;
  }
  
  #slider img {
    height: 120px;
  }
  
  .box {
    height: 120px;
  }
  
  /* 横屏时保持一些水平布局 */
  .flex {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .flex > * {
    flex: 1;
    min-width: 120px;
  }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
  /* 触摸设备优化 */
  button:hover {
    transform: none;
  }
  
  button:active {
    transform: scale(0.95);
  }
  
  /* 增加触摸区域 */
  .modal-nav-btn,
  .image-modal-close {
    min-width: 44px;
    min-height: 44px;
  }
  
  /* 滑动优化 */
  #slider {
    touch-action: pan-y;
  }
  
  /* 防止双击缩放 */
  input, textarea {
    font-size: 16px;
  }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .card {
    border: 0.5px solid #2a3348;
  }
  
  hr {
    border-top-width: 0.5px;
  }
}

/* 深色模式优化 */
@media (prefers-color-scheme: dark) {
  /* 系统深色模式下的额外优化 */
  .card {
    background: var(--card);
  }
  
  input, textarea {
    background: #0e1320;
    color: var(--text);
  }
}

/* 无障碍优化 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 焦点可见性优化 */
@media (prefers-reduced-motion: no-preference) {
  button:focus-visible,
  input:focus-visible,
  textarea:focus-visible {
    outline: 2px solid var(--hi);
    outline-offset: 2px;
  }
}

/* 移动端特殊交互优化 */
.mobile-optimized {
  /* 移动端专用类 */
}

/* 防止页面缩放 */
@media screen and (max-width: 768px) {
  body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
}

/* 移动端滚动优化 */
@media screen and (max-width: 768px) {
  .box {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
  }
  
  /* 平滑滚动 */
  html {
    scroll-behavior: smooth;
  }
}

/* 移动端字体优化 */
@media screen and (max-width: 768px) {
  body {
    font-size: 14px;
    line-height: 1.4;
  }
  
  .small {
    font-size: 11px;
  }
  
  .t {
    font-size: 11px;
  }
}

/* 移动端间距优化 */
@media screen and (max-width: 768px) {
  .wrap > * {
    margin-bottom: 12px;
  }
  
  .wrap > *:last-child {
    margin-bottom: 0;
  }
  
  hr {
    margin: 8px 0;
  }
}

/* 移动端按钮组优化 */
@media screen and (max-width: 768px) {
  .button-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .button-group button {
    width: 100%;
    min-width: auto;
  }
}

/* 移动端输入组优化 */
@media screen and (max-width: 768px) {
  .input-group {
    margin-bottom: 16px;
  }
  
  .input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
  }
  
  .input-group input,
  .input-group textarea {
    width: 100%;
    box-sizing: border-box;
  }
}

/* 移动端状态信息优化 */
@media screen and (max-width: 768px) {
  .status-info {
    padding: 12px;
    margin: 12px 0;
  }
  
  .status-info .flex {
    margin-bottom: 6px;
  }
  
  .status-info .flex:last-child {
    margin-bottom: 0;
  }
}

/* 移动端公告区域优化 */
@media screen and (max-width: 768px) {
  .announcement-section {
    margin-top: 16px;
    padding-top: 16px;
  }
  
  .announcement-section h3 {
    margin-bottom: 16px;
  }
  
  .announcement-section .flex {
    flex-direction: column;
    align-items: stretch;
  }
  
  .announcement-section input[type="number"] {
    width: 100%;
    text-align: center;
  }
  
  .announcement-section button {
    width: 100%;
  }
}
