/* ============================================================
   豆图工坊 v2.1 手机端编辑页重构样式
   橙色主题 + 半透明磨砂玻璃卡片效果
   仅在 max-width: 767px 时生效，不影响电脑端
   ============================================================ */

@media (max-width: 1024px) {
  /* ===== 全局重置：隐藏原有编辑器布局，显示新布局 ===== */
  /* 确保页面可滚动 */
  html, body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
  }

  /* 非编辑页时强制隐藏新布局 */
  body:not(.douTu-editor-active) #mobile-editor-v2 {
    display: none !important;
  }

  #editor-page {
    display: none !important;
  }

  body.douTu-editor-active #mobile-editor-v2 {
    display: flex !important;
  }

  /* 隐藏原有的移动端元素 */
  .mobile-tab-bar,
  .mobile-bottom-panel,
  .mobile-panel-overlay,
  .mobile-fab,
  .mobile-undo-fab,
  .minimal-toolbar,
  .minimal-exit-btn,
  .floating-toolbar,
  .floating-stats-bar {
    display: none !important;
  }

  /* ===== 新布局根容器 ===== */
  #mobile-editor-v2 {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(160deg, #fff5eb 0%, #ffe8d1 40%, #ffd9b3 100%);
    position: relative;
    overflow-x: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* 深色模式适配 */
  body:not(.light-theme) #mobile-editor-v2 {
    background: linear-gradient(160deg, #2a1f14 0%, #1f1810 40%, #18120c 100%);
  }

  /* ===== 顶部栏 ===== */
  .mev2-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    position: sticky;
    top: 0;
    z-index: 100;
  }

  body:not(.light-theme) .mev2-topbar {
    background: rgba(40, 32, 22, 0.6);
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }

  .mev2-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mev2-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    background: linear-gradient(145deg, #ff9d3d, #ff7a18);
    display: grid;
    place-items: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 8px 20px rgba(255, 122, 24, 0.25);
  }

  .mev2-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
  }

  .mev2-brand-title {
    font-size: 16px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: 0.3px;
  }

  body:not(.light-theme) .mev2-brand-title {
    color: #f0f0f0;
  }

  .mev2-brand-sub {
    font-size: 10px;
    color: #888;
    margin-top: 1px;
  }

  body:not(.light-theme) .mev2-brand-sub {
    color: #999;
  }

  .mev2-top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mev2-top-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.7);
    color: #333;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mev2-top-btn:active {
    transform: scale(0.95);
  }

  body:not(.light-theme) .mev2-top-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e0e0e0;
  }

  .mev2-top-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mev2-top-btn.export-btn {
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(255, 122, 24, 0.4);
  }

  .mev2-top-btn.export-btn:active {
    background: linear-gradient(135deg, #ffa64d, #ff8a24);
  }

  /* ===== 画布区域 ===== */
  .mev2-canvas-section {
    position: relative;
    margin: 12px 12px 0;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    height: 45vh;
    min-height: 280px;
    max-height: 50vh;
    touch-action: none;
  }

  body:not(.light-theme) .mev2-canvas-section {
    background: rgba(40, 32, 22, 0.4);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }

  .mev2-canvas-section .canvas-wrapper {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 16px !important;
    overflow: hidden !important;
  }

  .mev2-canvas-section .canvas-container {
    /* 不设置100%宽高，保持原有内容自适应布局，由transform控制缩放 */
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  /* 隐藏电脑端旧按钮，避免与手机端新按钮重叠（非全屏+全屏） */
  .mev2-canvas-section .view-toggle-btn,
  .mev2-canvas-section .change-image-btn,
  .mev2-fs-canvas-container .view-toggle-btn,
  .mev2-fs-canvas-container .change-image-btn {
    display: none !important;
  }

  .mev2-canvas-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.6);
    padding: 3px 10px;
    border-radius: 8px;
    pointer-events: none;
    z-index: 5;
    white-space: nowrap;
  }

  body:not(.light-theme) .mev2-canvas-hint {
    color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.3);
  }

  /* ===== 通用卡片样式 ===== */
  .mev2-card {
    position: relative;
    z-index: 1;
    margin: 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px) saturate(170%);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
    overflow: visible;
  }
  .mev2-card.dropdown-active {
    z-index: 100;
  }

  body:not(.light-theme) .mev2-card {
    background: rgba(40, 32, 22, 0.55);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  }

  .mev2-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
  }

  .mev2-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  body:not(.light-theme) .mev2-card-title {
    color: #f0f0f0;
  }

  .mev2-card-title-icon {
    font-size: 16px;
  }

  .mev2-card-body {
    padding: 0 16px 16px;
  }

  /* ===== 参数设置板块 ===== */
  .mev2-param-row {
    margin-bottom: 16px;
  }

  .mev2-param-row:last-child {
    margin-bottom: 0;
  }

  .mev2-param-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
  }

  .mev2-param-label-text {
    font-size: 13px;
    font-weight: 600;
    color: #444;
  }

  body:not(.light-theme) .mev2-param-label-text {
    color: #ccc;
  }

  .mev2-param-value {
    font-size: 13px;
    font-weight: 700;
    color: #ff7a18;
    font-variant-numeric: tabular-nums;
  }

  /* 滑块通用样式 */
  .mev2-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.08);
    outline: none;
    cursor: pointer;
  }

  body:not(.light-theme) .mev2-slider {
    background: rgba(255, 255, 255, 0.12);
  }

  .mev2-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(255, 122, 24, 0.45);
    border: 2px solid #fff;
    transition: transform 0.15s ease;
  }

  .mev2-slider::-webkit-slider-thumb:active {
    transform: scale(1.2);
  }

  .mev2-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(255, 122, 24, 0.45);
    border: 2px solid #fff;
  }

  .mev2-slider:disabled {
    opacity: 0.4;
    pointer-events: none;
  }

  /* 输入框 + 按钮行 */
  .mev2-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
  }

  .mev2-number-input {
    flex: 1;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
  }

  .mev2-number-input:focus {
    border-color: #ff7a18;
    box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.15);
  }

  .mev2-number-input:disabled {
    opacity: 0.4;
  }

  body:not(.light-theme) .mev2-number-input {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e0e0e0;
  }

  .mev2-confirm-btn {
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
  }

  .mev2-confirm-btn:active {
    transform: scale(0.95);
  }

  .mev2-confirm-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
  }

  #mev2-fit-ratio.active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #ff7a18;
  }

  /* 开关样式 */
  .mev2-switch {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 13px;
    background: rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: background 0.25s ease;
    flex-shrink: 0;
  }

  body:not(.light-theme) .mev2-switch {
    background: rgba(255, 255, 255, 0.15);
  }

  .mev2-switch.on {
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
  }

  .mev2-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .mev2-switch.on::after {
    transform: translateX(20px);
  }

  /* 下拉选择框 */
  .mev2-select {
    position: relative;
    width: 100%;
    z-index: 1;
  }

  .mev2-select.dropdown-open {
    z-index: 9999;
  }

  .mev2-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
  }

  body:not(.light-theme) .mev2-select-trigger {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e0e0e0;
  }

  .mev2-select-trigger.open {
    border-color: #ff7a18;
    box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.15);
  }

  .mev2-select-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.25s ease;
    color: #999;
  }

  .mev2-select-trigger.open .mev2-select-arrow {
    transform: rotate(180deg);
  }

  .mev2-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 9999;
    display: none;
  }

  body:not(.light-theme) .mev2-select-dropdown {
    background: rgba(45, 36, 26, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .mev2-select-dropdown.open {
    display: block;
    animation: mev2-dropdown-in 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes mev2-dropdown-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .mev2-select-option {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  body:not(.light-theme) .mev2-select-option {
    color: #ddd;
  }

  .mev2-select-option:hover,
  .mev2-select-option:active {
    background: rgba(255, 122, 24, 0.12);
  }

  .mev2-select-option.selected {
    color: #ff7a18;
    font-weight: 700;
  }

  .mev2-select-option.selected::after {
    content: '✓';
    margin-left: auto;
    font-weight: 700;
  }

  /* 色板选择行（品牌 + 种类） */
  .mev2-palette-select-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .mev2-palette-select-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .mev2-palette-select-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
  }

  body:not(.light-theme) .mev2-palette-select-label {
    color: #999;
  }

  /* ===== 工具板块 ===== */
  .mev2-tool-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .mev2-tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 64px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mev2-tool-btn:active {
    transform: scale(0.93);
  }

  .mev2-tool-btn.active {
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(255, 122, 24, 0.35);
  }

  body:not(.light-theme) .mev2-tool-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .mev2-tool-icon {
    font-size: 22px;
    line-height: 1;
  }

  .mev2-tool-btn.active .mev2-tool-icon {
    filter: brightness(0) invert(1);
  }

  .mev2-tool-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
  }

  body:not(.light-theme) .mev2-tool-label {
    color: #bbb;
  }

  .mev2-tool-btn.active .mev2-tool-label {
    color: #fff;
  }

  /* ===== 视图选项板块 ===== */
  .mev2-view-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  body:not(.light-theme) .mev2-view-row {
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }

  .mev2-view-row:last-child {
    border-bottom: none;
  }

  .mev2-view-label {
    font-size: 13px;
    font-weight: 500;
    color: #444;
  }

  body:not(.light-theme) .mev2-view-label {
    color: #ccc;
  }

  /* ===== 全色色板板块 ===== */
  .mev2-palette-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
  }

  .mev2-palette-tab {
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #777;
    background: rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
  }

  .mev2-palette-tab:active {
    transform: scale(0.92);
  }

  .mev2-palette-tab.active {
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
    color: #fff;
  }

  body:not(.light-theme) .mev2-palette-tab {
    background: rgba(255, 255, 255, 0.06);
    color: #aaa;
  }

  .mev2-palette-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
  }

  .mev2-color-swatch {
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }

  .mev2-color-swatch:active {
    transform: scale(0.88);
  }

  .mev2-color-swatch.selected {
    border-color: #ff7a18;
    box-shadow: 0 0 0 2px rgba(255, 122, 24, 0.3);
    transform: scale(1.05);
  }

  .mev2-color-swatch.disabled {
    opacity: 0.3;
  }

  .mev2-color-swatch.disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 15%;
    right: 15%;
    height: 2px;
    background: rgba(0, 0, 0, 0.5);
    transform: rotate(-45deg);
    border-radius: 1px;
  }

  .mev2-color-swatch-label {
    position: absolute;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 7px;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    white-space: nowrap;
  }

  /* ===== 用料统计板块 ===== */
  .mev2-stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
  }

  .mev2-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 6px;
    border-radius: 12px;
    background: rgba(255, 122, 24, 0.08);
  }

  body:not(.light-theme) .mev2-stat-item {
    background: rgba(255, 122, 24, 0.12);
  }

  .mev2-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: #ff7a18;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
  }

  .mev2-stat-label {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
  }

  body:not(.light-theme) .mev2-stat-label {
    color: #999;
  }

  .mev2-stats-list {
    max-height: 280px;
    overflow-y: auto;
  }

  .mev2-stats-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    margin-bottom: 4px;
    background: rgba(0, 0, 0, 0.02);
  }

  body:not(.light-theme) .mev2-stats-list-item {
    background: rgba(255, 255, 255, 0.03);
  }

  .mev2-stats-color-dot {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
  }

  .mev2-stats-color-name {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #444;
  }

  body:not(.light-theme) .mev2-stats-color-name {
    color: #ccc;
  }

  .mev2-stats-color-count {
    font-size: 14px;
    font-weight: 800;
    color: #ff7a18;
    font-variant-numeric: tabular-nums;
  }

  .mev2-stats-color-delete {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mev2-stats-color-delete:active {
    transform: scale(0.9);
    background: rgba(239, 68, 68, 0.2);
  }

  body:not(.light-theme) .mev2-stats-color-delete {
    background: rgba(239, 68, 68, 0.15);
  }

  .mev2-stats-empty {
    text-align: center;
    padding: 30px 20px;
    font-size: 13px;
    color: #999;
  }

  body:not(.light-theme) .mev2-stats-empty {
    color: #777;
  }

  /* ===== 底部安全区 ===== */
  .mev2-bottom-safe {
    height: calc(20px + env(safe-area-inset-bottom));
    flex-shrink: 0;
  }

  /* ===== 滚动条美化 ===== */
  .mev2-palette-grid::-webkit-scrollbar,
  .mev2-stats-list::-webkit-scrollbar {
    width: 4px;
  }

  .mev2-palette-grid::-webkit-scrollbar-thumb,
  .mev2-stats-list::-webkit-scrollbar-thumb {
    background: rgba(255, 122, 24, 0.3);
    border-radius: 2px;
  }

  /* ===== 当前颜色指示器 ===== */
  .mev2-current-color-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 0 12px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
  }

  body:not(.light-theme) .mev2-current-color-bar {
    background: rgba(40, 32, 22, 0.55);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .mev2-current-color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
  }

  body:not(.light-theme) .mev2-current-color-swatch {
    border-color: rgba(255, 255, 255, 0.2);
  }

  .mev2-current-color-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .mev2-current-color-name {
    font-size: 13px;
    font-weight: 700;
    color: #333;
  }

  body:not(.light-theme) .mev2-current-color-name {
    color: #e0e0e0;
  }

  .mev2-current-color-hex {
    font-size: 11px;
    color: #999;
    font-family: monospace;
  }

  .mev2-quick-actions {
    display: flex;
    gap: 6px;
  }

  .mev2-quick-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
  }

  .mev2-quick-btn:active {
    transform: scale(0.9);
  }

  body:not(.light-theme) .mev2-quick-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
  }

  /* ===== 模式切换标签（手绘/转图） ===== */
  .mev2-mode-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin: 0 12px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
  }

  body:not(.light-theme) .mev2-mode-tabs {
    background: rgba(40, 32, 22, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .mev2-mode-tab {
    flex: 1;
    height: 36px;
    border-radius: 9px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    color: #777;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
  }

  .mev2-mode-tab.active {
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
    color: #fff;
    box-shadow: 0 3px 10px rgba(255, 122, 24, 0.3);
  }

  body:not(.light-theme) .mev2-mode-tab {
    color: #aaa;
  }

  /* ===== 全色画板弹窗 ===== */
  .mev2-palette-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: flex-end;
    justify-content: center;
  }
  .mev2-palette-modal.open {
    display: flex;
  }
  .mev2-palette-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }
  .mev2-palette-modal-content {
    position: relative;
    width: 100%;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    animation: mev2-slide-up 0.25s ease;
  }
  @keyframes mev2-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  body:not(.light-theme) .mev2-palette-modal-content {
    background: rgba(35, 28, 20, 0.95);
  }
  .mev2-palette-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
  }
  .mev2-palette-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
  }
  body:not(.light-theme) .mev2-palette-modal-title {
    color: #eee;
  }
  .mev2-palette-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    font-size: 20px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mev2-palette-search-row {
    padding: 12px 18px;
    flex-shrink: 0;
  }
  .mev2-palette-search {
    width: 100%;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
    padding: 0 14px;
    font-size: 14px;
    color: #333;
    outline: none;
    box-sizing: border-box;
  }
  .mev2-palette-search:focus {
    border-color: #ff7a18;
  }
  body:not(.light-theme) .mev2-palette-search {
    background: rgba(255, 255, 255, 0.08);
    color: #eee;
    border-color: rgba(255, 255, 255, 0.1);
  }
  .mev2-palette-modal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 18px 12px;
    flex-shrink: 0;
  }
  .mev2-palette-modal-tab {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
  }
  .mev2-palette-modal-tab:hover {
    background: rgba(255, 122, 24, 0.1);
    color: #ff7a18;
  }
  .mev2-palette-modal-tab.active {
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
    color: #fff;
    box-shadow: 0 4px 10px rgba(255, 122, 24, 0.25);
  }
  body:not(.light-theme) .mev2-palette-modal-tab {
    color: #aaa;
    background: rgba(255, 255, 255, 0.06);
  }
  body:not(.light-theme) .mev2-palette-modal-tab:hover {
    background: rgba(255, 122, 24, 0.15);
    color: #ff9b3f;
  }
  .mev2-palette-modal-grid {
    flex: 1;
    overflow-y: auto;
    padding: 8px 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .mev2-palette-modal-group-title {
    font-size: 13px;
    font-weight: 700;
    color: #ff7a18;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 122, 24, 0.2);
    margin-top: 4px;
  }
  .mev2-palette-modal-group-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }
  .mev2-palette-modal-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .mev2-palette-modal-item:active {
    transform: scale(0.95);
    background: rgba(255, 122, 24, 0.1);
  }
  .mev2-palette-modal-item.selected {
    background: rgba(255, 122, 24, 0.15);
    box-shadow: 0 0 0 2px #ff7a18;
  }
  .mev2-palette-modal-item.disabled {
    opacity: 0.35;
  }
  .mev2-palette-modal-swatch {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
  }
  .mev2-palette-modal-code {
    font-size: 10px;
    color: #666;
    font-weight: 600;
  }
  body:not(.light-theme) .mev2-palette-modal-code {
    color: #aaa;
  }

  /* ===== 悬浮工具栏 ===== */
  .mev2-floating-tool {
    position: absolute;
    z-index: 9000;
    right: 8px;
    top: 120px;
    touch-action: none;
  }
  .mev2-floating-tool-handle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(255, 122, 24, 0.4);
    cursor: grab;
    transition: transform 0.15s;
    margin-left: auto;
  }
  .mev2-floating-tool-handle:active {
    transform: scale(0.92);
    cursor: grabbing;
  }
  .mev2-floating-tool-panel {
    position: absolute;
    right: 52px;
    top: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: mev2-pop-in 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .mev2-floating-tool:not(.open) .mev2-floating-tool-panel {
    display: none;
  }
  @keyframes mev2-pop-in {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
  }
  body:not(.light-theme) .mev2-floating-tool-panel {
    background: rgba(30, 28, 36, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  .mev2-floating-tool-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
  }
  .mev2-floating-tool-btn:active {
    background: rgba(255, 122, 24, 0.15);
  }
  .mev2-floating-tool-btn.active {
    background: linear-gradient(135deg, #ff9b3f, #ff7a18);
    color: #fff;
  }
  body:not(.light-theme) .mev2-floating-tool-btn {
    color: #ccc;
  }

  /* ===== 平板横屏专项适配 (≤1024px 且横屏) ===== */
  @media (orientation: landscape) {
    /* 画布区域：横屏时高度自适应，给参数面板更多空间 */
    .mev2-canvas-section {
      height: 55vh;
      min-height: 220px;
      max-height: 60vh;
      margin: 10px 16px 0;
    }

    /* 参数设置板块：横屏时两列布局，节省垂直空间 */
    .mev2-card-body .mev2-param-row {
      display: inline-block;
      width: calc(50% - 8px);
      vertical-align: top;
      margin-right: 12px;
    }
    .mev2-card-body .mev2-param-row:nth-child(even) {
      margin-right: 0;
    }
    /* 生成模式整行显示 */
    .mev2-card-body .mev2-param-row:last-child {
      width: 100%;
      margin-right: 0;
    }

    /* 工具网格：横屏时6列，更紧凑 */
    .mev2-tool-grid {
      grid-template-columns: repeat(6, 1fr);
      gap: 6px;
    }
    .mev2-tool-btn {
      height: 56px;
      gap: 2px;
    }

    /* 视图选项：横屏时更紧凑 */
    .mev2-view-row {
      padding: 8px 0;
    }

    /* 色板弹窗网格：横屏时更多列 */
    .mev2-palette-modal-group-grid {
      grid-template-columns: repeat(8, 1fr) !important;
    }

    /* 用料统计：横屏时两列 */
    .mev2-stats-list {
      column-count: 2;
      column-gap: 12px;
    }
    .mev2-stats-list-item {
      break-inside: avoid;
    }

    /* 顶部栏更紧凑 */
    .mev2-topbar {
      padding: 8px 16px;
      padding-top: calc(8px + env(safe-area-inset-top));
    }

    /* 卡片间距更紧凑 */
    .mev2-card {
      margin: 10px 16px;
    }
    .mev2-card-body {
      padding: 12px;
    }

    /* 悬浮工具面板：横屏时横向排列 */
    .mev2-floating-tool-panel {
      flex-direction: row !important;
      flex-wrap: wrap;
      max-width: 320px;
    }
  }

  /* ===== 横竖屏平滑过渡 ===== */
  .mev2-canvas-section,
  .mev2-tool-grid,
  .mev2-tool-btn,
  .mev2-card,
  .mev2-card-body,
  .mev2-topbar,
  .mev2-param-row,
  .mev2-palette-modal-group-grid,
  .mev2-stats-list {
    transition: all 0.3s ease;
  }

  /* ===== 性能优化 ===== */
  /* 画布容器使用GPU加速 */
  .mev2-canvas-section .canvas-wrapper,
  .mev2-fs-canvas-container .canvas-wrapper {
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  /* 画布主容器GPU加速 */
  #canvas-container {
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }

  /* 减少backdrop-filter对性能的影响：低端设备降级 */
  @media (max-width: 767px) {
    .mev2-topbar,
    .mev2-card,
    .mev2-canvas-section,
    .mev2-fs-topbar,
    .mev2-fs-bottombar {
      -webkit-backdrop-filter: blur(12px) saturate(160%);
      backdrop-filter: blur(12px) saturate(160%);
    }
  }

  /* 触摸时禁用过渡动画，提升响应速度 */
  .mev2-tool-btn:active,
  .mev2-fs-tool-btn:active,
  .mev2-fs-bottom-btn:active,
  .mev2-fullscreen-btn:active {
    transition: none;
  }

  /* 色板项优化 */
  .mev2-palette-modal-group-grid .mev2-palette-color {
    will-change: transform;
    transform: translateZ(0);
  }

  /* 滚动性能优化 */
  #mobile-editor-v2 {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
  }

  /* 减少不必要的重绘区域 */
  .mev2-floating-tool {
    will-change: transform;
    transform: translateZ(0);
  }

  /* ===== 全屏按钮 ===== */
  .mev2-fullscreen-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 122, 24, 0.9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(255, 122, 24, 0.4);
    transition: all 0.2s ease;
  }
  .mev2-fullscreen-btn:active {
    transform: scale(0.9);
  }
  .mev2-fullscreen-btn svg {
    width: 16px;
    height: 16px;
  }

  /* ===== 切换原图/拼豆图按钮（仅转图模式） ===== */
  .mev2-canvas-section #mev2-toggle-view-btn {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: #ff7a18 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 100 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
  }
  /* 隐藏规则：同时匹配 display:none 和 display: none 两种格式 */
  .mev2-canvas-section #mev2-toggle-view-btn[style*="display:none"],
  .mev2-canvas-section #mev2-toggle-view-btn[style*="display: none"] {
    display: none !important;
  }
  .mev2-canvas-section #mev2-toggle-view-btn:active {
    transform: scale(0.9) !important;
  }
  .mev2-canvas-section #mev2-toggle-view-btn.active {
    background: rgba(255, 122, 24, 0.9) !important;
    color: #fff !important;
  }
  .mev2-canvas-section #mev2-toggle-view-btn svg {
    width: 16px !important;
    height: 16px !important;
  }

  /* 换图按钮（切换视图按钮下方） */
  .mev2-canvas-section #mev2-change-image-btn {
    position: absolute !important;
    top: 48px !important;
    right: 10px !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: #ff7a18 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 100 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
  }
  .mev2-canvas-section #mev2-change-image-btn[style*="display:none"],
  .mev2-canvas-section #mev2-change-image-btn[style*="display: none"] {
    display: none !important;
  }
  .mev2-canvas-section #mev2-change-image-btn:active {
    transform: scale(0.9) !important;
  }
  .mev2-canvas-section #mev2-change-image-btn svg {
    width: 16px !important;
    height: 16px !important;
  }

  /* ===== 全屏模式画布右上角按钮（跟非全屏一样竖着排列） ===== */
  .mev2-fs-canvas-container {
    position: relative !important;
  }
  .mev2-fs-canvas-container #mev2-fs-toggle-view {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: #ff7a18 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 100 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
  }
  .mev2-fs-canvas-container #mev2-fs-toggle-view[style*="display:none"],
  .mev2-fs-canvas-container #mev2-fs-toggle-view[style*="display: none"] {
    display: none !important;
  }
  .mev2-fs-canvas-container #mev2-fs-toggle-view:active {
    transform: scale(0.9) !important;
  }
  .mev2-fs-canvas-container #mev2-fs-toggle-view.active {
    background: rgba(255, 122, 24, 0.9) !important;
    color: #fff !important;
  }
  .mev2-fs-canvas-container #mev2-fs-toggle-view svg {
    width: 16px !important;
    height: 16px !important;
  }
  .mev2-fs-canvas-container #mev2-fs-change-image {
    position: absolute !important;
    top: 48px !important;
    right: 10px !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: #ff7a18 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 100 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
  }
  .mev2-fs-canvas-container #mev2-fs-change-image[style*="display:none"],
  .mev2-fs-canvas-container #mev2-fs-change-image[style*="display: none"] {
    display: none !important;
  }
  .mev2-fs-canvas-container #mev2-fs-change-image:active {
    transform: scale(0.9) !important;
  }
  .mev2-fs-canvas-container #mev2-fs-change-image svg {
    width: 16px !important;
    height: 16px !important;
  }

  /* ===== 全屏模式 ===== */
  .mev2-fullscreen-mode {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    z-index: 9999;
    flex-direction: column;
    overflow: hidden;
  }
  body:not(.light-theme) .mev2-fullscreen-mode {
    background: #1a1a1a;
  }
  .mev2-fullscreen-mode.active {
    display: flex;
  }

  /* 全屏顶部工具栏 */
  .mev2-fs-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 10px;
    padding-top: calc(6px + env(safe-area-inset-top));
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
  }
  body:not(.light-theme) .mev2-fs-topbar {
    background: rgba(30, 30, 30, 0.85);
    border-bottom-color: rgba(255, 255, 255, 0.05);
  }
  .mev2-fs-exit {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  body:not(.light-theme) .mev2-fs-exit {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
  }
  .mev2-fs-exit svg {
    width: 18px;
    height: 18px;
  }
  .mev2-fs-tools {
    display: flex;
    gap: 10px;
  }
  .mev2-fs-tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 2px 6px;
    border-radius: 10px;
    transition: all 0.2s ease;
  }
  body:not(.light-theme) .mev2-fs-tool-btn {
    color: #aaa;
  }
  .mev2-fs-tool-btn:active {
    transform: scale(0.9);
  }
  .mev2-fs-tool-btn.active {
    color: #ff7a18;
  }
  .mev2-fs-tool-btn.mev2-fs-download {
    color: #ff7a18;
  }
  .mev2-fs-tool-btn svg {
    width: 20px;
    height: 20px;
  }
  .mev2-fs-tool-btn span {
    font-size: 10px;
  }

  /* 撤销/重做按钮 */
  .mev2-fs-undo-redo {
    position: absolute;
    top: 70px;
    left: 16px;
    display: flex;
    gap: 8px;
    z-index: 10;
  }
  .mev2-fs-undo-btn,
  .mev2-fs-redo-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
  }
  body:not(.light-theme) .mev2-fs-undo-btn,
  body:not(.light-theme) .mev2-fs-redo-btn {
    background: rgba(40, 40, 40, 0.9);
    color: #ccc;
  }
  .mev2-fs-undo-btn:active,
  .mev2-fs-redo-btn:active {
    transform: scale(0.9);
  }
  .mev2-fs-undo-btn:disabled,
  .mev2-fs-redo-btn:disabled {
    opacity: 0.4;
  }
  .mev2-fs-undo-btn svg,
  .mev2-fs-redo-btn svg {
    width: 20px;
    height: 20px;
  }

  /* 全屏画布容器 */
  .mev2-fs-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    margin: 8px;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  body:not(.light-theme) .mev2-fs-canvas-container {
    background: transparent;
  }

  /* 全屏底部信息栏 */
  .mev2-fs-bottombar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
  }
  body:not(.light-theme) .mev2-fs-bottombar {
    background: rgba(30, 30, 30, 0.85);
    border-top-color: rgba(255, 255, 255, 0.05);
  }
  .mev2-fs-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .mev2-fs-info-title {
    font-size: 10px;
    color: #10b981;
    font-weight: 600;
  }
  .mev2-fs-info-stats {
    font-size: 11px;
    color: #666;
  }
  body:not(.light-theme) .mev2-fs-info-stats {
    color: #aaa;
  }
  .mev2-fs-info-size {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
  }
  body:not(.light-theme) .mev2-fs-info-size {
    color: #fff;
  }
  .mev2-fs-bottom-tools {
    display: flex;
    gap: 4px;
  }
  .mev2-fs-bottom-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: auto;
    height: auto;
    border-radius: 0;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 8px;
  }
  body:not(.light-theme) .mev2-fs-bottom-btn {
    background: transparent;
    color: #aaa;
  }
  .mev2-fs-bottom-btn:active {
    transform: scale(0.9);
    color: #ff7a18;
  }
  .mev2-fs-bottom-btn svg {
    width: 20px;
    height: 20px;
  }
  .mev2-fs-bottom-btn span {
    font-size: 10px;
    font-weight: 500;
  }

  /* 全屏模式横屏适配 */
  @media (orientation: landscape) {
    .mev2-fs-topbar {
      padding: 6px 16px;
      padding-top: calc(6px + env(safe-area-inset-top));
    }
    .mev2-fs-tools {
      gap: 12px;
    }
    .mev2-fs-tool-btn svg {
      width: 18px;
      height: 18px;
    }
    .mev2-fs-undo-redo {
      top: 50px;
      left: 12px;
    }
    .mev2-fs-canvas-container {
      margin: 6px 16px;
    }
    .mev2-fs-bottombar {
      padding: 6px 16px;
      padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
    .mev2-fs-info-size {
      font-size: 14px;
    }
    .mev2-fs-bottom-btn {
      padding: 2px 6px;
    }
    .mev2-fs-bottom-btn svg {
      width: 18px;
      height: 18px;
    }
  }

  /* 网格高亮效果 */
  .canvas-container.grid-highlight canvas {
    filter: contrast(1.1);
  }
}

