/* Image to PDF – scoped under .itp-app so themes don't leak in */
.itp-app {
	--itp-ink: #14213d;
	--itp-ink2: #22335c;
	--itp-paper: #f5f7fb;
	--itp-line: #dde3ee;
	--itp-text: #1c2438;
	--itp-mute: #5d6884;
	--itp-ok: #138a36;
	--itp-r: 18px;
	box-sizing: border-box;
	max-width: 940px;
	margin: 28px auto;
	background: #fff;
	color: var(--itp-text);
	border-radius: var(--itp-r);
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(20, 33, 61, .08), 0 18px 48px -16px rgba(20, 33, 61, .28);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Mukta", "Nirmala UI", "Mangal", sans-serif;
	font-size: 16px;
	line-height: 1.45;
}
.itp-app *, .itp-app *::before, .itp-app *::after { box-sizing: border-box; }
.itp-app [hidden] { display: none !important; }
.itp-app .itp-hi, .itp-app [lang="hi"] { font-family: "Noto Sans Devanagari", "Mukta", "Nirmala UI", "Mangal", system-ui, sans-serif; }

/* Bilingual label: English first, Hindi beneath */
.itp-app .itp-en { display: block; }
.itp-app .itp-hi { display: block; font-size: .82em; font-weight: 500; opacity: .82; margin-top: 1px; }

