/* ============================================================
   H5 Mobile UX - 全面移动端体验升级
   仅影响 max-width: 768px 的移动设备
   ============================================================ */

/* Hide mobile nav on desktop */
.mobile-tab-bar { display: none; }

@media (max-width: 768px) {

/* ============================================================
   CSS Custom Properties - 移动端变量
   ============================================================ */
:root {
    --mobile-gap: 12px;
    --mobile-pad: 16px;
    --mobile-radius: 14px;
    --mobile-radius-sm: 10px;
    --tab-bar-height: 72px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

/* ============================================================
   Base & Typography - 移动端基础
   ============================================================ */
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: auto;
}

body {
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    background:
        linear-gradient(180deg, #f8fbff 0%, #eef5ff 46%, #e8f1ff 100%);
    overflow-x: hidden;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

a {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   Shell & Layout
   ============================================================ */
.shell {
    width: 100%;
    max-width: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: 0;
}

/* ============================================================
   Mobile Bottom Tab Bar - 高级质感固定底部导航
   ============================================================ */
.mobile-tab-bar {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: calc(100% - 24px);
    max-width: 400px;
    height: 58px;
    padding: 4px 6px calc(4px + var(--safe-bottom, 0px));
    margin-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(30px) saturate(1.8);
    -webkit-backdrop-filter: blur(30px) saturate(1.8);
    border: 0.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 20px;
    box-shadow:
        0 2px 8px rgba(69, 105, 168, 0.05),
        0 8px 28px rgba(69, 105, 168, 0.1),
        0 16px 48px rgba(69, 105, 168, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    contain: layout style paint;
}

.mobile-tab-bar::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 19px;
    background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, transparent 40%);
    pointer-events: none;
}

.mobile-tab-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    min-width: 60px;
    height: 48px;
    padding: 6px 4px;
    border: none;
    border-radius: 16px;
    background: transparent;
    color: #8ba0c4;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.mobile-tab-item:active {
    transform: scale(0.92);
}

.mobile-tab-item.is-active {
    color: var(--blue-deep);
    background: rgba(63, 125, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(63, 125, 255, 0.08);
}

.mobile-tab-item.is-active::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(63, 125, 255, 0.06), rgba(63, 125, 255, 0.02));
    pointer-events: none;
}

.mobile-tab-item.is-active .mobile-tab-label {
    font-weight: 700;
}

.mobile-tab-item.is-active .mobile-tab-icon {
    filter: drop-shadow(0 2px 8px rgba(63, 125, 255, 0.3));
}

/* Ripple on tap */
.mobile-tab-item::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 13px;
    background: rgba(63, 125, 255, 0.08);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.mobile-tab-item:active::after {
    opacity: 1;
}

.mobile-tab-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-tab-item.is-active .mobile-tab-icon {
    transform: translateY(-1px);
}

.mobile-tab-label {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: opacity 0.25s ease;
}

.mobile-tab-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5ea2ff, #2f67de);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(58, 110, 210, 0.2);
}

/* ============================================================
   Top Navigation - 顶部导航栏移动端（固定吸顶）
   ============================================================ */
.top-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: calc(10px + var(--safe-top)) 12px 8px;
    column-gap: 10px;
    row-gap: 8px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(18px) saturate(1.1);
    -webkit-backdrop-filter: blur(18px) saturate(1.1);
    border-bottom: 1px solid var(--border-medium);
    box-shadow: 0 2px 12px rgba(69,105,168,0.06);
    transition:
        box-shadow 0.35s ease,
        background 0.35s ease;
}

.top-nav.is-scrolled {
    background: rgba(255,255,255,0.96);
    box-shadow: 0 4px 20px rgba(69,105,168,0.1);
}

/* 移动端隐藏顶部导航的区域 */
.top-nav .nav-links {
    display: none !important;
}

.top-nav .nav-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}



.brand {
    gap: 6px;
    flex-shrink: 0;
    width: auto;
    max-width: 100%;
    min-width: 0;
    justify-self: start;
}

.brand > a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    min-height: 0;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(58,110,210,0.18);
    flex-shrink: 0;
}

.brand-mark svg {
    width: 36px;
    height: 36px;
}

.brand-text strong {
    font-size: 14px;
    letter-spacing: 0.2px;
}

.brand-text span {
    font-size: 10px;
}

.nav-actions {
    width: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
    gap: 4px;
    padding: 4px;
    border-radius: 16px;
    background: rgba(255,255,255,0.72);
    border: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(69,105,168,0.06);
}

