.ropdf, .ropdf *, .ropdf *::before, .ropdf *::after { box-sizing: border-box; }
.ropdf [hidden], .ropdf .ropdf-off { display: none !important; }

.ropdf {
	--ro-bg: var(--ro-l-bg); --ro-card: var(--ro-l-card); --ro-text: var(--ro-l-text);
	--ro-line: rgba(128, 128, 128, .30);
	max-width: 960px; margin: 0 auto; padding: 20px;
	background: var(--ro-bg); color: var(--ro-text);
	border-radius: 20px; font-family: inherit; line-height: 1.55;
}
.ropdf[data-theme="dark"] { --ro-bg: var(--ro-d-bg); --ro-card: var(--ro-d-card); --ro-text: var(--ro-d-text); }

/* Header */
.ropdf-hero {
	position: relative; text-align: center; padding: 48px 24px 40px; border-radius: 16px;
	background: linear-gradient(var(--ro-ang, 135deg), var(--ro-g1), var(--ro-g2));
}
.ropdf .ropdf-title { margin: 0 0 8px; padding: 0; color: var(--ro-tc); font-size: var(--ro-ts); font-weight: 700; line-height: 1.15; }
.ropdf .ropdf-sub { margin: 0; color: var(--ro-sc); font-size: var(--ro-ss); font-weight: 600; }
.ropdf .ropdf-mode {
	position: absolute; top: 14px; right: 14px; padding: 6px 14px; cursor: pointer;
	color: var(--ro-tc); background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .45);
	border-radius: 999px; font: inherit; font-size: 14px; line-height: 1.4;
}
.ropdf .ropdf-mode:hover { background: rgba(255, 255, 255, .26); }

/* Card */
.ropdf-card {
	margin-top: 18px; padding: 24px; background: var(--ro-card);
	border: 1px solid var(--ro-line); border-radius: 16px;
}
.ropdf .ropdf-card h3 { margin: 0 0 6px; color: var(--ro-text); font-size: 22px; }
.ropdf .ropdf-desc { margin: 0 0 18px; opacity: .78; }

.ropdf-drop {
	position: relative; display: block; padding: 34px 16px; text-align: center; cursor: pointer;
	border: 2px dashed var(--ro-accent); border-radius: 12px; font-weight: 600;
	transition: background-color .15s;
}
.ropdf-drop:hover, .ropdf-drop.is-over, .ropdf-drop:focus-within { background: rgba(128, 128, 128, .10); }
.ropdf-drop:focus-within { outline: 2px solid var(--ro-accent); outline-offset: 2px; }
.ropdf-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ropdf-drop-text { overflow-wrap: anywhere; }

.ropdf-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.ropdf .ropdf-btn {
	padding: 11px 22px; cursor: pointer; font: inherit; font-weight: 600; line-height: 1.2;
	color: var(--ro-btn-text); background: var(--ro-accent); border: 0; border-radius: 10px;
}
.ropdf .ropdf-btn:hover:not(:disabled) { filter: brightness(1.08); }
.ropdf .ropdf-btn:disabled { opacity: .45; cursor: not-allowed; }
.ropdf .ropdf-btn:focus-visible, .ropdf .ropdf-link:focus-visible, .ropdf .ropdf-mode:focus-visible { outline: 2px solid var(--ro-accent); outline-offset: 2px; }