/* ---------- Header ---------- */
.itp-app .itp-head {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 6px 20px;
	align-items: center;
	padding: 26px 28px 24px;
	color: #fff;
	background: linear-gradient(120deg, var(--itp-ink) 0%, var(--itp-ink2) 100%);
}
.itp-app .itp-stack { position: relative; width: 64px; height: 74px; flex: none; }
.itp-app .itp-stack i {
	position: absolute; inset: 0; border-radius: 6px; background: #fff;
	box-shadow: 0 6px 14px rgba(0, 0, 0, .25);
}
.itp-app .itp-stack i:nth-child(1) { transform: rotate(-10deg) translate(-8px, 2px); opacity: .45; }
.itp-app .itp-stack i:nth-child(2) { transform: rotate(6deg) translate(6px, 0); opacity: .75; }
.itp-app .itp-stack i:nth-child(3) {
	background:
		linear-gradient(var(--itp-accent), var(--itp-accent)) 10px 12px / 28px 5px no-repeat,
		linear-gradient(#cbd3e4, #cbd3e4) 10px 26px / 44px 4px no-repeat,
		linear-gradient(#cbd3e4, #cbd3e4) 10px 36px / 38px 4px no-repeat,
		linear-gradient(#cbd3e4, #cbd3e4) 10px 46px / 42px 4px no-repeat,
		#fff;
}
.itp-app .itp-title { margin: 0; padding: 0; font-size: 1.75rem; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; color: #fff; border: 0; }
.itp-app .itp-title-hi { margin: 2px 0 0; font-size: 1.05rem; font-weight: 600; color: #ffd2b0; }
.itp-app .itp-sub { margin: 8px 0 0; font-size: .95rem; color: #c9d3ea; max-width: 56ch; }
.itp-app .itp-private {
	grid-column: 1 / -1; margin: 12px 0 0; padding: 7px 14px 7px 34px; width: fit-content;
	border-radius: 999px; font-size: .84rem; font-weight: 600; color: #dff7e6;
	background: rgba(19, 138, 54, .28) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239df0b4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") 11px 50% / 16px no-repeat;
}
.itp-app .itp-private .itp-hi { display: inline; margin-left: 6px; }
.itp-app .itp-private .itp-en { display: inline; }

/* ---------- Body ---------- */
.itp-app .itp-body { padding: 24px 28px 28px; background: var(--itp-paper); }

/* Drop zone */
.itp-app .itp-drop {
	display: flex; flex-direction: column; align-items: center; gap: 10px;
	padding: 30px 20px; text-align: center; cursor: pointer;
	background: #fff; border: 2px dashed #b9c3da; border-radius: var(--itp-r);
	color: var(--itp-ink2);
	transition: border-color .15s, background .15s, transform .15s;
}
.itp-app .itp-drop:hover, .itp-app .itp-drop:focus-visible, .itp-app .itp-drop.is-over {
	border-color: var(--itp-accent); background: #fffaf6; outline: none;
}
.itp-app .itp-drop.is-over { transform: scale(1.01); }
.itp-app .itp-drop:focus-visible { box-shadow: 0 0 0 3px rgba(242, 107, 29, .3); }
.itp-app.has-files .itp-drop { padding: 16px 20px; flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 14px; }
.itp-app.has-files .itp-drop-ico, .itp-app.has-files .itp-drop-n { display: none; }
.itp-app .itp-drop-ico { color: var(--itp-accent); }
.itp-app .itp-drop-t { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--itp-ink); }
.itp-app .itp-drop-n { color: var(--itp-mute); font-size: .82rem; }

/* Buttons */
.itp-app .itp-btn {
	appearance: none; -webkit-appearance: none; border: 0; cursor: pointer; text-decoration: none; text-align: center;
	display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
	padding: 11px 22px; min-height: 48px; border-radius: 12px;
	background: var(--itp-accent); color: #fff; font: inherit; font-weight: 700; line-height: 1.2;
	box-shadow: 0 6px 16px -6px var(--itp-accent);
	transition: filter .15s, transform .1s, box-shadow .15s;
}
.itp-app .itp-btn:hover { filter: brightness(.93); color: #fff; }
.itp-app .itp-btn:active { transform: translateY(1px); }
.itp-app .itp-btn:focus-visible { outline: 3px solid rgba(20, 33, 61, .45); outline-offset: 2px; }
.itp-app .itp-btn:disabled { background: #c3cad9; box-shadow: none; cursor: not-allowed; filter: none; color: #fff; }
.itp-app .itp-btn .itp-hi { color: inherit; opacity: .92; }
.itp-app .itp-ghost { background: #fff; color: var(--itp-ink); box-shadow: inset 0 0 0 2px var(--itp-line); }
.itp-app .itp-ghost:hover { color: var(--itp-ink); background: #f0f3fa; filter: none; }
.itp-app .itp-go { width: 100%; font-size: 1.15rem; min-height: 58px; margin-top: 18px; background: linear-gradient(120deg, var(--itp-accent), var(--itp-accent)); }
.itp-app .itp-link {
	appearance: none; background: none; border: 0; padding: 4px 6px; margin-left: auto; cursor: pointer;
	font: inherit; font-weight: 600; font-size: .9rem; color: #c0341d; text-align: right;
}
.itp-app .itp-link:hover { text-decoration: underline; }

/* Toast */
.itp-app .itp-toast {
	margin-top: 14px; padding: 11px 14px; border-radius: 10px; font-size: .92rem; font-weight: 600;
	background: #e9efff; color: var(--itp-ink);
}
.itp-app .itp-toast.is-warn { background: #fff1e2; color: #8a3b00; box-shadow: inset 4px 0 0 var(--itp-accent); }

/* ---------- Pages grid ---------- */
.itp-app .itp-files { margin-top: 20px; }
.itp-app .itp-bar { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.itp-app .itp-count { font-size: 1rem; color: var(--itp-ink); }
.itp-app .itp-bar-hint { color: var(--itp-mute); font-size: .82rem; }
.itp-app .itp-bar-hint .itp-en, .itp-app .itp-bar-hint .itp-hi { display: inline; }
.itp-app .itp-bar-hint .itp-hi { margin-left: 6px; }
.itp-app .itp-grid {
	list-style: none; margin: 0; padding: 0;
	display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px;
}
.itp-app .itp-grid li {
	position: relative; margin: 0; padding: 8px 8px 6px; background: #fff; border-radius: 12px; cursor: grab;
	box-shadow: 0 1px 2px rgba(20, 33, 61, .1), 0 6px 14px -8px rgba(20, 33, 61, .3);
	transition: transform .12s, box-shadow .12s;
}
.itp-app .itp-grid li:hover { transform: translateY(-2px); }
.itp-app .itp-grid li.is-drag { opacity: .4; }
.itp-app .itp-grid li.is-target { box-shadow: 0 0 0 3px var(--itp-accent); }
.itp-app .itp-pg {
	position: absolute; top: -8px; left: -8px; z-index: 2; min-width: 26px; height: 26px; padding: 0 7px;
	display: grid; place-items: center; border-radius: 13px;
	background: var(--itp-ink); color: #fff; font-size: .78rem; font-weight: 800;
	box-shadow: 0 0 0 3px var(--itp-paper);
}
.itp-app .itp-thumb { aspect-ratio: 3 / 4; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: repeating-conic-gradient(#eef1f7 0 25%, #f8f9fc 0 50%) 0 0 / 14px 14px; }
.itp-app .itp-thumb img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; transition: transform .2s; }
.itp-app .itp-meta { margin-top: 6px; min-width: 0; }
.itp-app .itp-meta span { display: block; font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.itp-app .itp-meta small { display: block; color: var(--itp-mute); font-size: .72rem; }
.itp-app .itp-tools { display: flex; justify-content: space-between; margin-top: 6px; }
.itp-app .itp-tools button {
	appearance: none; -webkit-appearance: none; flex: 1; margin: 0 2px; min-height: 34px; padding: 0; border: 0; border-radius: 8px;
	background: #eef1f8; color: var(--itp-ink); font-size: 1.05rem; line-height: 1; cursor: pointer;
}
.itp-app .itp-tools button:hover { background: #dfe5f3; }
.itp-app .itp-tools button.is-del { color: #c0341d; }
.itp-app .itp-tools button.is-del:hover { background: #fde4df; }
.itp-app .itp-tools button:focus-visible { outline: 2px solid var(--itp-accent); }

/* ---------- Settings ---------- */
.itp-app .itp-settings { margin-top: 20px; }
.itp-app .itp-fs { margin: 0 0 14px; padding: 16px 18px 18px; background: #fff; border: 0; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--itp-line); min-width: 0; }
.itp-app .itp-fs legend { padding: 0 8px; margin-left: -8px; font-weight: 800; color: var(--itp-ink); font-size: 1rem; }
.itp-app .itp-fs legend .itp-en, .itp-app .itp-fs legend .itp-hi { display: inline; }
.itp-app .itp-fs legend .itp-hi { margin-left: 6px; font-weight: 600; }

.itp-app .itp-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 4px 0 16px; }
.itp-app .itp-preset { position: relative; display: block; cursor: pointer; margin: 0; }
.itp-app .itp-preset input { position: absolute; opacity: 0; inset: 0; }
.itp-app .itp-preset-c {
	display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px 12px 10px;
	border-radius: 12px; background: var(--itp-paper); box-shadow: inset 0 0 0 2px transparent;
	transition: background .15s, box-shadow .15s;
}
.itp-app .itp-preset-c b { font-size: .95rem; color: var(--itp-ink); }
.itp-app .itp-preset-c em { font-style: normal; font-size: .75rem; color: var(--itp-mute); line-height: 1.3; }
.itp-app .itp-preset:hover .itp-preset-c { background: #eaeff8; }
.itp-app .itp-preset input:checked + .itp-preset-c { background: #fff6ee; box-shadow: inset 0 0 0 2px var(--itp-accent); }
.itp-app .itp-preset input:focus-visible + .itp-preset-c { outline: 3px solid rgba(20, 33, 61, .45); outline-offset: 2px; }

.itp-app .itp-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.itp-app .itp-row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.itp-app .itp-grow { flex: 1 1 240px; }
.itp-app .itp-field { display: block; margin: 0; min-width: 0; }
.itp-app .itp-lab { display: block; margin-bottom: 6px; font-size: .86rem; font-weight: 700; color: var(--itp-ink); }
.itp-app .itp-lab .itp-en { display: inline; }
.itp-app .itp-lab .itp-hi { display: block; font-weight: 500; }
.itp-app .itp-qv { font-weight: 800; color: var(--itp-accent); }
.itp-app .itp-field select, .itp-app .itp-field input[type="number"], .itp-app .itp-field input[type="text"] {
	display: block; width: 100%; height: 44px; margin: 0; padding: 0 12px; font: inherit; font-size: .95rem; color: var(--itp-text);
	background: #fff; border: 1.5px solid var(--itp-line); border-radius: 10px; box-shadow: none;
}
.itp-app .itp-field select:focus, .itp-app .itp-field input:focus { outline: none; border-color: var(--itp-accent); box-shadow: 0 0 0 3px rgba(242, 107, 29, .2); }
.itp-app .itp-field input[type="range"] { width: 100%; height: 44px; margin: 0; accent-color: var(--itp-accent); }

/* ---------- Progress ---------- */
.itp-app .itp-progress { margin-top: 18px; }
.itp-app .itp-track { display: block; height: 10px; border-radius: 6px; background: #dfe5f3; overflow: hidden; }
.itp-app .itp-track i { display: block; height: 100%; width: 0; background: var(--itp-accent); border-radius: 6px; transition: width .2s; }
.itp-app .itp-ptxt { display: block; margin-top: 8px; font-size: .88rem; font-weight: 600; color: var(--itp-mute); }

/* ---------- Result ---------- */
.itp-app .itp-result {
	margin-top: 18px; padding: 20px; background: #fff; border-radius: 14px;
	box-shadow: inset 0 0 0 2px var(--itp-ok);
}
.itp-app .itp-result-top { display: flex; gap: 14px; align-items: center; }
.itp-app .itp-rt { display: block; font-size: 1.1rem; color: var(--itp-ink); }
.itp-app .itp-rs { margin: 2px 0 0; font-size: .86rem; color: var(--itp-mute); word-break: break-all; }
.itp-app .itp-compare { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 16px 0; padding: 14px 16px; background: var(--itp-paper); border-radius: 12px; }
.itp-app .itp-compare small { display: block; font-size: .78rem; color: var(--itp-mute); }
.itp-app .itp-compare small .itp-en, .itp-app .itp-compare small .itp-hi { display: inline; }
.itp-app .itp-compare small .itp-hi { margin-left: 4px; }
.itp-app .itp-compare b { font-size: 1.35rem; color: var(--itp-ink); }
.itp-app .itp-arrow { font-size: 1.4rem; color: var(--itp-mute); }
.itp-app .itp-pill { margin-left: auto; padding: 6px 14px; border-radius: 999px; font-weight: 800; background: #dff5e6; color: var(--itp-ok); }
.itp-app .itp-pill.is-up { background: #fde8d6; color: #a84300; }
.itp-app .itp-warn { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: #fff1e2; color: #8a3b00; font-size: .88rem; font-weight: 600; }
.itp-app .itp-result-act { display: flex; gap: 12px; flex-wrap: wrap; }
.itp-app .itp-result-act .itp-btn { flex: 1 1 200px; }
.itp-app .itp-dl { background: var(--itp-ok); box-shadow: 0 6px 16px -6px var(--itp-ok); }

/* ---------- Glossary ---------- */
.itp-app .itp-gloss { margin-top: 22px; background: #fff; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--itp-line); }
.itp-app .itp-gloss summary { padding: 14px 18px; cursor: pointer; font-weight: 800; color: var(--itp-ink); list-style-position: inside; }
.itp-app .itp-gloss dl { margin: 0; padding: 0 18px 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 28px; }
.itp-app .itp-gloss dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--itp-line); }
.itp-app .itp-gloss dt { margin: 0; font-weight: 700; font-size: .9rem; }
.itp-app .itp-gloss dd { margin: 0; font-size: .9rem; color: var(--itp-ink2); text-align: right; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
	.itp-app { margin: 14px 0; border-radius: 14px; }
	.itp-app .itp-head { padding: 20px 18px; grid-template-columns: auto 1fr; gap: 6px 14px; }
	.itp-app .itp-stack { width: 48px; height: 56px; }
	.itp-app .itp-title { font-size: 1.35rem; }
	.itp-app .itp-body { padding: 16px 14px 20px; }
	.itp-app .itp-presets { grid-template-columns: repeat(2, 1fr); }
	.itp-app .itp-row4 { grid-template-columns: repeat(2, 1fr); }
	.itp-app .itp-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
	.itp-app .itp-gloss dl { grid-template-columns: 1fr; }
	.itp-app .itp-pill { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.itp-app * { transition: none !important; }
}

/* ---------- Ad slots ---------- */
.itp-app .itp-ad { margin: 0; padding: 12px 20px 14px; text-align: center; background: #fff; overflow: hidden; min-height: 60px; }
.itp-app .itp-body .itp-ad, .itp-app .itp-ad + .itp-ad { margin-top: 22px; border-radius: 12px; }
.itp-app .itp-ad small { display: block; margin-bottom: 6px; font-size: .68rem; color: var(--itp-mute); }
.itp-app > .itp-ad:last-child { border-top: 1px solid var(--itp-line); }