/* ===== 全屏模式弹窗 - 磨砂玻璃效果 ===== */
.mev2-fs-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10001;
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: fsModalFadeIn 0.25s ease;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.mev2-fs-modal.active {
  display: flex;
}

@keyframes fsModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.mev2-fs-modal-content {
  width: 100%;
  max-width: 500px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
  max-height: 32vh;
  overflow: hidden;
  animation: fsModalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fsModalSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0.5;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.mev2-fs-modal-handle {
  width: 36px;
  height: 3px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  margin: 6px auto 0;
}

.mev2-fs-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mev2-fs-modal-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
  flex: 1;
  text-align: center;
}

.mev2-fs-modal-back {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 28px;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.mev2-fs-modal-back:active {
  transform: scale(0.9);
}

.mev2-fs-modal-confirm {
  padding: 6px 16px;
  border: none;
  background: linear-gradient(135deg, #ff7a18, #ff9b3f);
  color: #fff;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s;
}

.mev2-fs-modal-confirm:active {
  transform: scale(0.92);
}

.mev2-fs-modal-body {
  padding: 10px 14px 16px;
}

/* 通用滑块样式 */
.mev2-fs-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  outline: none;
  margin: 12px 0;
}

.mev2-fs-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #ff7a18;
  box-shadow: 0 2px 8px rgba(255, 122, 24, 0.3);
  cursor: pointer;
  transition: transform 0.15s;
}

