/*
 * 装备模拟器 · 手机版
 * 目标：手机竖屏布局（约 360×640 ~ 414×736）。
 * 只由 mobile.html 加载，不影响电脑版 index.html。
 */

.mobile-equip {
    -webkit-text-size-adjust: 100%;
}

.mobile-equip .app-container {
    max-width: 100%;
    padding: 0 0.55rem calc(1.5rem + env(safe-area-inset-bottom));
}

.mobile-equip .app-header {
    padding: calc(0.7rem + env(safe-area-inset-top)) 0.2rem 0.45rem;
}

.mobile-equip .app-header h1 {
    font-size: 1.45rem;
    letter-spacing: 0.14em;
    margin-bottom: 0.2rem;
}

.mobile-equip .app-header .subtitle {
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    line-height: 1.55;
    white-space: normal;
}

.mobile-version-note {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.mobile-version-note a {
    color: var(--purple-bright);
    text-decoration: none;
}

/* 顶部导航：自动换行，避免右侧链接被截断 */
.mobile-equip .sim-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.15rem 0.35rem;
    margin-top: 0.5rem;
    padding-bottom: 0.2rem;
    font-size: 0.78rem;
}

.mobile-equip .sim-nav a {
    flex: 0 0 auto;
    padding: 0.15rem 0.1rem;
    white-space: nowrap;
}

.mobile-equip .nav-sep {
    display: none;
}

/* 存档摘要 */
.mobile-equip .archive-summary {
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.7rem;
}

.mobile-equip .archive-summary-info {
    gap: 0.5rem 1rem;
    width: 100%;
}

.mobile-equip .archive-summary-item strong {
    font-size: 0.85rem;
}

.mobile-equip .archive-summary-actions {
    width: 100%;
    margin-left: 0;
}

.mobile-equip .archive-summary-actions .btn-archive-action {
    width: 100%;
    min-width: 0;
    min-height: 2.35rem;
}

/* 所有卡片统一紧凑 */
.mobile-equip .config-panel,
.mobile-equip .action-panel,
.mobile-equip .manual-panel,
.mobile-equip .history-panel,
.mobile-equip .pulse-panel {
    padding: 0.7rem 0.75rem;
    margin-bottom: 0.7rem;
    border-radius: 8px;
}

/* 短分组允许同行：标签 + 控件宽度自适应内容 */
.mobile-equip .config-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 0.6rem;
}

.mobile-equip .config-row:last-child {
    margin-bottom: 0;
}

.mobile-equip .config-group {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    max-width: 100%;
}

.mobile-equip .config-group.grow {
    flex: 1 1 auto;
    min-width: 8rem;
}

.mobile-equip .config-group.import-group {
    flex: 0 0 auto;
}

.mobile-equip .config-group label {
    margin-bottom: 0.25rem;
    font-size: 0.72rem;
}

.mobile-equip .config-group select,
.mobile-equip .config-group input,
.mobile-equip .config-panel input[type="number"],
.mobile-equip .config-panel input[type="search"],
.mobile-equip .config-panel input[type="text"] {
    width: auto;
    min-width: 8rem;
    min-height: 2.5rem;
    padding: 0.5rem 0.55rem;
    font-size: 16px; /* 防止 iOS 聚焦时自动放大 */
}

/* 目标装备：搜索框 + 具体装备下拉同一排 */
.mobile-equip .paper-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.mobile-equip .paper-filter-row input[type="search"],
.mobile-equip .paper-filter-row select {
    flex: 1 1 7rem;
    width: auto;
    min-width: 0;
}

/* 标签页：横向滑动 */
.mobile-equip .tab-bar {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.55rem;
    padding-bottom: 0.15rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.mobile-equip .tab-bar::-webkit-scrollbar {
    display: none;
}

.mobile-equip .tab-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 4.1rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* 操作按钮 */
.mobile-equip .action-panel {
    margin: 0.6rem 0;
}

.mobile-equip .action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0;
}

.mobile-equip .action-buttons .btn {
    flex: 1 1 8rem;
    padding: 0.65rem 0.5rem;
    font-size: 0.82rem;
}

/* 面板标题与说明 */
.mobile-equip .panel-header {
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem 0.6rem;
}

.mobile-equip .panel-header h2 {
    font-size: 0.98rem;
}

.mobile-equip .panel-header .meta-text {
    font-size: 0.72rem;
}

/* 筛选条：整行堆叠，输入不挤压 */
.mobile-equip .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding: 0.55rem 0.6rem;
    font-size: 0.8rem;
}

.mobile-equip .filter-bar label {
    justify-content: space-between;
    width: 100%;
}