.ropdf-status { min-height: 1.6em; margin: 12px 0 0; font-size: 15px; }
.ropdf-status.is-ok { color: #1a8a4a; }
.ropdf-status.is-err { color: #c0392b; }
.ropdf[data-theme="dark"] .ropdf-status.is-ok { color: #5fd18c; }
.ropdf[data-theme="dark"] .ropdf-status.is-err { color: #ff8a80; }
.ropdf.is-busy .ropdf-status::before {
	content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
	border: 2px solid var(--ro-line); border-top-color: var(--ro-accent); border-radius: 50%;
	animation: ropdf-spin .8s linear infinite;
}
@keyframes ropdf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ropdf.is-busy .ropdf-status::before { animation: none; } }

/* Preview */
.ropdf-stage { margin-top: 14px; border: 1px solid var(--ro-line); border-radius: 12px; overflow: hidden; }
.ropdf-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--ro-line); }
.ropdf .ropdf-link { padding: 0; font: inherit; font-weight: 600; color: var(--ro-accent); background: none; border: 0; cursor: pointer; text-decoration: underline; }
.ropdf-view { height: 60vh; min-height: 300px; max-height: 640px; background: #fff; cursor: grab; touch-action: none; user-select: none; }
.ropdf-view.is-drag { cursor: grabbing; }
.ropdf-view svg { display: block; width: 100%; height: 100%; }

.ropdf .ropdf-privacy { margin: 18px 0 0; font-size: 13px; opacity: .7; }
.ropdf .ropdf-credit { margin: 16px 0 0; text-align: center; font-size: 14px; }
.ropdf .ropdf-credit a { color: var(--ro-accent); text-decoration: none; font-weight: 600; }
.ropdf .ropdf-credit a:hover { text-decoration: underline; }

@media (max-width: 600px) {
	.ropdf { padding: 12px; border-radius: 14px; }
	.ropdf-hero { padding: 56px 16px 28px; }
	.ropdf-card { padding: 16px; }
}

/* ===== Full-viewport layout, iLovePDF-style work area ===== */
.ropdf {
	display: flex; flex-direction: column; width: 100%; max-width: 1280px;
	min-height: calc(100vh - var(--ro-offset, 0px));
	min-height: calc(100dvh - var(--ro-offset, 0px));
}
.ropdf-hero { flex: none; }
.ropdf-card { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.ropdf-credit { flex: none; }
.ropdf-demo { min-height: 0; }

.ropdf-intro { flex: none; }
.ropdf-drop { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 220px; font-size: 20px; }
.ropdf-drop small { font-size: 14px; font-weight: 400; opacity: .7; }
.ropdf.has-file .ropdf-drop { display: none; }
.ropdf-demo.has-file .ropdf-drop, .ropdf-demo .ropdf-drop { display: flex; min-height: 120px; flex: none; }

.ropdf-work { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; min-height: 0; margin-top: 8px; }
.ropdf-work[hidden] { display: none !important; }
.ropdf-stage { display: flex; flex-direction: column; min-height: 360px; margin-top: 0; background: var(--ro-bg); }
.ropdf-view { flex: 1 1 0; min-height: 0; height: auto; max-height: none; overflow: auto; padding: 16px; background: rgba(128,128,128,.12); cursor: default; touch-action: auto; user-select: auto; }
.ropdf-bar { flex: none; }
.ropdf-count { font-weight: 400; opacity: .7; }
.ropdf-pg { margin: 0 auto 16px; width: fit-content; max-width: 100%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.ropdf-pg canvas { display: block; max-width: 100%; height: auto; }
.ropdf-pg-demo { display: block; width: 260px; height: 340px; background: repeating-linear-gradient(#fff 0 14px, #e6e9ee 14px 16px); }

.ropdf-side { align-self: start; position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--ro-line); border-radius: 12px; }
.ropdf .ropdf-fname { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.ropdf .ropdf-meta { margin: 0; font-size: 14px; opacity: .7; }
.ropdf .ropdf-side h4 { margin: 8px 0 0; font-size: 16px; color: var(--ro-text); }
.ropdf .ropdf-side .ropdf-btn { width: 100%; padding: 14px 18px; font-size: 16px; }
.ropdf .ropdf-side .ropdf-link { align-self: flex-start; margin-top: 6px; }
.ropdf-status { flex: none; }

@media (max-width: 800px) {
	.ropdf-work { grid-template-columns: 1fr; }
	.ropdf-side { position: static; order: -1; }
	.ropdf-stage { min-height: 50vh; }
}

.ropdf .ropdf-detail { margin: 6px 0 0; font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; opacity: .7; overflow-wrap: anywhere; user-select: text; }
.ropdf .ropdf-detail[hidden] { display: none !important; }