.mev2-fs-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
}

.mev2-fs-slider:disabled {
  opacity: 0.4;
}

.mev2-fs-slider:disabled::-webkit-slider-thumb {
  border-color: #ccc;
  box-shadow: none;
}

/* 开关组件 */
.mev2-fs-switch {
  width: 44px;
  height: 26px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background 0.25s;
  flex-shrink: 0;
}

.mev2-fs-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mev2-fs-switch.active {
  background: linear-gradient(135deg, #ff7a18, #ff9b3f);
}

.mev2-fs-switch.active::after {
  transform: translateX(18px);
}

/* ===== 尺寸弹窗 ===== */
.mev2-fs-size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.mev2-fs-size-label {
  font-size: 12px;
  font-weight: 600;
  color: #1a1a2e;
}

.mev2-fs-lock-btn {
  padding: 6px 14px;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  border-radius: 14px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.mev2-fs-lock-btn.active {
  background: linear-gradient(135deg, #ff7a18, #ff9b3f);
  color: #fff;
  border-color: transparent;
}

.mev2-fs-size-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mev2-fs-size-col {
  flex: 1;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.mev2-fs-size-col-label {
  font-size: 11px;
  color: #888;
  margin-bottom: 2px;
}

.mev2-fs-size-value {
  font-size: 20px;
  font-weight: 800;
  color: #1a1a2e;
  text-align: center;
  margin-bottom: 4px;
}

.mev2-fs-size-x {
  font-size: 20px;
  font-weight: 700;
  color: #888;
}

.mev2-fs-size-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.mev2-fs-size-stepper button {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255, 122, 24, 0.1);
  color: #ff7a18;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.mev2-fs-size-stepper button:active {
  transform: scale(0.88);
  background: rgba(255, 122, 24, 0.2);
}

.mev2-fs-size-stepper input {
  flex: 1;
  height: 30px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  outline: none;
}

.mev2-fs-size-stepper input:focus {
  border-color: #ff7a18;
}

/* ===== 颜色弹窗 ===== */
.mev2-fs-color-grid {
  display: flex;
  flex-direction: row;
  gap: 12px;
}

.mev2-fs-color-card {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.mev2-fs-color-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mev2-fs-color-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 2px;
}

.mev2-fs-color-card-desc {
  font-size: 10px;
  color: #888;
  line-height: 1.4;
}

.mev2-fs-color-card-value {
  font-size: 18px;
  font-weight: 800;
  color: #ff7a18;
  min-width: 30px;
  text-align: right;
}

.mev2-fs-color-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.mev2-fs-color-input-row span {
  font-size: 13px;
  color: #666;
}

.mev2-fs-color-input-row input {
  flex: 1;
  height: 32px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  background: #fff;
  outline: none;
}

.mev2-fs-color-input-row input:focus {
  border-color: #ff7a18;
}

.mev2-fs-color-input-row input:disabled {
  background: rgba(0, 0, 0, 0.03);
  color: #aaa;
}

.mev2-fs-color-tip {
  font-size: 11px;
  color: #aaa;
  margin-top: 10px;
  line-height: 1.5;
}

/* ===== 模式弹窗 ===== */
.mev2-fs-mode-desc {
  font-size: 11px;
  color: #888;
  margin-bottom: 10px;
  text-align: center;
}

.mev2-fs-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mev2-fs-mode-option {
  padding: 12px 8px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a2e;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.mev2-fs-mode-option:active {
  transform: scale(0.95);
}

.mev2-fs-mode-option.active {
  border-color: #ff7a18;
  background: linear-gradient(135deg, rgba(255, 122, 24, 0.1), rgba(255, 155, 63, 0.1));
  color: #ff7a18;
  box-shadow: 0 4px 12px rgba(255, 122, 24, 0.15);
}

/* ===== 网格弹窗 ===== */
.mev2-fs-grid-body {
  display: flex;
  flex-direction: row;
  gap: 12px;
}
.mev2-fs-grid-toggles {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  padding: 4px 14px;
  margin-bottom: 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.mev2-fs-grid-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 12px;
  color: #1a1a2e;
}

.mev2-fs-grid-toggle-row:last-child {
  border-bottom: none;
}

.mev2-fs-grid-lines-card {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.mev2-fs-grid-lines-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.mev2-fs-grid-lines-title {
  font-size: 12px;
  font-weight: 700;
  color: #1a1a2e;
}

.mev2-fs-grid-reset {
  padding: 3px 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  border-radius: 8px;
  font-size: 10px;
  color: #666;
  cursor: pointer;
}

.mev2-fs-grid-reset:active {
  transform: scale(0.92);
}

.mev2-fs-grid-lines-desc {
  font-size: 9px;
  color: #888;
  margin-bottom: 6px;
}

.mev2-fs-grid-lines-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mev2-fs-grid-line-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 10px;
  color: #666;
}

.mev2-fs-grid-line-input {
  width: 40px;
  height: 26px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  outline: none;
}

.mev2-fs-grid-line-input:focus {
  border-color: #ff7a18;
}

/* ===== 编辑弹窗 ===== */
.mev2-fs-edit-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.mev2-fs-edit-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border: 1.5px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.mev2-fs-edit-tool:active {
  transform: scale(0.92);
}

.mev2-fs-edit-tool.active {
  border-color: #ff7a18;
  background: linear-gradient(135deg, rgba(255, 122, 24, 0.1), rgba(255, 155, 63, 0.1));
  color: #ff7a18;
}

.mev2-fs-edit-tool svg {
  width: 18px;
  height: 18px;
}

.mev2-fs-edit-tool span {
  font-size: 10px;
  font-weight: 600;
}

.mev2-fs-edit-colors {
  display: flex;
  gap: 12px;
}

.mev2-fs-edit-color-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border: 2px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 60px;
}

.mev2-fs-edit-color-btn:active {
  transform: scale(0.92);
}

.mev2-fs-edit-color-btn svg {
  width: 24px;
  height: 24px;
  color: #ff7a18;
}

.mev2-fs-edit-color-btn span {
  font-size: 12px;
  font-weight: 600;
  color: #666;
}

.mev2-fs-edit-recent {
  flex: 1;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.mev2-fs-edit-recent-label {
  font-size: 11px;
  color: #888;
  margin-bottom: 8px;
}

.mev2-fs-edit-recent-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mev2-fs-recent-color-item {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.15s;
}

.mev2-fs-recent-color-item:active {
  transform: scale(0.85);
}

/* 横屏适配 */
@media (max-width: 1024px) and (orientation: landscape) {
  .mev2-fs-modal-content {
    max-height: 90vh;
  }
  .mev2-fs-size-inputs {
    flex-direction: row;
  }
  .mev2-fs-mode-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .mev2-fs-edit-tools {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ===== 平板横屏针对性适配 ===== */
@media (min-width: 1024px) and (orientation: landscape) {
  /* 全屏模式整体优化 */
  .mev2-fullscreen-mode {
    background: #fafafa;
  }
  body:not(.light-theme) .mev2-fullscreen-mode {
    background: #1a1a1a;
  }

  /* 顶部工具栏更紧凑 */
  .mev2-fs-topbar {
    padding: 8px 24px;
    padding-top: calc(8px + env(safe-area-inset-top));
    justify-content: flex-end;
  }
  .mev2-fs-exit {
    width: 32px;
    height: 32px;
    left: 24px;
  }
  .mev2-fs-tools {
    gap: 8px;
  }
  .mev2-fs-tool-btn {
    padding: 4px 10px;
  }
  .mev2-fs-tool-btn svg {
    width: 18px;
    height: 18px;
  }
  .mev2-fs-tool-btn span {
    font-size: 11px;
  }

  /* 撤销重做按钮位置 */
  .mev2-fs-undo-redo {
    top: 60px;
    left: 20px;
  }

  /* 画布区域更大 */
  .mev2-fs-canvas-container {
    margin: 12px 24px;
  }

  /* 底部信息栏优化 */
  .mev2-fs-bottombar {
    padding: 10px 24px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .mev2-fs-info {
    gap: 4px;
  }
  .mev2-fs-info-title {
    font-size: 11px;
  }
  .mev2-fs-info-stats {
    font-size: 12px;
  }
  .mev2-fs-info-size {
    font-size: 16px;
  }
  .mev2-fs-bottom-tools {
    gap: 8px;
  }
  .mev2-fs-bottom-btn {
    padding: 4px 12px;
  }
  .mev2-fs-bottom-btn svg {
    width: 20px;
    height: 20px;
  }
  .mev2-fs-bottom-btn span {
    font-size: 11px;
  }

  /* 弹窗平板横屏优化 - 居中显示，更宽 */
  .mev2-fs-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mev2-fs-modal-content {
    max-width: 600px;
    max-height: 70vh;
    border-radius: 20px;
    animation: fsModalFadeIn 0.25s ease;
  }
  .mev2-fs-modal-handle {
    display: none;
  }

  /* 尺寸弹窗平板优化 */
  .mev2-fs-size-inputs {
    gap: 24px;
  }
  .mev2-fs-size-value {
    font-size: 24px;
  }

  /* 颜色弹窗平板优化 */
  .mev2-fs-color-grid {
    gap: 16px;
  }
  .mev2-fs-color-card {
    padding: 16px;
  }

  /* 模式弹窗平板优化 */
  .mev2-fs-mode-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  .mev2-fs-mode-option {
    padding: 16px 12px;
    font-size: 13px;
  }

  /* 网格弹窗平板优化 */
  .mev2-fs-grid-body {
    gap: 16px;
  }
  .mev2-fs-grid-toggles {
    padding: 4px 16px;
  }
  .mev2-fs-grid-lines-card {
    padding: 16px;
  }

  /* 编辑弹窗平板优化 */
  .mev2-fs-edit-tools {
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
  }
  .mev2-fs-edit-tool {
    padding: 12px 8px;
  }
  .mev2-fs-edit-tool svg {
    width: 22px;
    height: 22px;
  }
  .mev2-fs-edit-tool span {
    font-size: 11px;
  }
}

/* 弹窗淡入动画（平板横屏用） */
@keyframes fsModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
