

:root{
  --bg: #f5f8fb;
  --card: #ffffff;
  --muted: #6b7280;
  --accent: #0f4c81;       /* deep blue primary */
  --accent-2: #1366b2;     /* hover */
  --accent-soft: #eef6ff;
  --success: #16a34a;
  --glass: rgba(12, 24, 40, 0.04);

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-md: 0 8px 24px rgba(12,24,40,0.08);
  --shadow-sm: 0 4px 12px rgba(12,24,40,0.06);
  --max-width: 1100px;
}

* { box-sizing: border-box; }
html,body { height: 100%; }
body{
  margin:0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: linear-gradient(180deg, var(--bg), #eef4fb 200px);
  color: #07102a;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  line-height:1.45;
}

* {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      body {
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        background: linear-gradient(135deg, #0f4c81 0%, #1a5ba8 50%, #0d3a5c 100%);
        color: #333;
        overflow-x: hidden;
      }

      /* HEADER / NAV */
      header {
        background: rgba(15, 76, 129, 0.95);
        backdrop-filter: blur(10px);
        color: #fff;
        padding: 15px 20px;
        text-align: center;
        font-weight: 600;
        font-size: 24px;
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        animation: slideDown 0.6s ease-out;
      }

      @keyframes slideDown {
        from {
          opacity: 0;
          transform: translateY(-20px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }

      /* HERO SECTION */
      .hero {
        text-align: center;
        color: #fff;
        padding: 80px 20px;
        background: linear-gradient(135deg, rgba(15, 76, 129, 0.9) 0%, rgba(26, 91, 168, 0.9) 100%),
                    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><rect fill="%23ffffff" opacity="0.05" width="1200" height="600"/><circle cx="200" cy="150" r="80" fill="%23ffffff" opacity="0.1"/><circle cx="1000" cy="500" r="120" fill="%23ffffff" opacity="0.08"/></svg>');
        background-size: cover;
        position: relative;
        overflow: hidden;
      }

      .hero::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
        animation: float 20s ease-in-out infinite;
      }

      @keyframes float {
        0%, 100% { transform: translateY(0px); }
        50% { transform: translateY(20px); }
      }

      .hero h1 {
        font-size: 48px;
        font-weight: 700;
        margin-bottom: 20px;
        animation: fadeInUp 0.8s ease-out 0.2s both;
        position: relative;
        z-index: 1;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
      }

      .hero p {
        font-size: 18px;
        margin-bottom: 30px;
        animation: fadeInUp 0.8s ease-out 0.4s both;
        position: relative;
        z-index: 1;
        opacity: 0.95;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
      }

      @keyframes fadeInUp {
        from {
          opacity: 0;
          transform: translateY(30px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }

      /* FEATURES SECTION */
      .features {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 30px;
        max-width: 1100px;
        margin: -60px auto 60px;
        padding: 0 20px;
        position: relative;
        z-index: 10;
        margin-top: 3rem;
      }

      .feature-card {
        background: #fff;
        padding: 35px 25px;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
        text-align: center;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        animation: fadeInUp 0.8s ease-out forwards;
        opacity: 0;
      }

      .feature-card:nth-child(1) { animation-delay: 0.5s; }
      .feature-card:nth-child(2) { animation-delay: 0.6s; }
      .feature-card:nth-child(3) { animation-delay: 0.7s; }

      .feature-card:hover {
        transform: translateY(-15px);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
      }

      .feature-icon {
        font-size: 40px;
        margin-bottom: 15px;
      }

      .feature-card h3 {
        font-size: 18px;
        margin-bottom: 10px;
        color: #0f4c81;
      }

      .feature-card p {
        color: #666;
        font-size: 14px;
        line-height: 1.6;
      }

      /* MAIN WRAPPER */
      .wrap {
        max-width: 900px;
        margin: 0 auto;
        padding: 40px 20px;
      }

      /* SECTION TITLE */
      .section-title {
        text-align: center;
        color: #fff;
        font-size: 36px;
        font-weight: 700;
        margin-bottom: 50px;
        animation: fadeInUp 0.8s ease-out;
      }

      /* CARD */
      .card {
        background: #fff;
        padding: 40px;
        border-radius: 15px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
        animation: fadeInUp 0.8s ease-out 0.3s both;
      }

      /* FORM ELEMENTS */
      label {
        display: block;
        margin-top: 20px;
        margin-bottom: 8px;
        font-weight: 600;
        font-size: 14px;
        color: #0f4c81;
        text-transform: uppercase;
        letter-spacing: 0.5px;
      }

      input,
      select {
        width: 100%;
        padding: 12px 15px;
        margin-top: 5px;
        margin-bottom: 5px;
        border: 2px solid #e0e7ff;
        border-radius: 8px;
        font-size: 14px;
        transition: all 0.3s ease;
        background: #f8f9fc;
      }

      input:focus,
      select:focus {
        outline: none;
        border-color: #0f4c81;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.1);
        transform: scale(1.01);
      }

      input::placeholder {
        color: #aaa;
      }

      /* BUTTON */
      button {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 1px;
        cursor: pointer;
        background: linear-gradient(135deg, #0f4c81 0%, #1a5ba8 100%);
        color: #fff;
        border: none;
        border-radius: 8px;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 0 8px 20px rgba(15, 76, 129, 0.3);
        position: relative;
        overflow: hidden;
      }

      button:disabled {
        background: linear-gradient(135deg, #999 0%, #777 100%);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
      }

      button:disabled:hover {
        transform: none;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
      }

      button::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
      }

      button:hover {
        transform: translateY(-3px);
        box-shadow: 0 15px 35px rgba(15, 76, 129, 0.4);
      }

      button:hover::before {
        width: 300px;
        height: 300px;
      }

      button:active {
        transform: translateY(-1px);
      }

      /* CUSTOM BOX */
      #customBox {
        background: #f8f9fc;
        padding: 20px;
        border-radius: 8px;
        border-left: 4px solid #0f4c81;
        animation: slideIn 0.3s ease-out;
      }

      @keyframes slideIn {
        from {
          opacity: 0;
          max-height: 0;
          transform: translateY(-10px);
        }
        to {
          opacity: 1;
          max-height: 200px;
          transform: translateY(0);
        }
      }

      /* STATUS MESSAGE */
      .status {
        margin-top: 20px;
        padding: 15px;
        font-weight: 600;
        border-radius: 8px;
        text-align: center;
        background: #e8f5e9;
        color: #2e7d32;
        animation: fadeIn 0.4s ease;
        transition: all 0.3s ease;
      }

      @keyframes fadeIn {
        from {
          opacity: 0;
        }
        to {
          opacity: 1;
        }
      }

      /* FILE INPUT STYLING */
      input[type="file"] {
        padding: 20px;
        text-align: center;
        cursor: pointer;
      }

      input[type="file"]::file-selector-button {
        padding: 8px 16px;
        background: linear-gradient(135deg, #0f4c81 0%, #1a5ba8 100%);
        color: #fff;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-weight: 600;
        transition: all 0.3s ease;
        margin-right: 10px;
      }

      input[type="file"]::file-selector-button:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(15, 76, 129, 0.3);
      }

      /* FOOTER */
      footer {
        background: rgba(0, 0, 0, 0.8);
        color: #fbfbfb;
        text-align: center;
        padding: 30px 20px;
        margin-top: 60px;
        font-size: 14px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
      }

      footer p {
        margin: 5px 0;
      }

      /* RESPONSIVE */
      @media (max-width: 768px) {
        .hero h1 {
          font-size: 36px;
        }

        .hero p {
          font-size: 16px;
        }

        .section-title {
          font-size: 28px;
        }

        .card {
          padding: 25px;
        }

        input[type="file"]::file-selector-button {
          margin-bottom: 8px;
          display: block;
        }

        .features {
          margin: -40px 20px 40px;
        }
      }

      /* LOADING ANIMATION */
      @keyframes spin {
        to { transform: rotate(360deg); }
      }

      .status.loading::before {
        content: '⟳';
        display: inline-block;
        animation: spin 1s linear infinite;
        margin-right: 8px;
      }

      /* PREVIEW SECTION */
      .preview-section {
        max-width: 900px;
        margin: 50px auto;
        padding: 0 20px;
      }

      .preview-section h2 {
        text-align: center;
        color: #fff;
        font-size: 32px;
        margin-bottom: 40px;
        animation: fadeInUp 0.8s ease-out;
      }

      .preview-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
      }

      .preview-card {
        background: #fff;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
        animation: fadeInUp 0.8s ease-out forwards;
        opacity: 0;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
      }

      .preview-card:nth-child(1) { animation-delay: 0.2s; }
      .preview-card:nth-child(2) { animation-delay: 0.3s; }
      .preview-card:nth-child(3) { animation-delay: 0.4s; }

      .preview-card:hover {
        transform: translateY(-10px);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
      }

      .preview-card.hidden {
        display: none;
      }

      .preview-image {
        width: 100%;
        height: 250px;
        background: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        color: #999;
        font-size: 14px;
        position: relative;
        overflow: hidden;
      }

      .preview-image img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
      }

      .preview-image.empty {
        color: #ccc;
      }

      .preview-info {
        padding: 20px;
      }

      .preview-title {
        font-size: 16px;
        font-weight: 600;
        color: #0f4c81;
        margin-bottom: 15px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
      }

      .size-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid #eee;
        font-size: 13px;
      }

      .size-row:last-child {
        border-bottom: none;
      }

      .size-label {
        color: #666;
        font-weight: 500;
      }

      .size-value {
        color: #0f4c81;
        font-weight: 600;
      }

      .size-reduction {
        background: #e8f5e9;
        color: #2e7d32;
        padding: 10px;
        border-radius: 6px;
        text-align: center;
        margin-top: 10px;
        font-size: 12px;
        font-weight: 600;
      }

      .size-reduction.negative {
        background: #fff3e0;
        color: #e65100;
      }

      .preview-empty-state {
        text-align: center;
        padding: 40px 20px;
        color: #bbb;
      }

      .preview-empty-state p {
        font-size: 14px;
        margin: 10px 0;
      }

      /* VIEWER MODAL */
      .viewer-modal {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.65);
        display: none;
        align-items: center;
        justify-content: center;
        padding: 20px;
        z-index: 500;
      }

      .viewer-modal.active {
        display: flex;
      }

      .viewer-content {
        width: min(95vw, 900px);
        max-height: 90vh;
        background: #fff;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
        display: flex;
        flex-direction: column;
      }

      .viewer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #0f4c81;
        color: #fff;
        padding: 12px 16px;
      }

      .viewer-body {
        flex: 1;
        padding: 12px;
        overflow: auto;
      }

      .viewer-body img,
      .viewer-body iframe,
      .viewer-body object {
        width: 100%;
        height: 100%;
      }

      .viewer-close {
        border: 0;
        background: #fde047;
        color: #0f4c81;
        font-weight: 700;
        border-radius: 6px;
        padding: 8px 14px;
        cursor: pointer;
      }

      .icon-button {
        width: auto !important;
        min-width: 40px;
        max-width: 40px;
        padding: 8px;
        font-size: 14px;
        line-height: 1;
        text-transform: none;
      }

      .preview-action {
        width: auto !important;
      }

      /* MERGE SECTION */
      .merge-section {
        max-width: 900px;
        margin: 40px auto;
        padding: 0 20px;
      }

      .merge-section h2 {
        text-align: center;
        color: #fff;
        font-size: 32px;
        margin-bottom: 30px;
        animation: fadeInUp 0.8s ease-out;
      }

      .merge-list {
        margin-top: 15px;
        border: 1px solid rgba(15, 76, 129, 0.25);
        border-radius: 12px;
        padding: 12px;
        background: rgba(255, 255, 255, 0.9);
      }

      .merge-item {
        display: grid;
        grid-template-columns: 1fr auto auto auto auto;
        gap: 8px;
        align-items: center;
        padding: 10px 12px;
        border-bottom: 1px solid rgba(15, 76, 129, 0.12);
      }

      .merge-item:last-child {
        border-bottom: none;
      }

      .merge-item span {
        font-size: 14px;
        color: #0f4c81;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .merge-item button {
        padding: 6px 10px;
        font-size: 12px;
        border-radius: 8px;
      }

      .merge-item button:hover {
        opacity: 0.95;
      }

      .merge-empty {
        margin: 0;
        font-size: 14px;
        color: #666;
      }

