/**
 * 工具页共用移动端样式（需配合 body.has-tool-header）
 * 覆盖各工具页零散 @media，统一手机端体验
 */

@media (max-width: 768px) {
    body.has-tool-header {
        padding: 0 !important;
        background: #f4f6f8 !important;
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
    }

    /* 隐藏工具页内嵌的旧站导航（桌面端由 tool-header.css 统一处理） */
    /* 外层卡片容器（PDF 类等） */
    body.has-tool-header > .container {
        margin: 0.75rem;
        max-width: none;
        width: auto;
        border-radius: 10px;
        box-shadow: 0 2px 14px rgba(0, 102, 204, 0.08);
        overflow: hidden;
    }

    /* 内层 .container（JSON / 颜色转换等） */
    body.has-tool-header .container:not(.tool-site-header-inner) {
        padding: 1rem 0.75rem !important;
        max-width: none;
    }

    body.has-tool-header > .container .container {
        margin: 0;
        padding: 0 !important;
        box-shadow: none;
        border-radius: 0;
    }

    /* 渐变标题区 */
    body.has-tool-header .container > .header {
        padding: 1.15rem 1rem;
        text-align: left;
    }

    body.has-tool-header .container > .header h1 {
        font-size: 1.2rem;
        line-height: 1.35;
        margin-bottom: 0.35rem;
    }

    body.has-tool-header .container > .header p {
        font-size: 0.8125rem;
        line-height: 1.45;
        opacity: 0.92;
    }

    body.has-tool-header .content {
        padding: 1rem !important;
    }

    body.has-tool-header .page-title {
        font-size: 1.35rem;
        margin-bottom: 0.4rem;
        line-height: 1.3;
    }

    body.has-tool-header .page-subtitle {
        font-size: 0.875rem;
        margin-bottom: 1rem;
        line-height: 1.5;
    }

    body.has-tool-header .info-box {
        padding: 0.7rem 0.85rem;
        font-size: 0.8125rem;
        line-height: 1.5;
        margin-bottom: 0.85rem;
    }

    body.has-tool-header .upload-area {
        padding: 1.25rem 1rem !important;
        margin-bottom: 1rem !important;
    }

    body.has-tool-header .upload-icon {
        font-size: 2rem !important;
        margin-bottom: 0.45rem !important;
    }

    body.has-tool-header .upload-text {
        font-size: 0.9375rem !important;
    }

    body.has-tool-header .upload-hint {
        font-size: 0.78rem !important;
    }

    body.has-tool-header .status-row {
        flex-direction: column;
        gap: 0.45rem;
        margin-bottom: 0.75rem;
    }

    body.has-tool-header .status-chip {
        min-width: 0;
        width: 100%;
        font-size: 0.8125rem;
        padding: 0.55rem 0.75rem;
    }

    body.has-tool-header .range-group {
        margin-bottom: 0.85rem;
    }

    body.has-tool-header .range-group input,
    body.has-tool-header input[type="text"],
    body.has-tool-header input[type="number"],
    body.has-tool-header input[type="email"],
    body.has-tool-header input[type="url"],
    body.has-tool-header select,
    body.has-tool-header textarea {
        font-size: 16px !important;
    }

    body.has-tool-header .actions,
    body.has-tool-header .buttons-group {
        flex-direction: column !important;
        gap: 0.5rem !important;
        margin-top: 0.75rem !important;
    }

    body.has-tool-header .btn,
    body.has-tool-header .btn-primary,
    body.has-tool-header .btn-secondary,
    body.has-tool-header button.btn {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        padding: 0.8rem 1rem !important;
        font-size: 0.9375rem !important;
        transform: none !important;
        box-shadow: none !important;
    }

    body.has-tool-header .btn-primary:hover:not(:disabled),
    body.has-tool-header .btn-secondary:hover:not(:disabled) {
        transform: none !important;
    }

    body.has-tool-header .file-item {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.35rem;
        padding: 0.75rem;
    }

    body.has-tool-header .file-info {
        width: 100%;
        gap: 0.5rem;
    }

    body.has-tool-header .file-size {
        margin-left: 0 !important;
        margin-top: 0;
    }

    body.has-tool-header .file-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
    }

    body.has-tool-header .tool-container,
    body.has-tool-header .editor-container,
    body.has-tool-header .main-grid,
    body.has-tool-header .color-inputs,
    body.has-tool-header .settings-grid,
    body.has-tool-header .preview-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    body.has-tool-header .tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.35rem;
        margin-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    body.has-tool-header .tabs::-webkit-scrollbar {
        display: none;
    }

    body.has-tool-header .tab-btn {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 0.55rem 0.85rem !important;
        font-size: 0.8125rem !important;
    }

    body.has-tool-header .progress-container {
        margin-top: 0.75rem;
    }

    body.has-tool-header .progress-bar {
        height: 6px;
    }

    body.has-tool-header .progress-text {
        font-size: 0.78rem;
    }

    body.has-tool-header textarea {
        min-height: 120px;
    }

    body.has-tool-header .editor-container textarea,
    body.has-tool-header .preview-content {
        min-height: 200px;
    }

    body.has-tool-header pre,
    body.has-tool-header code,
    body.has-tool-header table {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.has-tool-header canvas {
        max-width: 100%;
        height: auto !important;
    }

    body.has-tool-header footer {
        padding: 1rem 0.75rem !important;
        font-size: 0.78rem;
        margin-top: 0.5rem;
    }

    body.has-tool-header .hint {
        font-size: 0.78rem;
        line-height: 1.45;
    }

    body.has-tool-header .empty-state {
        padding: 1.25rem 1rem;
    }

    body.has-tool-header .stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }
}

@media (max-width: 480px) {
    body.has-tool-header > .container {
        margin: 0.5rem;
    }

    body.has-tool-header .container > .header h1 {
        font-size: 1.1rem;
    }

    body.has-tool-header .page-title {
        font-size: 1.2rem;
    }

    body.has-tool-header .stats {
        grid-template-columns: 1fr !important;
    }
}

/* A3 转 A4：沿用紧凑模式，隐藏大标题区 */
@media (max-width: 768px) {
    body.tool-page-a3 .container > .header,
    body.tool-page-a3 .info-box {
        display: none;
    }

    body.tool-page-a3 .upload-icon {
        display: none;
    }

    body.tool-page-a3 .upload-hint {
        display: none;
    }

    body.tool-page-a3 .status-row {
        display: none;
    }
}
