  :root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #232735;
    --border: #2e3344;
    --text: #e4e6ef;
    --text-dim: #8b8fa3;
    --accent: #4a7cff;
    --accent-glow: rgba(74,124,255,0.15);
    --accent2: #ff6b6b;
    --accent3: #50d890;
    --radius: 12px;
  }

  * { margin:0; padding:0; box-sizing:border-box; }

  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
  }

  .app-header {
    padding: 24px 40px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(180deg, rgba(74,124,255,0.04) 0%, transparent 100%);
  }

  .app-header .logo { width: 40px; height: 40px; flex-shrink: 0; }
  .app-header .logo canvas { width: 40px; height: 40px; }
  .app-header h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
  .app-header p { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

  .app-security-summary {
    padding: 10px 40px;
    border-bottom: 1px solid var(--border);
    background: rgba(80,216,144,0.05);
    color: var(--text-dim);
    font-size: 11px;
    line-height: 1.6;
  }

  .tabs {
    display: flex;
    gap: 0;
    padding: 0 40px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }

  .tab {
    padding: 13px 22px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    user-select: none;
    white-space: nowrap;
    background: transparent;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    font-family: inherit;
  }
  .tab:hover { color: var(--text); }
  .tab.active { color: var(--accent); border-bottom-color: var(--accent); }

  .main {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 40px 80px;
  }

  .panel { display: none; }
  .panel.active { display: block; }

  .drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 44px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    background: var(--surface);
    position: relative;
  }
  .drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
  }
  .drop-zone .icon { font-size: 36px; margin-bottom: 10px; opacity: 0.5; }
  .drop-zone .label { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
  .drop-zone .sub { font-size: 13px; color: var(--text-dim); }
  .drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
  .drop-error {
    display: none;
    margin-top: 10px;
    color: #ff9a9a;
    font-size: 12px;
    font-weight: 600;
  }
  .drop-error.visible { display: block; }

  .file-info {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 14px;
  }
  .file-info .fi-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent2), #ff8e53);
    border-radius: 8px;
    display: grid; place-items: center;
    font-size: 13px; font-weight: 700; color: #fff;
    flex-shrink: 0;
  }
  .file-info .fi-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .file-info .fi-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
  .file-info .fi-remove {
    margin-left: auto;
    background: none; border: none;
    color: var(--text-dim); cursor: pointer;
    font-size: 18px; padding: 4px 8px;
    border-radius: 6px; transition: all 0.15s;
  }
  .file-info .fi-remove:hover { background: rgba(255,107,107,0.15); color: var(--accent2); }

  .section { margin-top: 24px; }
  .section-title {
    font-size: 14px; font-weight: 600; margin-bottom: 10px;
    display: flex; align-items: center; gap: 8px;
  }
  .badge {
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
  }

  .hint {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 10px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--accent-glow);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
  }

  .page-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .page-chip {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
    position: relative;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-dim);
  }
  .page-chip:hover { border-color: var(--accent); color: var(--text); }
  .page-chip.split-after {
    border-color: var(--accent2);
    color: var(--accent2);
    background: rgba(255,107,107,0.1);
  }
  .page-chip.split-after::after {
    content: '\2702';
    position: absolute;
    right: -10px; top: 50%;
    transform: translateY(-50%);
    font-size: 14px; z-index: 2;
  }
  .page-chip.selected {
    border-color: var(--accent3);
    color: var(--accent3);
    background: rgba(80,216,144,0.1);
  }

  .split-preview {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .split-chunk {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    display: flex; align-items: center; gap: 8px;
  }
  .split-chunk .chunk-label { font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent); }
  .split-chunk .chunk-pages { color: var(--text-dim); font-family: 'JetBrains Mono', monospace; font-size: 12px; }

  .merge-list { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }

  .merge-item, .reorder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: grab;
    transition: all 0.15s;
    user-select: none;
  }
  .merge-item:active, .reorder-item:active { cursor: grabbing; }
  .merge-item:hover, .reorder-item:hover { border-color: var(--accent); }
  .merge-item.dragging, .reorder-item.dragging { opacity: 0.4; border-color: var(--accent); }
  .merge-item.drag-over, .reorder-item.drag-over { border-color: var(--accent3); background: rgba(80,216,144,0.06); transform: scale(1.01); }

  .order-num {
    width: 28px; height: 28px;
    background: var(--surface2);
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    flex-shrink: 0;
  }
  .grip { color: var(--text-dim); font-size: 16px; flex-shrink: 0; cursor: grab; }
  .mi-name { font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mi-pages { font-size: 12px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; flex-shrink: 0; }
  .mi-remove {
    background: none; border: none;
    color: var(--text-dim); cursor: pointer;
    font-size: 16px; padding: 2px 6px;
    border-radius: 4px; transition: all 0.15s;
  }
  .mi-remove:hover { background: rgba(255,107,107,0.15); color: var(--accent2); }
  .item-actions { display: flex; gap: 4px; margin-left: auto; }
  .move-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface2);
    color: var(--text-dim);
    cursor: pointer;
  }
  .move-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
  .move-btn:disabled { opacity: 0.35; cursor: not-allowed; }

  .rotate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .rotate-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
  }
  .rotate-card:hover { border-color: var(--accent); }
  .rc-page { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600; color: var(--text-dim); }
  .rc-preview {
    width: 48px; height: 64px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex; align-items: flex-start; justify-content: center; padding-top: 8px;
    font-size: 9px; color: var(--text-dim);
    transition: transform 0.3s;
    background: var(--bg);
    position: relative; overflow: hidden;
  }
  .rc-preview::before {
    content: ''; position: absolute; top: 20px; left: 6px; right: 6px;
    height: 2px; background: var(--border); border-radius: 1px;
  }
  .rc-preview::after {
    content: ''; position: absolute; top: 26px; left: 6px; right: 10px;
    height: 2px; background: var(--border); border-radius: 1px;
  }
  .rc-angle { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--accent); min-height: 18px; }
  .rc-btns { display: flex; gap: 6px; }
  .rc-btn {
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); width: 32px; height: 32px;
    border-radius: 6px; cursor: pointer; font-size: 16px;
    display: grid; place-items: center; transition: all 0.15s;
  }
  .rc-btn:hover { border-color: var(--accent); background: var(--accent-glow); }

  .reorder-list {
    display: flex; flex-direction: column; gap: 4px;
    padding: 14px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
  }
  .reorder-item .ri-grip { color: var(--text-dim); font-size: 14px; flex-shrink: 0; }
  .reorder-item .ri-num {
    width: 32px; height: 32px; background: var(--bg);
    border-radius: 6px; display: grid; place-items: center;
    font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600;
    color: var(--accent); flex-shrink: 0;
  }
  .reorder-item .ri-label { font-size: 13px; color: var(--text-dim); }
  .reorder-item .ri-orig { margin-left: auto; font-size: 11px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; opacity: 0.6; }

  /* ===== COMPRESS PANEL STYLES ===== */
  .compress-settings {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-top: 16px;
  }
  .setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .setting-row:last-child { border-bottom: none; padding-bottom: 0; }
  .setting-row:first-child { padding-top: 0; }
  .setting-label { font-size: 14px; font-weight: 600; }
  .setting-desc { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
  .setting-badge {
    font-size: 10px; color: var(--accent3);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 3px; display: none;
  }

  .slider-wrap { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; width: 220px; }
  input[type="range"] {
    -webkit-appearance: none; flex: 1; height: 4px;
    background: var(--border); border-radius: 2px; outline: none;
  }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 16px; height: 16px;
    background: var(--accent); border-radius: 50%; cursor: pointer;
    box-shadow: 0 0 8px rgba(74,124,255,0.5); transition: transform 0.2s;
  }
  input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
  .slider-val {
    font-family: 'JetBrains Mono', monospace; font-size: 12px;
    color: var(--accent); min-width: 60px; text-align: right;
  }

  .target-wrap { display: flex; align-items: center; gap: 8px; }
  .target-input {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text);
    font-family: 'JetBrains Mono', monospace; font-size: 14px;
    padding: 6px 12px; width: 80px; text-align: center; outline: none;
    transition: border-color 0.2s;
  }
  .target-input:focus { border-color: var(--accent); }
  .target-unit { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-dim); }

  .toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
  .toggle input { opacity: 0; width: 0; height: 0; }
  .toggle-track {
    position: absolute; inset: 0;
    background: var(--border); border-radius: 12px; cursor: pointer; transition: background 0.3s;
  }
  .toggle input:checked + .toggle-track { background: var(--accent); }
  .toggle-track::after {
    content: ''; position: absolute; left: 3px; top: 3px;
    width: 18px; height: 18px; background: white; border-radius: 50%; transition: transform 0.3s;
  }
  .toggle input:checked + .toggle-track::after { transform: translateX(20px); }

  .calib-bar {
    display: none; align-items: center; gap: 10px;
    background: var(--accent-glow);
    border: 1px solid rgba(74,124,255,0.25);
    border-radius: 8px; padding: 10px 14px; margin-top: 12px;
    font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent);
  }
  .calib-spinner {
    width: 12px; height: 12px; flex-shrink: 0;
    border: 2px solid rgba(74,124,255,0.3); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.7s linear infinite;
  }
  .calib-done { background: rgba(80,216,144,0.08); border-color: rgba(80,216,144,0.25); color: var(--accent3); }
  .calib-done .calib-spinner { display: none; }
  .calib-error { background: rgba(255,107,107,0.08); border-color: rgba(255,107,107,0.25); color: #ff9a9a; }
  .calib-error .calib-spinner { display: none; }

  .compress-result {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-top: 16px;
    display: none;
  }
  .result-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-box { background: var(--bg); border-radius: 10px; padding: 14px; text-align: center; border: 1px solid var(--border); }
  .stat-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-dim); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
  .stat-val { font-size: 20px; font-weight: 700; }
  .stat-val.before { color: #fcb05c; }
  .stat-val.after { color: var(--accent3); }
  .stat-val.ratio { color: var(--accent); }

  .result-warn {
    display: none; font-size: 12px; color: #fcb05c;
    padding: 10px 14px; margin-bottom: 14px;
    background: rgba(252,176,92,0.08); border: 1px solid rgba(252,176,92,0.25);
    border-radius: 8px; font-family: 'JetBrains Mono', monospace;
  }
  .result-note {
    font-size: 12px; color: var(--text-dim); margin-top: 14px;
    padding: 10px 14px;
    background: var(--surface2); border-radius: 8px;
    font-family: 'JetBrains Mono', monospace; line-height: 1.7;
  }

  /* ===== SHARED BUTTON & UTILITY STYLES ===== */
  .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 22px; font-size: 14px; font-weight: 600;
    font-family: inherit;
    border: none; border-radius: 10px; cursor: pointer; transition: all 0.2s;
  }
  .btn-primary {
    background: linear-gradient(135deg, var(--accent), #5c8aff);
    color: #fff; box-shadow: 0 4px 16px rgba(74,124,255,0.3);
  }
  .btn-primary:hover { box-shadow: 0 6px 24px rgba(74,124,255,0.45); transform: translateY(-1px); }
  .btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
  .btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
  .btn-secondary:hover { border-color: var(--accent); }
  .btn-small { padding: 6px 14px; font-size: 12px; }
  .btn-download {
    width: 100%; padding: 13px; background: transparent;
    border: 1px solid var(--accent3); border-radius: 10px; color: var(--accent3);
    font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
  }
  .btn-download:hover { background: rgba(80,216,144,0.1); transform: translateY(-1px); }

  .action-bar { margin-top: 22px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .status { font-size: 13px; color: var(--accent3); margin-left: 4px; }
  .status.error { color: #ff9a9a; }

  .security-notice {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(252,176,92,0.35);
    border-left: 3px solid #fcb05c;
    border-radius: 8px;
    background: rgba(252,176,92,0.08);
    color: #ffd5a0;
    font-size: 12px;
    line-height: 1.7;
  }

  :focus-visible {
    outline: 3px solid rgba(74,124,255,0.75);
    outline-offset: 3px;
  }

  .progress-bar { width: 100%; height: 4px; background: var(--surface2); border-radius: 2px; margin-top: 14px; overflow: hidden; display: none; }
  .progress-bar.active { display: block; }
  .progress-bar .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent3)); border-radius: 2px; transition: width 0.3s; }

  .compress-progress-wrap { margin-top: 14px; display: none; }
  .compress-progress-label { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-dim); margin-bottom: 6px; display: flex; justify-content: space-between; }
  .compress-progress-bar { height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
  .compress-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent3)); border-radius: 2px; width: 0%; transition: width 0.3s ease; }

  .quick-btns { margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
  .hidden { display: none !important; }

  @keyframes spin { to { transform: rotate(360deg); } }
  .spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3); border-top-color: white;
    border-radius: 50%; animation: spin 0.7s linear infinite;
    vertical-align: middle; margin-right: 6px;
  }

  /* ===== TRIM PANEL STYLES ===== */
  .trim-mode-btns {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px;
  }
  .trim-mode-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 16px 14px;
    background: var(--surface); border: 2px solid var(--border);
    border-radius: var(--radius); cursor: pointer; transition: all 0.2s;
    color: var(--text-dim); font-family: inherit;
    font-size: 13px; font-weight: 500;
  }
  .trim-mode-btn:hover { border-color: var(--accent); color: var(--text); }
  .trim-mode-btn.active { border-color: var(--accent); background: var(--accent-glow); color: var(--text); }
  .trim-mode-icon { font-size: 24px; margin-bottom: 2px; }
  .trim-mode-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

  .trim-workspace {
    display: flex; gap: 16px; align-items: flex-start; margin-top: 14px;
  }
  .trim-preview-wrap { flex: 1; min-width: 0; }
  .trim-canvas-container {
    position: relative; display: block; cursor: crosshair;
    border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
    width: 100%; background: #1a1a1a;
  }
  .trim-canvas-container canvas { display: block; width: 100%; height: auto; }
  .trim-overlay {
    position: absolute; inset: 0; pointer-events: none;
    background: rgba(0,0,0,0.45);
  }
  .trim-selection {
    position: absolute; border: 2px solid var(--accent);
    background: rgba(74,124,255,0.12);
    pointer-events: none; display: none;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
  }
  .trim-page-nav {
    display: flex; align-items: center; gap: 10px; margin-top: 8px;
    font-size: 13px; color: var(--text-dim); justify-content: center;
  }
  .trim-inputs-panel {
    display: flex; flex-direction: column; gap: 8px;
    flex-shrink: 0; width: 140px;
  }
  .trim-input-group { display: flex; flex-direction: column; gap: 4px; }
  .trim-input-group label { font-size: 11px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }
  .trim-input-group input[type="number"] {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text);
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
    padding: 6px 10px; width: 100%; outline: none;
    transition: border-color 0.2s;
  }
  .trim-input-group input[type="number"]:focus { border-color: var(--accent); }
  .trim-input-group.full { margin-top: 4px; }

  /* ページごとモード */
  .trim-per-layout { display: flex; gap: 14px; margin-top: 14px; }
  .trim-per-sidebar {
    flex-shrink: 0; width: 120px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
  }
  .trim-per-sidebar-title {
    font-size: 11px; font-weight: 600; color: var(--text-dim);
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase; letter-spacing: 0.5px;
  }
  .trim-per-page-list { max-height: 420px; overflow-y: auto; }
  .trim-per-page-list::-webkit-scrollbar { width: 4px; }
  .trim-per-page-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  .trim-per-page-item {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px; cursor: pointer; transition: all 0.15s;
    border-bottom: 1px solid var(--border); font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    width: 100%; color: var(--text-dim); background: transparent;
    border-left: 0; border-right: 0; border-top: 0; text-align: left;
  }
  .trim-per-page-item:hover { background: var(--surface2); }
  .trim-per-page-item.active { background: var(--accent-glow); color: var(--accent); }
  .trim-per-page-item .tpp-num { font-weight: 600; }
  .trim-per-page-item .tpp-dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--border);
    flex-shrink: 0; margin-left: auto;
  }
  .trim-per-page-item.has-trim .tpp-dot { background: var(--accent3); }
  .trim-per-main { flex: 1; min-width: 0; }
  .trim-per-page-header {
    font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 10px;
  }
  .trim-per-summary {
    margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px;
  }
  .trim-per-chip {
    background: var(--surface); border: 1px solid var(--accent3);
    border-radius: 20px; padding: 3px 10px; font-size: 11px;
    font-family: 'JetBrains Mono', monospace; color: var(--accent3);
  }

  /* ===== REDACT / BLUR PANEL STYLES ===== */
  .redact-security-notice {
    margin-top: 14px; padding: 12px 14px;
    border: 1px solid rgba(80,216,144,0.35); border-left: 3px solid var(--accent3);
    border-radius: 8px; background: rgba(80,216,144,0.08);
    color: #b9f5d4; font-size: 12px; line-height: 1.7;
  }
  .redact-mode-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
  .redact-mode-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 16px 14px; background: var(--surface); border: 2px solid var(--border);
    border-radius: var(--radius); color: var(--text-dim); cursor: pointer;
    font: inherit; font-size: 13px; transition: all 0.2s;
  }
  .redact-mode-btn:hover { border-color: var(--accent); color: var(--text); }
  .redact-mode-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .redact-mode-btn:disabled:hover { border-color: var(--border); color: var(--text-dim); }
  .redact-slider-row.unavailable { opacity: 0.4; }
  .redact-mode-btn.active { border-color: var(--accent); background: var(--accent-glow); color: var(--text); }
  #redact-mode-redact.active { border-color: var(--accent2); background: rgba(255,107,107,0.1); }
  .redact-mode-icon { font-size: 24px; line-height: 1; }
  .redact-mode-desc { color: var(--text-dim); font-size: 11px; text-align: center; }
  .redact-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
  .redact-slider-row {
    display: grid; grid-template-columns: auto minmax(80px, 1fr) 70px;
    align-items: center; gap: 12px; padding: 12px 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text-dim); font-size: 12px;
  }
  .redact-workspace { display: flex; align-items: flex-start; gap: 16px; margin-top: 14px; }
  .redact-preview-wrap { flex: 1; min-width: 0; }
  .redact-canvas-container {
    position: relative; width: 100%; overflow: hidden;
    border: 1px solid var(--border); border-radius: 8px; background: #1a1a1a;
    cursor: crosshair; touch-action: none;
  }
  .redact-canvas-container canvas { display: block; width: 100%; height: auto; }
  .redact-regions { position: absolute; inset: 0; pointer-events: none; }
  .redact-region { position: absolute; box-sizing: border-box; overflow: hidden; pointer-events: none; }
  .redact-region::after {
    position: absolute; top: 2px; left: 3px; padding: 1px 4px;
    border-radius: 3px; background: rgba(0,0,0,0.75); color: #fff;
    font-family: 'JetBrains Mono', monospace; font-size: 9px; line-height: 1.4;
  }
  .redact-region.mode-redact { background: #000; outline: 2px solid var(--accent2); outline-offset: -2px; }
  .redact-region.mode-redact::after { content: 'REDACT'; color: #ffb1b1; }
  .redact-region.mode-blur {
    border: 2px dashed #fcb05c; background: rgba(252,176,92,0.22);
    -webkit-backdrop-filter: blur(var(--redact-preview-blur, 8px));
    backdrop-filter: blur(var(--redact-preview-blur, 8px));
  }
  .redact-region.mode-blur::after { content: 'BLUR'; color: #ffd5a0; }
  .redact-draft {
    position: absolute; display: none; border: 2px solid var(--accent);
    background: rgba(74,124,255,0.18); pointer-events: none;
  }
  .redact-input-panel {
    flex: 0 0 220px; padding: 12px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface);
  }
  .redact-input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .redact-input-grid label {
    display: flex; flex-direction: column; gap: 4px; color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace; font-size: 10px;
  }
  .redact-input-grid input {
    width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
    outline: none; background: var(--bg); color: var(--text); font: inherit; font-size: 12px;
  }
  .redact-input-grid input:focus { border-color: var(--accent); }
  .redact-add-btn { width: 100%; justify-content: center; margin-top: 10px; }
  .redact-page-size { margin-top: 9px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; font-size: 10px; text-align: center; }
  .redact-region-summary { margin-top: 12px; min-height: 20px; color: var(--text-dim); font-size: 12px; }
  .redact-region-list { display: flex; flex-direction: column; gap: 6px; }
  .redact-region-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 12px;
  }
  .redact-region-kind {
    flex: 0 0 auto; padding: 2px 8px; border-radius: 12px;
    font-family: 'JetBrains Mono', monospace; font-size: 10px;
  }
  .redact-region-kind.mode-redact { color: #ffb1b1; background: rgba(255,107,107,0.12); }
  .redact-region-kind.mode-blur { color: #ffd5a0; background: rgba(252,176,92,0.12); }
  .redact-region-coords { flex: 1; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; font-size: 10px; }
  .redact-region-remove { margin-left: auto; }
  .redact-quick-btns { margin-top: 10px; }
  .redact-result-title { margin-bottom: 14px; }

  @media (max-width: 640px) {
    .trim-workspace { flex-direction: column; }
    .trim-inputs-panel { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .trim-input-group { width: calc(50% - 4px); }
    .trim-mode-btns { grid-template-columns: 1fr; }
    .trim-per-layout { flex-direction: column; }
    .trim-per-sidebar { width: 100%; }
    .trim-per-page-list { max-height: 100px; display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
    .trim-per-page-item { border: 1px solid var(--border); border-radius: 6px; border-bottom: 1px solid var(--border); padding: 6px 10px; }
    .redact-mode-btns, .redact-sliders { grid-template-columns: 1fr; }
    .redact-workspace { flex-direction: column; }
    .redact-input-panel { width: 100%; flex-basis: auto; }
  }

  @media (max-width: 640px) {
    .app-header, .app-security-summary, .main { padding-left: 16px; padding-right: 16px; }
    .tabs { padding: 0 16px; }
    .tab { padding: 12px 14px; font-size: 12px; }
    .drop-zone { padding: 28px 16px; }
    .page-chip { width: 38px; height: 38px; font-size: 12px; }
    .rotate-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    .result-stats { grid-template-columns: 1fr 1fr; }
    .slider-wrap { width: 160px; }
  }
