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

    :root {
      --bg:      #2a2a2e;
      --orange:  #e8714a;
      --purple:  #8b82e8;
      --green:   #5ecb7a;
      --yellow:  #d4b83a;
      --pink:    #e8728a;
      --ink:     #28282e;
      --text-on-color: #2a1f1a;
      --text-ui: #eceae4;
      --r: 4px;
    }

    body {
      background: var(--bg);
      color: var(--text-ui);
      font-family: 'DM Sans', sans-serif;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding-bottom: 100px;
      gap: 16px;
    }

    
    header {
      width: calc(100% - 48px);
      max-width: 1200px;
      margin-top: 24px;
      background: var(--orange);
      text-align: center;
      padding: 40px 32px 36px;
      border-radius: var(--r);
    }

    .badge {
      display: block;
      color: var(--text-on-color);
      font-size: 11px; font-weight: 700;
      letter-spacing: 0.18em; text-transform: uppercase;
      margin-bottom: 10px;
    }

    h1 {
      font-family: 'Instrument Serif', serif;
      font-size: clamp(4rem, 12vw, 9rem);
      font-weight: 400; line-height: 0.9;
      color: var(--text-on-color);
    }

    .subtitle {
      margin-top: 12px;
      color: var(--text-on-color);
      font-size: 11px; font-weight: 700;
      letter-spacing: 0.18em; text-transform: uppercase;
    }

    
    .page-body {
      width: calc(100% - 48px);
      max-width: 1200px;
      display: flex; flex-direction: column;
      align-items: center; gap: 10px;
    }

    
    .drop-zone {
      width: 100%; max-width: 1200px;
      background: var(--green);
      border: none; border-radius: var(--r);
      padding: 52px 40px;
      text-align: center; cursor: pointer;
      transition: background 0.18s; position: relative;
    }

    .drop-zone:hover, .drop-zone.drag-over { background: var(--pink); }

    .drop-zone input[type="file"] {
      position: absolute; inset: 0; opacity: 0;
      cursor: pointer; width: 100%; height: 100%;
    }

    .drop-icon { font-size: 38px; margin-bottom: 12px; display: block; color: var(--text-on-color); }
    .drop-zone p { font-size: 15px; font-weight: 600; color: var(--text-on-color); line-height: 1.8; }
    .drop-zone strong { color: var(--text-on-color); font-weight: 800; }

    .error-msg {
      width: 100%; max-width: 1200px;
      font-size: 13px; font-weight: 600; color: var(--pink);
    }

    
    .options-bar {
      width: 100%; max-width: 1200px;
      background: var(--purple);
      border-radius: var(--r);
      padding: 14px 20px;
      display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
    }

    .opt-group { display: flex; align-items: center; gap: 10px; }
    .dims-group { display: flex; gap: 14px; align-items: center; flex-wrap: nowrap; }

    .opt-label {
      font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
      color: var(--text-on-color); text-transform: uppercase; white-space: nowrap;
    }

    .pill-group { display: flex; gap: 5px; }

    .pill {
      background: transparent;
      border: 2px solid var(--text-on-color);
      color: var(--text-on-color);
      font-family: 'DM Sans', sans-serif;
      font-size: 13px; font-weight: 600;
      padding: 5px 15px; border-radius: var(--r);
      cursor: pointer; transition: background 0.1s;
    }

    .pill:hover  { background: rgba(0,0,0,0.12); }
    .pill.active { background: var(--text-on-color); color: var(--text-ui); border-color: var(--text-on-color); }

    .slider-wrap { display: flex; align-items: center; gap: 10px; }

    input[type="range"] {
      -webkit-appearance: none; width: 90px; height: 3px;
      background: var(--text-on-color); border-radius: 2px; outline: none; border: none;
    }

    input[type="range"]::-webkit-slider-thumb {
      -webkit-appearance: none; width: 14px; height: 14px;
      background: var(--text-on-color); border-radius: 50%; cursor: pointer;
    }

    .slider-val { font-size: 13px; font-weight: 700; color: var(--text-on-color); min-width: 28px; }

    .number-input {
      background: rgba(0,0,0,0.12); border: none;
      color: var(--text-on-color);
      font-family: 'DM Sans', sans-serif;
      font-size: 13px; font-weight: 600;
      padding: 6px 10px; border-radius: var(--r); width: 68px; outline: none;
    }

    .number-input:focus { background: rgba(0,0,0,0.2); }
    .number-input::placeholder { color: var(--text-on-color); opacity: 1; }

    .divider { width: 1px; height: 22px; background: rgba(0,0,0,0.15); }

    .process-btn {
      background: var(--text-on-color); border: none;
      color: var(--text-ui);
      font-family: 'DM Sans', sans-serif;
      font-size: 13px; font-weight: 800;
      padding: 9px 24px; border-radius: var(--r);
      cursor: pointer; letter-spacing: 0.03em;
      transition: filter 0.1s; white-space: nowrap;
    }

    .process-btn:hover  { filter: brightness(1.15); }
    .process-btn:active { filter: brightness(0.9); }
    .process-btn:disabled { opacity: 0.3; cursor: default; filter: none; }

    
    .workspace {
      width: 100%; max-width: 1200px;
      display: grid; grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    
    .panel {
      display: flex; flex-direction: column;
      min-height: 320px; border-radius: var(--r); overflow: hidden;
    }

    .panel-left  { background: var(--orange); }
    .panel-right { background: var(--purple); }

    .panel + .panel { border-left: none; }

    
    .panel-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 16px 18px 12px; flex-shrink: 0;
      background: transparent;
    }

    .panel-title {
      font-family: 'Instrument Serif', serif;
      font-size: 20px; font-weight: 400;
      color: var(--text-on-color);
      display: flex; align-items: center; gap: 7px;
    }

    .panel-title .dot {
      width: 6px; height: 6px; border-radius: 50%;
      background: rgba(0,0,0,0.2);
    }

    .panel-count {
      font-size: 11px; font-weight: 700;
      color: var(--text-on-color);
      background: rgba(0,0,0,0.12);
      border-radius: var(--r); padding: 3px 9px;
    }

    
    .panel-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
      gap: 8px; padding: 8px 10px 12px;
      flex: 1; align-content: start;
      background: transparent;
    }

    .panel-empty {
      flex: 1; display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      padding: 48px 24px; background: transparent;
      color: var(--text-on-color); opacity: 0.35;
      font-size: 13px; font-weight: 600;
      text-align: center; gap: 8px; line-height: 1.8;
    }

    .panel-empty-icon { font-size: 28px; }

    
    .panel-left .card { position: relative; }

    .card-remove {
      position: absolute; top: 7px; right: 7px;
      width: 24px; height: 24px;
      background: rgba(0,0,0,0.35); border: none; border-radius: 50%;
      color: #fff; font-size: 12px; line-height: 1;
      cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      opacity: 0; transition: opacity 0.1s, background 0.1s; z-index: 10;
    }

    .panel-left .card:hover .card-remove { opacity: 1; }
    .card-remove:hover { background: var(--pink) !important; }

    .card-badge-row {
      display: flex; border-top: 1px solid rgba(0,0,0,0.1);
    }

    .crop-badge, .censor-badge {
      flex: 1; font-family: 'DM Sans', sans-serif;
      font-size: 11px; font-weight: 800;
      color: var(--text-on-color); opacity: 0.45;
      background: transparent; text-align: center;
      padding: 7px 4px; letter-spacing: 0.1em;
      cursor: pointer; transition: opacity 0.1s, background 0.1s;
      white-space: nowrap; text-transform: uppercase;
    }

    .crop-badge + .censor-badge { border-left: 1px solid rgba(0,0,0,0.1); }
    .crop-badge:hover, .censor-badge:hover { opacity: 0.7; background: rgba(0,0,0,0.07); }
    .crop-badge.active, .censor-badge.active { opacity: 1; background: rgba(0,0,0,0.12); }

    @media (max-width: 680px) {
      .workspace { grid-template-columns: 1fr; }
    }

    .card {
      background: #f2f0ea; border: none; border-radius: var(--r);
      overflow: hidden; animation: fadeUp 0.2s ease both;
      transition: filter 0.1s;
    }

    .card:hover { filter: brightness(0.96); }

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

    .card-thumb { width: 100%; height: auto; display: block; background: #ddd; cursor: pointer; }
    .crop-hint  { display: none; }

    .card-body { padding: 9px 10px 10px; }

    .card-name {
      font-size: 11px; font-weight: 600; color: #333;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;
    }

    .card-meta { font-size: 10px; font-weight: 600; color: #999; margin-bottom: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

    .saved { color: #2a8a3a; }
    .grew  { color: #c0522a; }

    .card-actions { display: flex; gap: 5px; }

    .dl-btn {
      flex: 1; background: var(--ink); color: #e8e6e0;
      border: none; border-radius: var(--r);
      font-family: 'DM Sans', sans-serif;
      font-size: 11px; font-weight: 800;
      padding: 7px; cursor: pointer;
      letter-spacing: 0.04em; text-transform: uppercase;
      transition: filter 0.1s;
    }

    .dl-btn:hover { filter: brightness(1.4); }

    .crop-btn {
      background: rgba(0,0,0,0.06); border: none; color: #555;
      font-family: 'DM Sans', sans-serif;
      font-size: 11px; font-weight: 700;
      padding: 7px 12px; border-radius: var(--r);
      cursor: pointer; transition: background 0.1s;
    }

    .crop-btn:hover { background: rgba(0,0,0,0.1); }

    
    .bulk-bar {
      width: 100%; max-width: 1200px;
      display: flex; justify-content: flex-end; gap: 8px;
    }

    .bulk-btn {
      background: var(--ink); color: #bbb; border: none;
      font-family: 'DM Sans', sans-serif;
      font-size: 12px; font-weight: 700;
      padding: 9px 18px; border-radius: var(--r);
      cursor: pointer; text-transform: uppercase;
      letter-spacing: 0.04em; transition: filter 0.1s;
    }

    .bulk-btn:hover { filter: brightness(1.4); color: #eee; }
    .bulk-btn.primary { background: var(--purple); color: var(--text-on-color); }

    .hint {
      width: 100%; max-width: 1200px;
      background: var(--yellow);
      border-radius: var(--r);
      padding: 20px 24px;
      text-align: center; color: var(--text-on-color);
      font-size: 12px; font-weight: 700;
      letter-spacing: 0.06em; line-height: 1.9;
    }

    
    .lightbox {
      position: fixed; inset: 0; background: rgba(0,0,0,0.94);
      z-index: 2000; display: none;
      align-items: center; justify-content: center;
      flex-direction: column; gap: 16px; cursor: zoom-out;
      animation: fadein 0.15s ease;
    }

    .lightbox.open { display: flex; }

    .lightbox-img {
      max-width: 92vw; max-height: 85vh; object-fit: contain;
      border-radius: var(--r); pointer-events: none;
    }

    .lightbox-name { font-size: 12px; font-weight: 600; color: #555; pointer-events: none; }

    
    .modal-overlay {
      position: fixed; inset: 0; background: rgba(0,0,0,0.85);
      z-index: 1000; display: flex; align-items: center; justify-content: center;
      padding: 10px; animation: fadein 0.15s ease;
    }

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

    .modal {
      background: #242427; border: none; border-radius: var(--r);
      width: 100%; max-width: 1100px; max-height: 96vh;
      display: flex; flex-direction: column; overflow: hidden;
    }

    .modal-header {
      padding: 14px 22px; border-bottom: none;
      display: flex; align-items: center; justify-content: space-between;
      flex-shrink: 0; background: var(--purple);
    }

    .modal-title {
      font-family: 'Instrument Serif', serif;
      font-size: 22px; font-weight: 400; color: var(--text-on-color);
    }

    .modal-close {
      background: rgba(0,0,0,0.15); border: none;
      color: var(--text-on-color); font-size: 14px; font-weight: 700;
      cursor: pointer; padding: 5px 10px;
      border-radius: var(--r); transition: background 0.1s; line-height: 1.3;
    }

    .modal-close:hover { background: rgba(0,0,0,0.28); }

    .crop-area {
      flex: 1; overflow: auto; display: flex;
      align-items: center; justify-content: center;
      padding: 18px; background: #111;
      position: relative; min-height: 200px;
    }

    @media (max-width: 600px) {
      .crop-area { justify-content: flex-end; padding-left: 44px; padding-right: 12px; }
    }

    .crop-canvas-wrap {
      position: relative; display: inline-block;
      cursor: crosshair; user-select: none; -webkit-user-select: none;
    }

    #cropCanvas { display: block; max-width: 100%; }

    #cropBox {
      position: absolute; border: 2px solid var(--green);
      box-shadow: 0 0 0 9999px rgba(0,0,0,0.6);
      cursor: move; display: none;
    }

    .crop-handle {
      position: absolute; width: 10px; height: 10px;
      background: var(--green); border: 2px solid #111;
      border-radius: 1px; z-index: 2;
    }

    .handle-nw { top:-6px; left:-6px; cursor:nw-resize; }
    .handle-ne { top:-6px; right:-6px; cursor:ne-resize; }
    .handle-sw { bottom:-6px; left:-6px; cursor:sw-resize; }
    .handle-se { bottom:-6px; right:-6px; cursor:se-resize; }
    .handle-n  { top:-6px; left:50%; transform:translateX(-50%); cursor:n-resize; }
    .handle-s  { bottom:-6px; left:50%; transform:translateX(-50%); cursor:s-resize; }
    .handle-w  { left:-6px; top:50%; transform:translateY(-50%); cursor:w-resize; }
    .handle-e  { right:-6px; top:50%; transform:translateY(-50%); cursor:e-resize; }

    .crop-info {
      position: absolute; bottom: 12px; left: 50%;
      transform: translateX(-50%);
      background: var(--green); color: var(--text-on-color);
      font-size: 11px; font-weight: 800;
      padding: 3px 14px; border-radius: var(--r);
      pointer-events: none; white-space: nowrap;
    }

    .modal-footer {
      padding: 12px 22px; border-top: none;
      display: flex; gap: 8px; align-items: center;
      flex-wrap: wrap; flex-shrink: 0;
    }

    .modal-footer-crop   { background: var(--orange); }
    .modal-footer-censor { background: var(--green); }

    .modal-footer .opt-label { color: var(--text-on-color); }

    .aspect-btns { display: flex; gap: 5px; }

    .aspect-btn {
      background: transparent;
      border: 2px solid var(--text-on-color);
      color: var(--text-on-color);
      font-family: 'DM Sans', sans-serif;
      font-size: 12px; font-weight: 700;
      padding: 4px 12px; border-radius: var(--r);
      cursor: pointer; transition: background 0.1s;
    }

    .aspect-btn:hover  { background: rgba(0,0,0,0.1); }
    .aspect-btn.active { background: var(--text-on-color); color: var(--text-ui); }

    .modal-actions { display: flex; gap: 8px; margin-left: auto; }

    .btn-secondary {
      background: transparent;
      border: 2px solid var(--text-on-color);
      color: var(--text-on-color);
      font-family: 'DM Sans', sans-serif;
      font-size: 13px; font-weight: 700;
      padding: 7px 16px; border-radius: var(--r);
      cursor: pointer; transition: background 0.1s;
    }

    .btn-secondary:hover { background: rgba(0,0,0,0.1); }

    .btn-primary {
      background: var(--text-on-color); border: none; color: var(--text-ui);
      font-family: 'DM Sans', sans-serif;
      font-size: 13px; font-weight: 800;
      padding: 8px 22px; border-radius: var(--r);
      cursor: pointer; transition: filter 0.1s;
    }

    .btn-primary:hover { filter: brightness(1.2); }

    .modal-footer .pill {
      background: transparent;
      border: 2px solid var(--text-on-color);
      color: var(--text-on-color);
    }

    .modal-footer .pill:hover { background: rgba(0,0,0,0.1); }
    .modal-footer .pill.active { background: var(--text-on-color); color: var(--text-ui); }

    .modal-footer .slider-val { color: var(--text-on-color); }

    .modal-footer input[type="range"] {
      background: var(--text-on-color);
    }

    .modal-footer input[type="range"]::-webkit-slider-thumb {
      background: var(--text-on-color);
      border: 2px solid rgba(255,255,255,0.4);
    }

    
    #carbonads {
      width: 100%; max-width: 1200px;
      display: flex;
      align-items: center;
      gap: 16px;
      background: var(--ink);
      border-radius: var(--r);
      padding: 12px 18px;
      text-decoration: none;
    }

    #carbonads a { text-decoration: none; }

    .carbon-img img {
      width: 48px; height: 48px;
      object-fit: cover;
      border-radius: var(--r);
      display: block;
      flex-shrink: 0;
    }

    .carbon-text {
      font-size: 12px; font-weight: 600;
      color: #888; line-height: 1.5;
      flex: 1;
    }

    .carbon-poweredby {
      font-size: 10px; font-weight: 700;
      color: #555; letter-spacing: 0.08em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    @media (max-width: 520px) {
      .options-bar { flex-direction: column; align-items: flex-start; }
      .modal-footer { flex-direction: column; }
      .modal-actions { margin-left: 0; }
      .divider { display: none; }
    }

@media (max-width: 768px) {
  .crop-handle {
    width: 22px;
    height: 22px;
  }
  .handle-nw { top:-12px; left:-12px; }
  .handle-ne { top:-12px; right:-12px; }
  .handle-sw { bottom:-12px; left:-12px; }
  .handle-se { bottom:-12px; right:-12px; }
  .handle-n  { top:-12px; left:50%; transform:translateX(-50%); }
  .handle-s  { bottom:-12px; left:50%; transform:translateX(-50%); }
  .handle-w  { left:-12px; top:50%; transform:translateY(-50%); }
  .handle-e  { right:-12px; top:50%; transform:translateY(-50%); }

  .crop-badge, .censor-badge {
    padding: 13px 4px;
    font-size: 12px;
    -webkit-tap-highlight-color: transparent;
  }

  .card-thumb {
    -webkit-tap-highlight-color: transparent;
  }

  header {
    width: calc(100% - 24px);
    padding: 28px 20px 24px;
  }

  .page-body {
    width: calc(100% - 24px);
  }

  .drop-zone {
    padding: 36px 24px;
  }

  .options-bar {
    padding: 12px 14px;
    gap: 10px;
  }

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

  .panel-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .bulk-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .bulk-btn {
    text-align: center;
    padding: 12px 18px;
  }
}