.nav-user {
    flex: 0 1 auto;
    min-width: 0;
    max-width: none;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    padding: 2px 4px 2px 2px;
    border-radius: 14px;
    transition: background 0.25s ease;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.nav-actions > .btn {
    flex-shrink: 0;
    min-width: 0;
    height: 30px;
    padding: 0 11px;
    border-radius: 12px;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #5f789d;
    font-size: 12px;
    font-weight: 600;
}

.nav-actions > .btn:active {
    background: rgba(63,125,255,0.08);
    color: var(--blue-deep);
}

.nav-user .user-avatar {
    width: 30px;
    height: 30px;
    font-size: 13px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5ea2ff, #2f67de);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.user-avatar-button {
    flex-shrink: 0;
}

.nav-user-meta {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.nav-user strong {
    display: none;
}

.nav-user .nav-credits {
    font-size: 12px;
    font-weight: 800;
    min-height: 26px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #4c89ff, #2f67de);
    color: #fff;
    white-space: nowrap;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(58,110,210,0.2);
}

/* ============================================================
   Buttons - 移动端按钮
   ============================================================ */
.btn {
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
    min-width: 44px;
    border-radius: 11px;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.96);
}

.btn-sm {
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
}

/* ============================================================
   Workspace Grid - 工作区移动端布局
   ============================================================ */
.home-guide-bar {
    padding: 12px 16px;
    font-size: 12px;
    gap: 8px;
    text-align: center;
    flex-wrap: wrap;
}

.home-guide-bar .btn {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
}

.home-guide-close {
    right: 8px;
    width: 28px;
    height: 28px;
    font-size: 20px;
}

.workspace {
    display: flex;
    flex-direction: column;
    min-height: auto;
}

.left-pane {
    display: flex;
    flex-direction: column-reverse;
    padding: var(--mobile-pad);
    gap: var(--mobile-gap);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.3), rgba(255,255,255,0.15));
}

/* ============================================================
   Hero Main + Preview Area - 预览区域（初始隐藏，生成后展示）
   ============================================================ */
.hero-main {
    display: none;
    padding: var(--mobile-pad);
    border-radius: var(--mobile-radius);
    min-height: 280px;
    box-shadow: 0 8px 20px rgba(69,105,168,0.08);
}

.hero-main.is-revealed {
    display: block;
}

.hero-main::before,
.hero-main::after {
    display: none;
}

.hero-main:hover {
    transform: none;
    box-shadow: 0 8px 20px rgba(69,105,168,0.08);
}

.preview-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.preview-title strong {
    font-size: 18px;
}

.preview-title span {
    font-size: 13px;
}

.preview-badge {
    font-size: 12px;
    padding: 8px 14px;
}

.preview-stage {
    min-height: 200px;
    padding: 12px;
    border-radius: var(--mobile-radius);
    backdrop-filter: none;
}

.preview-image {
    width: min(100%, 260px);
    border-radius: var(--mobile-radius);
}

.preview-image.has-result {
    max-height: 360px;
}

.preview-result-caption {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 10px 11px;
    border-radius: 14px;
}

.preview-result-caption strong {
    font-size: 13px;
}

.preview-result-caption span {
    font-size: 10px;
}

.preview-result-chip {
    min-height: 22px;
    padding: 0 9px;
    font-size: 9px;
    letter-spacing: 0.8px;
}

.preview-overlay {
    padding: var(--mobile-pad);
    gap: 10px;
}

.preview-overlay svg {
    width: 48px;
    height: 48px;
}

.preview-overlay strong {
    font-size: 18px;
}

.preview-overlay span {
    font-size: 13px;
    max-width: 260px;
}

.preview-loading {
    padding: var(--mobile-pad);
    gap: 10px;
    will-change: transform;
    contain: layout style paint;
}

.preview-loading-label {
    min-height: 22px;
    padding: 0 9px;
    font-size: 9px;
    letter-spacing: 1.2px;
}

.preview-loading-visual {
    width: 104px;
    height: 104px;
    will-change: transform;
    contain: layout style paint;
}

.preview-loading strong {
    font-size: 16px;
}

.preview-loading span {
    font-size: 13px;
}

.preview-progress-wrap {
    max-width: 180px;
    height: 4px;
    border-radius: 3px;
    margin-top: 6px;
}

.preview-progress-bar {
    border-radius: 3px;
    will-change: width;
}

.preview-progress-text {
    font-size: 28px;
    will-change: transform;
}

.result-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: var(--mobile-pad);
    border-radius: var(--mobile-radius);
}

.result-actions-main strong {
    font-size: 16px;
}

.result-actions-main span {
    font-size: 13px;
}

.result-actions-buttons {
    width: 100%;
    gap: 8px;
}

.result-actions-buttons .btn {
    width: 100%;
    justify-content: center;
}

/* ============================================================
   Prompt Panel - 提示词面板
   ============================================================ */
.prompt-panel {
    height: auto;
    padding: var(--mobile-pad);
    border-radius: var(--mobile-radius);
    backdrop-filter: none;
    padding-bottom: calc(var(--mobile-pad) + var(--tab-bar-height) + var(--safe-bottom));
}

.prompt-input-wrap {
    flex: none;
}

.workflow-card {
    margin-bottom: 14px;
    padding: var(--mobile-pad);
    border-radius: var(--mobile-radius);
}

.workflow-header strong {
    font-size: 16px;
}

.workflow-header span {
    font-size: 13px;
}

.workflow-steps {
    grid-template-columns: 1fr;
    gap: 8px;
}

.workflow-step {
    padding: 14px;
    border-radius: 12px;
}

.workflow-step strong {
    font-size: 14px;
}

.workflow-step small {
    font-size: 12px;
}

.prompt-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.prompt-title strong {
    font-size: 16px;
}

.prompt-title span {
    font-size: 13px;
}

.prompt-badge {
    font-size: 12px;
    padding: 7px 12px;
}

.prompt-input {
    font-size: 15px;
    min-height: 90px;
    height: 90px;
    max-height: 200px;
    line-height: 1.7;
    flex: none;
    padding-right: 36px;
    box-shadow: inset 0 2px 8px rgba(69,105,168,0.04);
}

