/* ============================================================
   Fromx 全站响应式适配
   覆盖：桌面 → 平板 → 手机 → 手表（窄屏 / 超窄屏）
   说明：本文件在页面原有样式之后生效，用于统一兜底与超小屏适配
   ============================================================ */

/* ---------- 基础安全规则：任何设备都不出现横向溢出 ---------- */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
*, *::before, *::after {
    box-sizing: border-box;
}
img, video, canvas, iframe {
    max-width: 100%;
}
img, video {
    height: auto;
}
input, select, textarea, button {
    max-width: 100%;
}
pre, code {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.post-text, .msg-text, .mail-title, .mail-sub, .ticket-title, .comment-text,
.role-name, .adm-title, .adm-post-content {
    overflow-wrap: anywhere;
    word-break: break-word;
}
table {
    max-width: 100%;
}

/* ============================================================
   平板 / 小笔记本（≤1024px）
   ============================================================ */
@media (max-width: 1024px) {
    .container, .wrap {
        width: 100%;
        max-width: 100%;
    }
    .adm-main {
        min-width: 0;
    }
}

/* ============================================================
   手机 / 竖屏平板（≤768px）
   ============================================================ */
@media (max-width: 768px) {
    .container, .wrap {
        width: 100%;
        max-width: 100%;
    }
    .header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .header .logo, .logo {
        position: static;
        transform: none;
    }
    .post-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    .post-author-info {
        min-width: 0;
    }
    .card-title {
        flex-wrap: wrap;
    }
    .toolbar, .btn-row, .button-group, .line-btns,
    .server-btn-group, .detail .ops, .form-row {
        flex-wrap: wrap;
    }
    .mail-item, .ticket-item {
        padding: 12px;
    }
    .msg-bubble {
        max-width: 82% !important;
    }
    .adm-main input:not([type=checkbox]):not([type=radio]):not([type=file]),
    .adm-main select,
    .adm-main textarea {
        max-width: 100%;
    }
}

/* ============================================================
   小屏手机（≤480px）
   ============================================================ */
@media (max-width: 480px) {
    html {
        font-size: 15px;
    }
    .nav-container {
        grid-template-columns: 1fr;
    }
    .nav-btn {
        padding: 14px 12px;
        font-size: 14px;
    }
    .ann-dyn-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .post-card {
        padding: 14px;
        border-radius: 10px;
    }
    .post-author-avatar {
        width: 38px;
        height: 38px;
    }
    .post-author {
        font-size: 14px;
    }
    .post-text {
        font-size: 14px;
        padding-right: 0;
    }
    .card, .server-card, .ann-latest, .adm-panel {
        padding: 14px;
    }
    .footer {
        font-size: 11px;
    }
}

/* ============================================================
   手表 / 超窄屏（≤360px）
   ============================================================ */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }
    body {
        font-size: 12px;
        line-height: 1.5;
    }
    .container, .wrap {
        padding-left: 6px;
        padding-right: 6px;
    }
    .header {
        padding: 8px;
        gap: 6px;
        border-radius: 8px;
    }
    .header .logo, .logo {
        font-size: 15px;
    }
    .back-home, .post-btn, .header .btn {
        padding: 6px 8px;
        font-size: 11px;
        border-radius: 6px;
    }
    /* 聊天页顶部标题与操作按钮在手表上不互相遮挡 */
    .header h3 {
        font-size: 13px;
        max-width: calc(100% - 120px);
    }
    .chat-input, .search-input {
        height: 34px;
    }
    .nav-container {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .nav-btn {
        padding: 10px 8px;
        font-size: 12px;
        border-radius: 8px;
        gap: 4px;
    }
    .server-card, .ann-latest, .card, .adm-panel,
    .ticket-item, .mail-item {
        padding: 10px;
        border-radius: 8px;
        margin-bottom: 10px;
    }
    .account-container {
        padding: 10px;
        margin: 8px auto;
        border-radius: 8px;
    }
    .info-item {
        padding: 8px;
        gap: 6px;
    }
    .server-title {
        font-size: 18px;
    }
    .section-title {
        font-size: 14px;
    }
    .ann-dyn-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }
    .ann-dyn-item {
        padding: 8px 4px;
    }
    .ann-dyn-item .n {
        font-size: 16px;
    }
    .ann-dyn-item .l {
        font-size: 11px;
    }
    .post-card {
        padding: 10px;
        margin-bottom: 10px;
        border-radius: 8px;
    }
    .post-header {
        gap: 4px;
        padding-bottom: 6px;
        margin-bottom: 8px;
    }
    .post-author-avatar {
        width: 32px;
        height: 32px;
    }
    .post-author {
        font-size: 13px;
    }
    .post-text {
        font-size: 13px;
        line-height: 1.5;
        padding-right: 0;
    }
    .footer {
        padding: 10px 6px;
        font-size: 10px;
        line-height: 1.45;
        word-break: break-word;
    }
    .footer .beian-link {
        margin: 0 2px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    /* 多列网格统一收起为单列（动态数字卡除外） */
    .grid,
    [class*="-grid"]:not(.ann-dyn-grid) {
        grid-template-columns: 1fr !important;
    }
    .top-nav {
        height: auto;
        min-height: 44px;
        padding: 6px 8px;
        flex-wrap: wrap;
        gap: 6px;
    }
    .top-nav .back-home {
        position: static;
        transform: none;
        height: auto;
        padding: 5px 8px;
        font-size: 10px;
    }
    .search-card, .search-form, .search-buttons {
        width: 100%;
    }
    .form-control, input, select, textarea {
        font-size: 16px;
    }
    .btn, button, .submit-btn {
        font-size: 12px;
        padding: 8px 10px;
        min-height: 36px;
    }
    .button-group > *, .server-btn-group > * {
        flex: 1 1 100%;
    }
    .chat-input, .search-input {
        height: 36px;
    }
    .pwd-item label, .sign-item label, .form-item label {
        width: 100%;
    }
    .user-info {
        font-size: 12px;
    }
    .user-avatar {
        width: 34px;
        height: 34px;
    }
    /* 聊天 / 消息气泡 */
    .msg-bubble {
        max-width: 88% !important;
    }
    .msg-user, .msg-time {
        font-size: 11px;
    }
    /* 后台 */
    .adm-side {
        width: min(86vw, 250px);
    }
    .adm-nav-btn {
        width: 36px;
        height: 36px;
        font-size: 17px;
    }
    .adm-main {
        padding: 56px 8px 14px;
    }
    .adm-title {
        font-size: 17px;
    }
    .adm-stat {
        padding: 10px;
        gap: 8px;
    }
    .adm-stat .num {
        font-size: 18px;
    }
    .adm-quick {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    table {
        font-size: 11px;
    }
    .table-scroll, .adm-table {
        -webkit-overflow-scrolling: touch;
    }
    /* 固定尺寸头像/图标不参与收缩 */
    .post-author-avatar, .avatar, .user-avatar, .head-avatar {
        flex-shrink: 0;
    }
}

/* ============================================================
   超小屏手表（≤280px）
   ============================================================ */
@media (max-width: 280px) {
    html {
        font-size: 12px;
    }
    .container, .wrap {
        padding-left: 4px;
        padding-right: 4px;
    }
    .nav-container,
    .ann-dyn-grid,
    .grid,
    [class*="-grid"] {
        grid-template-columns: 1fr !important;
    }
    .nav-btn {
        padding: 8px 6px;
        font-size: 11px;
    }
    .header .logo, .logo {
        font-size: 13px;
    }
    .back-home, .post-btn, .header .btn {
        padding: 5px 6px;
        font-size: 10px;
    }
    .card, .server-card, .post-card, .adm-panel {
        padding: 8px;
    }
    .footer {
        font-size: 9px;
    }
    .adm-quick {
        grid-template-columns: 1fr !important;
    }
}
