:root {
  --blue: #0B5FD4;
  --blue-dark: #0A3D91;
  --blue-navy: #0A2350;
  --sky: #2E90FA;
  --ink: #0F1B33;
  --body: #45516b;
  --muted: #7B8698;
  --bg: #F4F8FF;
  --card: #ffffff;
  --line: #E4EAF3;
  --danger: #D92D20;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(11, 95, 212, .12);
}

* { box-sizing: border-box; }

/* The hidden attribute must win over any element's display rule (e.g. display:flex). */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page { max-width: 1140px; margin: 0 auto; padding: 0 22px; }
a { color: inherit; }

/* NAV */
.nav { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; object-fit: cover; display: block;
  box-shadow: 0 8px 20px rgba(11, 95, 212, .28);
}
.brand-logo.sm { width: 30px; height: 30px; border-radius: 9px; box-shadow: none; }
.brand-word { font-size: 22px; font-weight: 800; letter-spacing: -.4px; color: var(--blue-dark); }
.brand-by {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: #EEF4FF; border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px;
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { text-decoration: none; font-weight: 600; font-size: 15px; color: var(--ink); }
.nav-links a:hover { color: var(--blue); }
.nav-ghost {
  color: var(--blue-dark) !important; border: 1px solid var(--blue);
  padding: 8px 15px; border-radius: 10px; font-weight: 700 !important;
}
.nav-ghost:hover { background: #EEF4FF; }

/* HERO */
.hero { text-align: center; padding: 40px 0 34px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 800; color: var(--blue); margin-bottom: 16px; }
.hero h1 { font-size: 46px; line-height: 1.08; margin: 0 auto 18px; letter-spacing: -1.1px; font-weight: 800; max-width: 720px; }
.accent { color: var(--blue); }
.lede { font-size: 17.5px; color: var(--body); line-height: 1.62; max-width: 620px; margin: 0 auto; }
.lede b { color: var(--ink); }

/* TOOL */
.tool { padding: 10px 0 20px; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel { padding: 24px; display: flex; flex-direction: column; }
.panel-title { margin: 0 0 18px; font-size: 16px; font-weight: 800; color: var(--blue-dark); letter-spacing: -.2px; }

/* DROPZONE */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 220px; padding: 24px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 14px; color: var(--muted);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--sky); background: #F0F7FF; color: var(--blue); }
.dz-main { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.dz-main b { color: var(--blue); }
.dz-sub { font-size: 13px; }

/* PREVIEW */
.preview-wrap { display: flex; flex-direction: column; gap: 12px; }
.preview-stage {
  position: relative; display: grid; place-items: center;
  background: repeating-conic-gradient(#eef3fb 0% 25%, #fff 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-height: 240px; max-height: 420px;
}
.preview-stage img { max-width: 100%; max-height: 420px; display: block; }
.crop-overlay { position: absolute; inset: 0; }
.crop-box {
  position: absolute; border: 2px solid var(--sky); box-shadow: 0 0 0 9999px rgba(10, 35, 80, .45);
  cursor: move; touch-action: none;
}
.preview-meta { display: flex; align-items: center; justify-content: space-between; }
.src-info { font-size: 13px; color: var(--muted); font-weight: 600; }
.link-btn { background: none; border: none; color: var(--blue); font-weight: 700; font-size: 13.5px; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* FIELDS */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 700; color: var(--ink); }
.field-label .muted, .muted { color: var(--muted); font-weight: 600; }
.input {
  width: 100%; min-width: 0; padding: 11px 13px; font: inherit; font-size: 14.5px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 11px; outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(46, 144, 250, .15); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237B8698' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.dim-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.ratio-lock {
  height: 44px; width: 44px; display: grid; place-items: center; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--muted); cursor: pointer;
  transition: all .12s ease;
}
.ratio-lock[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }

.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chips-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.chip {
  padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 700; color: var(--blue-dark);
  background: #EEF4FF; border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.chip:hover { background: #E2EDFF; }

/* BUTTON */
.process-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; margin-top: 6px; padding: 13px 18px; font: inherit; font-weight: 800; font-size: 15px;
  color: #fff; text-decoration: none; border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--blue), var(--blue-navy));
  box-shadow: 0 12px 24px rgba(11, 95, 212, .30); transition: transform .12s ease, filter .12s ease, opacity .12s ease;
}
.process-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); }
.process-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.spinner { width: 17px; height: 17px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@@keyframes spin { to { transform: rotate(360deg); } }
.error-msg { margin: 12px 0 0; color: var(--danger); font-size: 13.5px; font-weight: 600; }

/* PROCESSING BAR */
.processing-bar { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.processing-bar .pb-label { font-size: 13.5px; font-weight: 700; color: var(--blue-dark); display: flex; align-items: center; gap: 8px; }
.processing-bar .pb-track { height: 8px; border-radius: 999px; background: #E2EDFF; overflow: hidden; }
.processing-bar .pb-fill {
  height: 100%; width: 40%; border-radius: 999px;
  background: linear-gradient(90deg, var(--sky), var(--blue));
  animation: indeterminate 1.1s ease-in-out infinite;
}
@@keyframes indeterminate {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}

/* RESULT */
.result { grid-column: 1 / -1; margin-top: 22px; padding: 24px; }
.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.result-body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: center; }
.result-preview {
  display: grid; place-items: center; min-height: 220px; padding: 16px; border-radius: 14px;
  background: repeating-conic-gradient(#eef3fb 0% 25%, #fff 0% 50%) 50% / 20px 20px; border: 1px solid var(--line);
}
.result-preview img { max-width: 100%; max-height: 300px; border-radius: 6px; }
.result-info { display: flex; flex-direction: column; gap: 14px; }
.stat { display: flex; flex-direction: column; }
.stat-val { font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -.4px; }
.stat-key { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.r-note { margin: 0; font-size: 13px; color: #B54708; background: #FFFAEB; border: 1px solid #FEDF89; padding: 9px 12px; border-radius: 9px; }

/* GET APP */
.getapp {
  display: flex; align-items: center; gap: 30px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  padding: 36px; margin: 40px 0 12px; box-shadow: var(--shadow);
}
.getapp-text { flex: 1 1 320px; }
.getapp-badge {
  display: inline-block; background: #EEF4FF; color: var(--blue-dark);
  border: 1px solid var(--line); font-weight: 700; font-size: 13px;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 4px;
}
.getapp-text h2 { margin: 12px 0 8px; font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.getapp-text p { margin: 0; color: var(--body); font-size: 16px; line-height: 1.6; max-width: 520px; }
.getapp-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 22px; }
.getapp-icon {
  width: 120px; height: 120px; border-radius: 27px; object-fit: cover;
  border: 1px solid var(--line); box-shadow: 0 16px 32px rgba(10, 35, 80, .22);
}
.download-btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  background: linear-gradient(135deg, var(--blue), var(--blue-navy)); color: #fff;
  font-weight: 800; font-size: 15.5px; padding: 14px 26px; border-radius: 12px;
  box-shadow: 0 12px 24px rgba(11, 95, 212, .30); transition: transform .12s ease, filter .12s ease;
}
.download-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.download-count { font-size: 14.5px; color: var(--blue-dark); font-weight: 700; }
.download-count b { color: var(--blue); font-weight: 800; }
.download-note { display: block; margin-top: 12px; color: var(--muted); font-size: 13px; }

/* ABOUT */
.about {
  text-align: center; color: #fff; border-radius: 24px; padding: 48px 26px; margin: 40px 0 36px;
  background: linear-gradient(135deg, #0B5FD4 0%, #0A2350 100%); box-shadow: var(--shadow);
}
.about-badge { display: inline-block; background: rgba(255,255,255,.18); color: #fff; font-weight: 700; font-size: 13px; padding: 6px 16px; border-radius: 999px; margin-bottom: 16px; }
.about h2 { margin: 0 0 12px; font-size: 30px; font-weight: 800; letter-spacing: -.6px; }
.about p { margin: 0 auto; max-width: 660px; font-size: 16.5px; line-height: 1.65; color: #DDE8FB; }

/* FOOTER */
.foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 0 40px; border-top: 1px solid var(--line); }
.foot-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--blue-dark); }
.foot-brand b { color: var(--sky); }
.foot-meta { color: var(--muted); font-size: 13px; }

/* RESPONSIVE */
@@media (max-width: 860px) {
  .tool-grid { grid-template-columns: 1fr; }
  .result-body { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; }
}

@@media (max-width: 560px) {
  /* Stack width/height side by side with the lock on its own row. */
  .dim-row { grid-template-columns: 1fr 1fr; grid-template-areas: "w h" "lock lock"; }
  .dim-row > :nth-child(1) { grid-area: w; }
  .dim-row > .ratio-lock { grid-area: lock; width: 100%; justify-self: stretch; margin-bottom: 8px; }
  .dim-row > :nth-child(3) { grid-area: h; }
  .getapp { padding: 24px; }
  .getapp-icon { width: 96px; height: 96px; }
}