.mobile-equip .filter-bar select,
.mobile-equip .filter-bar input[type="number"] {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 65%;
}

.mobile-equip .filter-bar .meta-text {
    width: 100%;
}

/* 表格：保留横向滚动，压缩字号和留白 */
.mobile-equip .table-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.mobile-equip .preview-table {
    font-size: 0.75rem;
}

.mobile-equip .preview-table th,
.mobile-equip .preview-table td {
    padding: 0.45rem 0.5rem;
}

.mobile-equip .preview-table th {
    font-size: 0.72rem;
}

.mobile-equip .preview-table .btn-row-action {
    padding: 0.3rem 0.45rem;
    font-size: 0.72rem;
}

/* 精炼规划：三槽卡片改为单列 */
.mobile-equip .plan-summary-grid {
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

.mobile-equip .plan-info-line {
    flex-direction: column;
    gap: 0.1rem;
}

.mobile-equip .plan-info-line > strong {
    flex: none;
}

/* 自动规划：单元格内文字不竖排，让表格横向滚动 */
.mobile-equip .auto-plan-table td .ap-prop,
.mobile-equip .auto-plan-table td .ap-idx,
.mobile-equip .auto-plan-table td.ap-num {
    white-space: nowrap;
}

/* 自动规划：勾选/总值一排、三个槽位一排（放不下自动换行）、按钮一排 */
.mobile-equip .auto-plan-config {
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-equip .auto-plan-shared-row,
.mobile-equip .auto-plan-slots-row,
.mobile-equip .auto-plan-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mobile-equip .auto-plan-shared-row,
.mobile-equip .auto-plan-actions-row {
    align-items: center;
}

/* 三个槽位各占一行；每行宽度随内容自适应（不撑满整行），下拉与数值框比例协调 */
.mobile-equip .auto-plan-slots-row {
    flex-direction: column;
    align-items: flex-start;
}

.mobile-equip .auto-plan-slots-row .auto-plan-slot {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    gap: 0.45rem;
    align-items: center;
}

/* 槽1/槽2/槽3 标签等宽右对齐，让三行控件左缘对齐 */
.mobile-equip .auto-plan-slot > span {
    flex: 0 0 2.2rem;
    text-align: right;
}

.mobile-equip .auto-plan-slot select {
    flex: 0 0 8.5rem;
    width: 8.5rem;
    min-width: 0;
    max-width: none;
}

.mobile-equip .auto-plan-slot input[type="number"] {
    flex: 0 0 5rem;
    width: 5rem;
    min-width: 5rem;
}

.mobile-equip .auto-plan-total input[type="number"] {
    width: 5rem;
    min-width: 5rem;
}

/* 三槽总值与「三槽同属性」勾选同一排，不再独占整行 */
.mobile-equip .auto-plan-total {
    min-width: 0;
    justify-content: flex-start;
}

.mobile-equip .auto-plan-config .btn {
    flex: 0 0 auto;
    width: auto;
}

/* 芒晶序列工具栏 */
.mobile-equip .mangjing-toolbar {
    gap: 0.35rem 0.6rem;
}

.mobile-equip .mangjing-filter-label input[type="number"] {
    width: 4.8rem;
}

.mobile-equip .mangjing-page-meta {
    margin-left: 0;
}

/* 成品背包 */
.mobile-equip .bag-panel-header {
    align-items: flex-start;
}

.mobile-equip .bag-header-actions {
    width: 100%;
    margin-left: 0;
}

.mobile-equip .bag-header-actions .btn {
    flex: 1 1 auto;
}

.mobile-equip .crafted-bag-row {
    grid-template-columns: 1fr;
}

/* 分页条 */
.mobile-equip .pager-bar {
    gap: 0.35rem 0.5rem;
    font-size: 0.75rem;
}

.mobile-equip .pager-bar .pager-size {
    margin-left: 0;
}

/* 底部 */
.mobile-equip .app-footer {
    padding-bottom: calc(0.8rem + env(safe-area-inset-bottom));
    font-size: 0.72rem;
}

/* 更窄的屏幕（如 360×640）进一步压缩 */
@media (max-width: 380px) {
    .mobile-equip .app-container {
        padding-left: 0.4rem;
        padding-right: 0.4rem;
    }

    .mobile-equip .app-header h1 {
        font-size: 1.3rem;
    }

    .mobile-equip .tab-btn {
        min-width: 3.7rem;
        font-size: 0.78rem;
    }

    .mobile-equip .config-panel,
    .mobile-equip .action-panel,
    .mobile-equip .manual-panel,
    .mobile-equip .history-panel {
        padding: 0.6rem 0.6rem;
    }
}