.prompt-clear-btn {
    top: 4px;
    right: 2px;
    width: 26px;
    height: 26px;
}

.prompt-input::placeholder {
    font-size: 14px;
}

.prompt-char-count {
    font-size: 11px;
    bottom: 2px;
}

.prompt-presets {
    gap: 8px;
    margin-top: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
    mask-image: linear-gradient(to right, transparent 0%, #000 6%, #000 94%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 6%, #000 94%, transparent 100%);
}

.prompt-presets::-webkit-scrollbar {
    display: none;
}

.preset-tag {
    padding: 7px 15px;
    font-size: 13px;
    min-height: 38px;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 20px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-medium);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    color: var(--text-soft);
}

/* ============================================================
   Reference Panel - 参考图面板
   ============================================================ */
.reference-panel {
    padding: var(--mobile-pad);
    border-radius: var(--mobile-radius);
    margin-top: var(--mobile-gap);
}

.reference-panel.is-collapsed .reference-panel-content {
    display: none !important;
}

.reference-header {
    flex-direction: column;
    align-items: stretch;
}

.reference-header strong {
    font-size: 15px;
}

.reference-header span {
    font-size: 12px;
}

.reference-grid {
    grid-template-columns: 1fr;
    gap: 10px;
}

.reference-toggle {
    width: 100%;
    height: 44px;
    margin-top: 12px;
    justify-content: center;
    border-radius: 12px;
}

.reference-upload-item {
    min-height: 150px;
    border-radius: var(--mobile-radius);
}

.reference-upload-content {
    min-height: 150px;
    padding: var(--mobile-pad);
    gap: 8px;
}

.reference-upload-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
}

.reference-upload-icon svg {
    width: 24px;
    height: 24px;
}

.reference-upload-content strong {
    font-size: 14px;
}

.reference-upload-text {
    font-size: 12px;
}

.reference-remove-btn {
    width: 36px;
    height: 36px;
    top: 8px;
    right: 8px;
    font-size: 20px;
}

/* ============================================================
   Toolbar & Bottom Sheet Selectors - 底部弹出面板
   ============================================================ */
.toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 10px;
}

.toolbar-left {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.dropdown {
    flex: none;
    min-width: 0;
    position: relative;
}

/* 移动端下拉改为底部弹出面板 */
.dropdown-toggle {
    width: 100%;
    justify-content: center;
    padding: 12px 8px;
    font-size: 13px;
    min-height: 44px;
    border-radius: 12px;
    gap: 4px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-medium);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.dropdown-toggle:active {
    transform: scale(0.97);
    background: rgba(63, 125, 255, 0.06);
}

.dropdown-toggle svg:last-child {
    display: none;
}

.dropdown-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 910;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border-radius: 20px 20px 0 0;
    padding: 8px 16px calc(16px + var(--tab-bar-height) + var(--safe-bottom));
    box-shadow: 0 -8px 40px rgba(69, 105, 168, 0.15);
    max-height: 70vh;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    gap: 4px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.dropdown-menu::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(95, 146, 219, 0.2);
    margin: 8px auto 12px;
    flex-shrink: 0;
}

.dropdown.open .dropdown-menu {
    display: flex;
    transform: translateY(0);
}

/* 底部面板遮罩 */
.mobile-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 901;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-sheet-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.menu-item {
    padding: 14px 16px;
    border-radius: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: left;
    width: 100%;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.menu-item:active {
    transform: scale(0.98);
    background: rgba(63, 125, 255, 0.08);
}

.menu-item.active {
    background: linear-gradient(180deg, rgba(63,125,255,0.1), rgba(63,125,255,0.05));
    color: var(--blue-deep);
}

.menu-item.active .menu-main {
    font-weight: 700;
}

.menu-main {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.menu-sub {
    font-size: 12px;
    color: var(--text-soft);
}

.menu-item.active .menu-sub {
    color: var(--blue);
}

/* ============================================================
   Generate Button - 生成按钮
   ============================================================ */
.generate-btn {
    width: 100%;
    height: 52px;
    padding: 0 24px;
    font-size: 16px;
    border-radius: 14px;
    gap: 10px;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.2s ease;
}

.generate-btn:active {
    transform: scale(0.96);
    transition: transform 0.08s ease;
}

.generate-btn::before {
    display: none;
}

.generate-btn:hover {
    transform: none;
}

.generate-btn.is-expensive {
    box-shadow: 0 8px 20px rgba(231,76,60,0.24);
}

.generate-summary {
    margin-top: 12px;
    padding: var(--mobile-pad);
    border-radius: var(--mobile-radius);
    flex-direction: column;
    align-items: flex-start;
}

.generate-summary-main strong {
    font-size: 15px;
}

.generate-summary-main span {
    font-size: 13px;
}

.generate-summary-side {
    width: 100%;
    gap: 8px;
}

.generate-summary-side span {
    min-height: 38px;
    padding: 0 12px;
    font-size: 12px;
}

/* ============================================================
   Right Pane / Side Panel
   ============================================================ */
.right-pane {
    padding: var(--mobile-pad);
    border-left: 0;
    border-top: 1px solid rgba(93,140,211,0.1);
    background: rgba(255,255,255,0.5);
}

.side-panel {
    padding: var(--mobile-pad);
    gap: var(--mobile-gap);
    border-radius: var(--mobile-radius);
    box-shadow: 0 4px 16px rgba(69,105,168,0.06);
    backdrop-filter: none;
}

.panel-header {
    padding-bottom: 10px;
}

.panel-header strong {
    font-size: 18px;
}

.panel-header span {
    font-size: 13px;
}

.settings-group {
    gap: 12px;
}

.section-title {
    font-size: 14px;
}

.ratio-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.ratio-btn {
    height: 48px;
    font-size: 13px;
    border-radius: 12px;
}

.quality-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.quality-btn {
    height: 48px;
    font-size: 13px;
    border-radius: 12px;
}

.resolution-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.resolution-btn {
    height: 48px;
    font-size: 13px;
    border-radius: 12px;
}

.tip-card {
    padding: var(--mobile-pad);
    border-radius: var(--mobile-radius);
}

.tip-card strong {
    font-size: 15px;
}

.tip-card span {
    font-size: 13px;
}

/* ============================================================
   Footer - 移动端隐藏底部footer
   ============================================================ */
.footer-bar {
    display: none;
}

/* ============================================================
   History Page V2 - 历史记录移动端
   ============================================================ */
.history-section {
    padding: var(--mobile-pad);
    padding-bottom: calc(var(--mobile-pad) + var(--tab-bar-height) + var(--safe-bottom) + 16px);
}

/* Header */
.history-header-v2 {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.history-header-v2__title {
    font-size: 20px;
}

.history-header-v2__sub,
.history-header-v2__hint {
    font-size: 12px;
}

.history-clear-expired-btn {
    font-size: 13px;
}

/* Action bar */
.history-action-bar {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

/* ── 移动端搜索框全宽，独占一行 ── */
.history-search-form {
    flex: 1 1 100%;
    max-width: 100%;
    order: -1;
}

.history-search-input {
    height: 44px;
    font-size: 15px;
    border-radius: 12px;
}

.history-search-icon {
    left: 14px;
}

.history-search-clear {
    right: 10px;
    width: 28px;
    height: 28px;
    font-size: 18px;
}

.btn-batch-manage {
    height: 40px;
    font-size: 13px;
    padding: 0 16px;
}

.btn-new-generate {
    height: 42px;
    font-size: 13px;
    padding: 0 18px;
}

/* Grid */
.history-grid-v2 {
    grid-template-columns: 1fr;
    gap: 14px;
}

/* Card */
.history-card-v2 {
    border-radius: var(--mobile-radius);
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.history-card-v2:hover {
    transform: none;
}

.card-thumb-v2 {
    aspect-ratio: 4/3;
}

.card-status-tag {
    top: 8px;
    right: 8px;
    padding: 5px 12px;
    font-size: 12px;
}

.card-info-v2__title {
    font-size: 15px;
}

.card-info-v2__params {
    font-size: 12px;
    gap: 3px 10px;
}

.card-param {
    font-size: 12px;
}

.card-info-v2__time {
    font-size: 11px;
}

.card-actions-v2 {
    gap: 6px;
    padding: 10px 12px 12px;
}

.card-action-btn {
    height: 44px;
    font-size: 13px;
    padding: 0 14px;
    min-width: 44px;
    border-radius: 10px;
}

.card-action-btn--icon {
    width: 44px;
    padding: 0;
}

.card-delete-btn {
    height: 44px;
    font-size: 13px;
    padding: 0 14px;
    border-radius: 10px;
}

/* Batch mode */
.is-batch-mode .card-batch-check {
    display: inline-flex;
    width: 32px;
    height: 32px;
}

.card-batch-checkmark {
    width: 24px;
    height: 24px;
}

.batch-bottom-bar {
    position: sticky;
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom, 0px) + 8px);
    z-index: 50;
    margin: 16px calc(-1 * var(--mobile-pad)) 0;
    padding: 12px 14px;
}

.batch-bottom-bar__inner {
    flex-wrap: wrap;
    gap: 10px;
}

.batch-bottom-bar__actions {
    width: 100%;
    justify-content: flex-end;
    gap: 8px;
}

.batch-bottom-btn {
    height: 38px;
    padding: 0 12px;
    font-size: 12px;
}

/* More menu */
.card-more {
    position: relative;
}

.card-more-menu {
    min-width: 170px;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(69, 105, 168, 0.18);
    bottom: calc(100% + 10px);
}

.card-more-item {
    height: 42px;
    font-size: 13px;
    border-radius: 10px;
}

.card-more-item:active {
    transform: scale(0.98);
    background: rgba(95, 146, 219, 0.08);
}

/* Empty state */
.history-empty {
    padding: 60px 20px;
}

.history-empty__illustration {
    width: 120px;
    height: 120px;
}

/* ============================================================
   Auth Pages (Login / Register) - 认证页面移动端
   ============================================================ */
.auth-page {
    padding: var(--mobile-pad);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 100%;
    padding: 32px 20px;
    border-radius: 22px;
    box-shadow:
        0 18px 40px rgba(69,105,168,0.1),
        0 4px 12px rgba(69,105,168,0.04);
    backdrop-filter: none;
    animation: mobileFadeUp 0.4s ease;
}

.auth-card .brand {
    margin-bottom: 20px;
    justify-content: center;
}

.auth-card h2 {
    font-size: 26px;
    text-align: center;
}

.auth-card .subtitle {
    font-size: 14px;
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
    font-weight: 600;
    color: var(--text);
}

.form-input {
    height: 52px;
    padding: 0 16px;
    font-size: 16px;
    border-radius: 13px;
    width: 100%;
}

.pwd-wrap .form-input {
    padding-right: 56px;
}

.pwd-toggle {
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.form-submit {
    height: 52px;
    font-size: 16px;
    border-radius: 13px;
    margin-top: 16px;
    width: 100%;
}

.form-footer {
    font-size: 14px;
    margin-top: 18px;
    text-align: center;
}

.form-helper {
    font-size: 13px;
}

.form-error,
.form-success {
    font-size: 13px;
    padding: 14px 16px;
    border-radius: 12px;
}

.agreement-modal {
    padding: 12px;
}

.agreement-modal__dialog {
    width: 100%;
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 22px;
}

.agreement-modal__header {
    padding: 22px 18px 12px;
}

.agreement-modal__header h3 {
    font-size: 21px;
    padding-right: 34px;
}

.agreement-modal__header p,
.agreement-modal__content p,
.agreement-modal__content ol,
.agreement-modal__content ul,
.agreement-modal__content blockquote {
    font-size: 13px;
}

.agreement-modal__meta {
    padding: 0 18px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.agreement-modal__summary {
    margin: 0 12px 10px;
    padding: 14px 16px;
    font-size: 12px;
    border-radius: 14px;
}

.agreement-modal__content {
    margin: 0 12px;
    padding: 18px 16px 4px;
    border-radius: 18px;
    min-height: 220px;
    margin-bottom: 0;
}

.agreement-modal__content h1 {
    font-size: 18px;
}

.agreement-modal__content h2 {
    font-size: 16px;
}

.agreement-modal__content h3 {
    font-size: 14px;
}

.agreement-modal__footer {
    padding: 0 12px;
    max-height: none;
    overflow: hidden;
}

.agreement-modal__dialog.is-signature-revealed .agreement-modal__footer {
    padding: 14px 12px 12px;
    max-height: 360px;
}

.agreement-modal__footer::before {
    top: 8px;
    width: 46px;
    height: 4px;
}

.agreement-signature {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 18px 12px 12px;
    border-radius: 16px;
    max-height: 100%;
}

.agreement-signature .form-group label {
    margin-bottom: 6px;
    font-size: 13px;
}

.agreement-signature .form-input {
    height: 46px;
    font-size: 15px;
    border-radius: 12px;
}

.agreement-checkbox {
    font-size: 12px;
    gap: 8px;
    line-height: 1.55;
}

.agreement-checkbox input {
    width: 16px;
    height: 16px;
}

.agreement-modal__actions {
    flex-direction: column-reverse;
    gap: 8px;
    margin-top: 12px;
}

.agreement-modal__actions .btn {
    width: 100%;
    justify-content: center;
    height: 44px;
}

/* 修改密码弹窗 */
.account-modal {
    padding: 12px;
}

.account-modal__dialog {
    width: 100%;
    padding: 24px 16px 16px;
    border-radius: 22px;
}

.account-modal__header h3 {
    font-size: 22px;
}

.account-modal__header p {
    font-size: 13px;
}

.account-modal__actions {
    flex-direction: column-reverse;
}

.account-modal__actions .btn {
    width: 100%;
    justify-content: center;
    height: 48px;
    font-size: 14px;
}

/* 账号弹窗表单 */
.account-modal__form .form-group {
    margin-bottom: 14px;
}

.account-modal__form .form-input {
    height: 48px;
    font-size: 15px;
}

/* ============================================================
   Recharge Page - 充值页面移动端
   ============================================================ */
.recharge-page {
    padding: var(--mobile-pad);
    gap: 14px;
    padding-bottom: calc(var(--mobile-pad) + var(--tab-bar-height) + var(--safe-bottom) + 16px);
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
}

.recharge-hero {
    grid-template-columns: 1fr;
    padding: var(--mobile-pad);
    border-radius: var(--mobile-radius);
    gap: 14px;
}

.recharge-hero h1 {
    font-size: 26px;
}

.recharge-hero p {
    font-size: 13px;
}

.recharge-balance-card {
    min-width: 0;
    border-radius: var(--mobile-radius);
}

.recharge-inline-stats {
    gap: 10px;
}

.recharge-inline-stat {
    min-width: calc(50% - 5px);
    flex: 1 1 calc(50% - 5px);
}

.recharge-hero-actions,
.recharge-hero-points,
.recharge-hero-strip {
    flex-direction: column;
}

.recharge-hero-actions .btn,
.recharge-hero-points span {
    width: 100%;
    justify-content: center;
}

.recharge-hero-strip {
    display: grid;
    grid-template-columns: 1fr;
}

.recharge-balance-card-head,
.recharge-balance-card-foot {
    flex-direction: column;
    align-items: flex-start;
}

.recharge-hero-visual {
    min-height: 220px;
}

.recharge-float-card {
    width: calc(100% - 18px);
}

.recharge-visual-core {
    position: relative;
    inset: auto;
    transform: none;
    width: 100%;
    margin-bottom: 12px;
}

.recharge-balance-card strong {
    font-size: 32px;
}

.gateway-banner,
.recharge-section {
    padding: var(--mobile-pad);
    border-radius: var(--mobile-radius);
}

.recharge-section {
    padding: 18px 16px;
    overflow: visible;
}

.gateway-banner-top {
    flex-direction: column;
    align-items: flex-start;
}

.gateway-banner-grid {
    grid-template-columns: 1fr;
}

.recharge-layout {
    grid-template-columns: 1fr;
    gap: 14px;
}

.recharge-history {
    padding: 18px 14px;
}

.recharge-history .table-wrap {
    border-radius: 14px;
    -webkit-overflow-scrolling: touch;
}

.recharge-history table th,
.recharge-history table td {
    padding: 14px 12px;
    font-size: 12px;
}

.plan-grid {
    grid-template-columns: 1fr;
    gap: 12px;
}

.plan-card {
    padding: 18px;
    border-radius: var(--mobile-radius);
    gap: 12px;
}

.plan-card:active {
    transform: scale(0.98);
}

.plan-card-header {
    align-items: center;
    min-height: 28px;
}

.plan-name {
    font-size: 16px;
}

.plan-card.is-popular .plan-amount {
    font-size: 32px;
}

.plan-currency {
    font-size: 15px;
    margin-top: 2px;
}

.plan-amount {
    font-size: 28px;
}

.plan-unit-price {
    margin-bottom: 2px;
    font-size: 10px;
    padding: 3px 8px;
}

.plan-card-top {
    align-items: flex-start;
}

.plan-order-mark {
    font-size: 22px;
}

.plan-card p {
    min-height: 0;
}

.plan-price {
    font-size: 28px;
}

.plan-price-row {
    flex-direction: column;
    align-items: flex-start;
}

.plan-credits-box {
    padding: 12px 14px;
    gap: 12px;
}

.plan-credits-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
}

.plan-credits-text strong {
    font-size: 16px;
}

.plan-badge {
    padding: 4px 10px;
    font-size: 10px;
}

.plan-pay-btn {
    height: 44px;
    font-size: 13px;
    width: 100%;
}

.plan-card-footer form {
    width: 100%;
}

.cashier-meta {
    grid-template-columns: 1fr;
}

.cashier-card {
    position: static;
}

.cashier-focus,
.alipay-pay-box {
    flex-direction: column;
    align-items: flex-start;
}

.cashier-focus-panel,
.cashier-steps,
.cashier-empty-grid {
    grid-template-columns: 1fr;
}

/* 订单横幅移动端 */
.order-banner {
    flex-direction: column;
    gap: 14px;
    padding: 16px;
}

.order-banner-left,
.order-banner-right {
    width: 100%;
}

.order-banner-actions {
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.order-banner-actions .btn,
.order-banner-actions form {
    width: 100%;
}

.order-banner-actions .btn {
    justify-content: center;
}

/* ============================================================
   Admin Pages (不包含管理页面的底部Tab)
   ============================================================ */
.admin-page {
    padding: var(--mobile-pad);
    max-width: 100%;
}

.admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.admin-header h2 {
    font-size: 24px;
}

.admin-header-actions {
    width: 100%;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-header-actions .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

/* ============================================================
   Utility: Touch-friendly form inputs
   ============================================================ */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
textarea,
select {
    font-size: 16px;
}

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}

/* ============================================================
   Pull to Refresh
   ============================================================ */
.ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(69, 105, 168, 0.18);
    color: var(--text-soft, #6882a8);
    font-size: 13px;
    font-weight: 500;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1.2);
    pointer-events: none;
    user-select: none;
}

.ptr-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.ptr-label {
    white-space: nowrap;
}

/* 开始下拉 - 显示指示器 */
.ptr-indicator.is-pulling {
    transform: translateX(-50%) translateY(18px);
    color: var(--text, #13315b);
}

/* 达到阈值 - 松手即可刷新 */
.ptr-indicator.is-ready {
    transform: translateX(-50%) translateY(18px);
    color: var(--blue, #3f7dff);
    box-shadow: 0 4px 24px rgba(63, 125, 255, 0.28);
}

.ptr-indicator.is-ready .ptr-icon {
    transform: rotate(180deg);
}

/* 刷新中 */
.ptr-indicator.is-refreshing {
    transform: translateX(-50%) translateY(18px);
    color: var(--blue, #3f7dff);
    box-shadow: 0 4px 24px rgba(63, 125, 255, 0.28);
}

.ptr-indicator.is-refreshing .ptr-icon {
    animation: ptrSpin 0.7s linear infinite;
}

@keyframes ptrSpin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   Skeleton Loading
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, rgba(95, 146, 219, 0.06) 25%, rgba(95, 146, 219, 0.12) 50%, rgba(95, 146, 219, 0.06) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 10px;
}

.skeleton--text {
    height: 14px;
    margin-bottom: 8px;
    width: 80%;
}

.skeleton--text-short {
    height: 14px;
    width: 50%;
    margin-bottom: 8px;
}

.skeleton--thumb {
    aspect-ratio: 4/3;
    border-radius: 12px;
}

.skeleton--card {
    padding: 14px;
    border-radius: var(--mobile-radius);
    background: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   Page Transition Animation
   ============================================================ */
.shell {
    animation: mobileFadeIn 0.35s ease;
}

.auth-card {
    animation: mobileFadeUp 0.4s ease;
}

@keyframes mobileFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes mobileFadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ============================================================
   Reduce motion preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .shell,
    .auth-card,
    .generate-btn,
    .history-card,
    .stat-card {
        animation: none;
        transition: none;
    }

    .preview-overlay svg {
        animation: none;
    }
}

/* ============================================================
   Dark Mode Overrides for Mobile
   ============================================================ */
[data-theme="dark"] body {
    background:
        radial-gradient(circle at 12% 12%, rgba(20,28,50,0.98), transparent 28%),
        radial-gradient(circle at 86% 16%, rgba(30,48,80,0.5), transparent 24%),
        radial-gradient(circle at 80% 80%, rgba(25,40,70,0.55), transparent 22%),
        linear-gradient(180deg, #0d1525 0%, #101a2c 46%, #0f1724 100%);
}

[data-theme="dark"] .mobile-tab-bar {
    background: rgba(18, 26, 44, 0.86);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.2),
        0 8px 28px rgba(0, 0, 0, 0.3),
        0 16px 48px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .mobile-tab-bar::before {
    background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 40%);
}

[data-theme="dark"] .mobile-tab-item {
    color: #5a6e8c;
}

[data-theme="dark"] .mobile-tab-item.is-active {
    color: #6db3ff;
    background: rgba(94, 162, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(94, 162, 255, 0.1);
}

[data-theme="dark"] .mobile-tab-item.is-active::before {
    background: linear-gradient(180deg, rgba(94, 162, 255, 0.08), rgba(94, 162, 255, 0.02));
}

[data-theme="dark"] .mobile-tab-item.is-active .mobile-tab-icon {
    filter: drop-shadow(0 2px 8px rgba(94, 162, 255, 0.4));
}

[data-theme="dark"] .top-nav {
    background: rgba(15, 22, 40, 0.9);
    border-bottom-color: rgba(110, 150, 210, 0.08);
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
}

[data-theme="dark"] .top-nav.is-scrolled {
    background: rgba(15, 22, 40, 0.96);
    border-bottom-color: var(--border-medium);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.24);
}

[data-theme="dark"] .nav-actions {
    background: rgba(20, 30, 50, 0.72);
    border-color: var(--border-medium);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .nav-actions > .btn {
    color: var(--text-soft);
}

[data-theme="dark"] .dropdown-menu {
    background: rgba(18, 26, 44, 0.98);
    color: #bcc8dd;
}

[data-theme="dark"] .dropdown-menu::before {
    background: rgba(110, 150, 210, 0.2);
}

[data-theme="dark"] .dropdown-toggle {
    background: rgba(20, 30, 50, 0.7);
    border-color: rgba(110, 150, 210, 0.15);
    color: #bcc8dd;
}

[data-theme="dark"] .menu-item {
    color: #bcc8dd;
}

[data-theme="dark"] .menu-item.active {
    background: linear-gradient(180deg, rgba(94, 162, 255, 0.15), rgba(94, 162, 255, 0.06));
    color: #5ea2ff;
}

[data-theme="dark"] .menu-main {
    color: #dce4f0;
}

[data-theme="dark"] .menu-sub {
    color: #8a9bb5;
}

[data-theme="dark"] .left-pane {
    background:
        linear-gradient(180deg, rgba(18, 26, 45, 0.4), rgba(15, 22, 38, 0.2)),
        radial-gradient(circle at top left, var(--bg-tint-light), transparent 30%);
}

[data-theme="dark"] .right-pane {
    border-top-color: rgba(110, 150, 210, 0.1);
    background: rgba(18, 26, 44, 0.5);
}

[data-theme="dark"] .side-panel {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .mobile-sheet-overlay {
    background: rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .theme-toggle-float {
    background: rgba(20, 30, 50, 0.84);
    border-color: rgba(110, 150, 210, 0.18);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

/* ── Dark mode: History Page V2 ── */
[data-theme="dark"] .history-header-v2__title { color: #d0dff0; }
[data-theme="dark"] .history-header-v2__sub,
[data-theme="dark"] .history-header-v2__hint { color: #6b85a6; }
[data-theme="dark"] .history-clear-expired-btn { color: #5c97ff; }

[data-theme="dark"] .btn-batch-manage {
    background: rgba(20,30,50,0.8);
    border-color: rgba(110,150,210,0.2);
    color: #8598b8;
}
[data-theme="dark"] .btn-batch-manage:active {
    background: rgba(63,125,255,0.12);
}

[data-theme="dark"] .history-card-v2 {
    background: rgba(20,28,46,0.88);
    border-color: var(--border);
}
[data-theme="dark"] .history-card-v2:hover {
    border-color: rgba(63,125,255,0.22);
}
[data-theme="dark"] .history-card-v2.is-expired { opacity: 0.4; }
[data-theme="dark"] .card-thumb-v2 {
    background: linear-gradient(160deg, #1a2840 0%, #203258 40%, #1e3d6e 72%, #15428f 100%);
}
[data-theme="dark"] .card-info-v2__title { color: #c8d6e8; }
[data-theme="dark"] .card-info-v2__params { color: #5c7294; }
[data-theme="dark"] .card-param { color: #5c7294; }
[data-theme="dark"] .card-info-v2__time { color: #4a5e7a; }
[data-theme="dark"] .card-actions-v2 { border-top-color: rgba(110,150,210,0.08); }
[data-theme="dark"] .card-action-btn {
    background: rgba(95,146,219,0.06);
    color: #7a92b0;
}
[data-theme="dark"] .card-action-btn:active {
    background: rgba(63,125,255,0.14);
    color: #7cb0ff;
}
[data-theme="dark"] .card-delete-btn { color: #5c6e8a; }
[data-theme="dark"] .card-delete-btn:active {
    background: rgba(231,76,60,0.12);
    color: #f09090;
}
[data-theme="dark"] .card-more-menu {
    background: rgba(20,30,50,0.98);
    border-color: rgba(110,150,210,0.18);
}
[data-theme="dark"] .card-more-item { color: #8598b8; }
[data-theme="dark"] .card-more-item:active {
    background: rgba(63,125,255,0.1);
    color: #7cb0ff;
}
[data-theme="dark"] .batch-bottom-bar {
    background: rgba(18,26,44,0.96);
    border-top-color: rgba(110,150,210,0.15);
}
[data-theme="dark"] .batch-bottom-bar__check { color: #8598b8; }
[data-theme="dark"] .batch-bottom-bar__count { color: #6b85a6; }
[data-theme="dark"] .batch-bottom-btn--download {
    background: rgba(63,125,255,0.12);
    color: #7cb0ff;
}
[data-theme="dark"] .batch-bottom-btn--delete {
    background: rgba(231,76,60,0.08);
    color: #f09090;
}
[data-theme="dark"] .batch-bottom-btn--cancel {
    color: #8598b8;
    border-color: rgba(110,150,210,0.18);
}
[data-theme="dark"] .history-empty strong { color: #7a92b0; }
[data-theme="dark"] .history-empty span { color: #5c7294; }

/* ============================================================
   Print styles
   ============================================================ */
@media print {
    .mobile-tab-bar,
    .mobile-fab,
    .mobile-sheet-overlay,
    .top-nav,
    .footer-bar,
    .toolbar,
    .right-pane,
    .generate-btn,
    .toast,
    .lightbox {
        display: none !important;
    }

    .shell {
        box-shadow: none;
        border: 0;
    }

    body {
        background: #fff;
        padding-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .preview-loading *,
    .preview-loading *::before,
    .preview-loading *::after {
        animation-duration: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.15s !important;
    }
}

/* ============================================================
   Dark mode loading state overrides
   ============================================================ */
[data-theme="dark"] .preview-loading {
    background:
        radial-gradient(circle at 50% 46%, rgba(86, 164, 255, 0.15), transparent 32%),
        linear-gradient(180deg, rgba(4, 18, 40, 0.7), rgba(6, 18, 44, 0.8));
}

[data-theme="dark"] .preview-loading strong {
    color: #dce4f0;
}

[data-theme="dark"] .preview-loading span {
    color: rgba(180, 200, 220, 0.84);
}

[data-theme="dark"] .preview-progress-wrap {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .preview-progress-text {
    color: rgba(220, 235, 250, 0.9);
}

/* Admin float button - mobile */
.admin-float-btn {
    display: flex;
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom, 0px) + 16px);
    right: 16px;
    padding: 8px 14px;
    font-size: 13px;
    gap: 6px;
}

.admin-float-btn svg {
    width: 18px;
    height: 18px;
}

[data-theme="dark"] .admin-float-btn {
    background: linear-gradient(135deg, rgba(40,75,140,0.94), rgba(28,56,110,0.96));
    border-color: rgba(255,255,255,0.14);
}

    /* 移动端顶部导航隐藏充值和主题按钮 */
    .nav-user .btn[data-recharge-trigger],
    .nav-actions > .theme-toggle {
        display: none;
    }

} /* end @media (max-width: 768px) */

/* ============================================================
   Small phone optimizations (< 420px)
   ============================================================ */
@media (max-width: 420px) {
    .nav-actions {
        gap: 3px;
        padding: 3px;
    }

    .nav-user {
        padding: 2px 2px 2px 0;
        gap: 5px;
    }

    .nav-user strong {
        display: none;
    }

    .nav-actions > .btn {
        height: 32px;
        padding: 0 10px;
        font-size: 11px;
    }

    .nav-user .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .nav-user .nav-credits {
        min-height: 24px;
        padding: 0 7px;
        font-size: 10px;
    }

    .toolbar-left {
        gap: 6px;
    }

    .dropdown-toggle {
        padding: 10px 6px;
        font-size: 12px;
        min-height: 40px;
    }

    .generate-btn {
        height: 48px;
        font-size: 15px;
    }

    .mobile-tab-item {
        min-width: 48px;
        padding: 4px 4px;
        gap: 2px;
    }

    .mobile-tab-icon {
        width: 20px;
        height: 20px;
    }

    .mobile-tab-label {
        font-size: 9px;
    }

    .mobile-tab-avatar {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .plan-pay-btn {
        height: 40px;
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .top-nav {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .brand {
        justify-self: center;
    }

    .brand > a {
        justify-content: center;
    }

    .nav-actions {
        width: 100%;
        justify-self: stretch;
        justify-content: center;
    }

    .toolbar-left {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .dropdown-toggle {
        font-size: 11px;
        padding: 8px 4px;
    }

    .dropdown-toggle span {
        font-size: 11px;
    }

    .dropdown-toggle svg:first-child {
        width: 12px;
        height: 12px;
    }
}
